Changeset 6f951ca in flex_extract.git for source/python/classes/EcFlexpart.py


Ignore:
Timestamp:
Jan 15, 2019, 1:05:10 AM (5 years ago)
Author:
Anne Philipp <anne.philipp@…>
Branches:
master, ctbto, dev
Children:
d4696e0
Parents:
2625ca8
Message:

new style of docstring params and updates in docstrings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/python/classes/EcFlexpart.py

    rbf48c8a r6f951ca  
    4141#
    4242# @License:
    43 #    (C) Copyright 2014-2018.
     43#    (C) Copyright 2014-2019.
     44#    Anne Philipp, Leopold Haimberger
    4445#
    45 #    This software is licensed under the terms of the Apache Licence Version 2.0
    46 #    which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
    47 #
    48 # @Class Description:
    49 #    FLEXPART needs grib files in a specifc format. All necessary data fields
    50 #    for one time step are stored in a single file. The class represents an
    51 #    instance with all the parameter and settings necessary for retrieving
    52 #    MARS data and modifing them so they are fitting FLEXPART need. The class
    53 #    is able to disaggregate the fluxes and convert grid types to the one needed
    54 #    by FLEXPART, therefore using the FORTRAN program.
    55 #
    56 # @Class Content:
    57 #    - __init__
    58 #    - write_namelist
    59 #    - retrieve
    60 #    - process_output
    61 #    - create
    62 #    - deacc_fluxes
    63 #
    64 # @Class Attributes:
    65 #
    66 #  TODO
    67 #
     46#    This work is licensed under the Creative Commons Attribution 4.0
     47#    International License. To view a copy of this license, visit
     48#    http://creativecommons.org/licenses/by/4.0/ or send a letter to
     49#    Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
    6850#*******************************************************************************
    6951#pylint: disable=unsupported-assignment-operation
     
    10284class EcFlexpart(object):
    10385    '''
    104     Class to retrieve FLEXPART specific ECMWF data.
     86    Class to represent FLEXPART specific ECMWF data.
     87
     88    FLEXPART needs grib files in a specifc format. All necessary data fields
     89    for one time step are stored in a single file. The class represents an
     90    instance with all the parameter and settings necessary for retrieving
     91    MARS data and modifing them so they are fitting FLEXPART needs. The class
     92    is able to disaggregate the fluxes and convert grid types to the one needed
     93    by FLEXPART, therefore using the FORTRAN program.
     94
     95    Attributes
     96    ----------
     97    mreq_count : int
     98        Counter for the number of generated mars requests.
     99
     100    inputdir : str
     101        Path to the directory where the retrieved data is stored.
     102
     103    dataset : str
     104        For public datasets there is the specific naming and parameter
     105        dataset which has to be used to characterize the type of
     106        data.
     107
     108    basetime : str
     109        The time for a half day retrieval. The 12 hours upfront are to be
     110        retrieved.
     111
     112    dtime : str
     113        Time step in hours.
     114
     115    acctype : str
     116        The field type for the accumulated forecast fields.
     117
     118    acctime : str
     119        The starting time from the accumulated forecasts.
     120
     121    accmaxstep : str
     122        The maximum forecast step for the accumulated forecast fields.
     123
     124    marsclass : str
     125        Characterisation of dataset.
     126
     127    stream : str
     128        Identifies the forecasting system used to generate the data.
     129
     130    number : str
     131        Selects the member in ensemble forecast run.
     132
     133    resol : str
     134        Specifies the desired triangular truncation of retrieved data,
     135        before carrying out any other selected post-processing.
     136
     137    accuracy : str
     138        Specifies the number of bits per value to be used in the
     139        generated GRIB coded fields.
     140
     141    addpar : str
     142        List of additional parameters to be retrieved.
     143
     144    level : str
     145        Specifies the maximum level.
     146
     147    expver : str
     148        The version of the dataset.
     149
     150    levelist : str
     151        Specifies the required levels.
     152
     153    glevelist : str
     154        Specifies the required levels for gaussian grids.
     155
     156    gaussian : str
     157        This parameter is deprecated and should no longer be used.
     158        Specifies the desired type of Gaussian grid for the output.
     159
     160    grid : str
     161        Specifies the output grid which can be either a Gaussian grid
     162        or a Latitude/Longitude grid.
     163
     164    area : str
     165        Specifies the desired sub-area of data to be extracted.
     166
     167    purefc : int
     168        Switch for definition of pure forecast mode or not.
     169
     170    outputfilelist : list of str
     171        The final list of FLEXPART ready input files.
     172
     173    types : dictionary
     174        Determines the combination of type of fields, time and forecast step
     175        to be retrieved.
     176
     177    params : dictionary
     178        Collection of grid types and their corresponding parameters,
     179        levels, level types and the grid definition.
     180
     181    server : ECMWFService or ECMWFDataServer
     182        This is the connection to the ECMWF data servers.
     183
     184    public : int
     185        Decides which Web API Server version is used.
     186
     187    dates : str
     188        Contains start and end date of the retrieval in the format
     189        "YYYYMMDD/to/YYYYMMDD"
    105190    '''
     191
    106192    # --------------------------------------------------------------------------
    107193    # CLASS FUNCTIONS
     
    113199        Parameters:
    114200        -----------
    115         c : :obj:`ControlFile`
     201        c : ControlFile
    116202            Contains all the parameters of CONTROL file and
    117203            command line.
    118204
    119         fluxes : :obj:`boolean`, optional
     205        fluxes : boolean, optional
    120206            Decides if the flux parameter settings are stored or
    121207            the rest of the parameter list.
     
    174260        Parameters:
    175261        -----------
    176         ftype : :obj:`list` of :obj:`string`
     262        ftype : list of str
    177263            List of field types.
    178264
    179         ftime : :obj:`list` of :obj:`string`
     265        ftime : list of str
    180266            The time in hours of the field.
    181267
    182         fstep : :obj:`string`
     268        fstep : str
    183269            Specifies the forecast time step from forecast base time.
    184270            Valid values are hours (HH) from forecast base time.
     
    267353        Parameters:
    268354        -----------
    269         gauss : :obj:`integer`
     355        gauss : int
    270356            Gaussian grid is retrieved.
    271357
    272         eta : :obj:`integer`
     358        eta : int
    273359            Etadot parameter will be directly retrieved.
    274360
    275         omega : :obj:`integer`
     361        omega : int
    276362            The omega paramterwill be retrieved.
    277363
    278         cwc : :obj:`integer`
     364        cwc : int
    279365            The cloud liquid and ice water content will be retrieved.
    280366
    281         wrf : :obj:`integer`
     367        wrf : int
    282368            Additional model level and surface level data will be retrieved for
    283369            WRF/FLEXPART-WRF simulations.
     
    374460        Parameters
    375461        ----------
    376         ftype : :obj:`string`
     462        ftype : str
    377463            Shortcut name of the type of the field. E.g. AN, FC, PF, ...
    378464
    379         param : :obj:`string`
     465        param : str
    380466            Shortcut of the grid type. E.g. SH__ML, SH__SL, GG__ML,
    381467            GG__SL, OG__ML, OG__SL, OG_OROLSM_SL, OG_acc_SL
    382468
    383         date : :obj:`string`
     469        date : str
    384470            The date period of the grib data to be stored in this file.
    385471
    386472        Return
    387473        ------
    388         targetname : :obj:`string`
     474        targetname : str
    389475            The target filename for the grib data.
    390476        '''
     
    401487        Parameters
    402488        ----------
    403         request : :obj:`integer`
     489        request : int
    404490            Selects the mode of retrieval.
    405491            0: Retrieves the data from ECMWF.
     
    407493            2: Retrieves the data and prints the mars request.
    408494
    409         par_dict : :obj:`dictionary`
     495        par_dict : dictionary
    410496            Contains all parameter which have to be set for creating the
    411497            Mars Retrievals. The parameter are:
     
    463549        Parameters
    464550        ----------
    465         keys : :obj:`dictionary`
     551        keys : dictionary
    466552            List of parameter names which serves as index.
    467553
    468         inputfiles : :obj:`UioFiles`
     554        inputfiles : UioFiles
    469555            Contains a list of files.
    470556
    471557        Return
    472558        ------
    473         iid : :obj:`codes_index`
     559        iid : codes_index
    474560            This is a grib specific index structure to access
    475561            messages in a file.
    476562
    477         index_vals : :obj:`list`
     563        index_vals : list of list  of str
    478564            Contains the values from the keys used for a distinct selection
    479565            of grib messages in processing  the grib files.
     
    517603        Parameters
    518604        ----------
    519         server : :obj:`ECMWFService` or :obj:`ECMWFDataServer`
     605        server : ECMWFService or ECMWFDataServer
    520606            The connection to the ECMWF server. This is different
    521607            for member state users which have full access and non
     
    525611            for member state users its False (ECMWFService)
    526612
    527         dates : :obj:`string`
     613        dates : str
    528614            Contains start and end date of the retrieval in the format
    529615            "YYYYMMDD/to/YYYYMMDD"
    530616
    531         request : :obj:`integer`
     617        request : int
    532618            Selects the mode of retrieval.
    533619            0: Retrieves the data from ECMWF.
     
    535621            2: Retrieves the data and prints the mars request.
    536622
    537         inputdir : :obj:`string`, optional
     623        inputdir : str, optional
    538624            Path to the directory where the retrieved data is about
    539625            to be stored. The default is the current directory ('.').
     
    723809        Parameters
    724810        ----------
    725         c : :obj:`ControlFile`
     811        c : ControlFile
    726812            Contains all the parameters of CONTROL file and
    727813            command line.
    728814
    729         filename : :obj:`string`
     815        filename : str
    730816                Name of the namelist file.
    731817
     
    810896        Parameters
    811897        ----------
    812         inputfiles : :obj:`UioFiles`
     898        inputfiles : UioFiles
    813899            Contains the list of files that contain flux data.
    814900
    815         c : :obj:`ControlFile`
     901        c : ControlFile
    816902            Contains all the parameters of CONTROL file and
    817903            command line.
     
    837923        # index_vals[0]: ('20171106', '20171107', '20171108') ; date
    838924        # index_vals[1]: ('0', '600', '1200', '1800') ; time
    839         # index_vals[2]: ('0', '12', '3', '6', '9') ; stepRange
     925        # index_vals[2]: ('0', '3', '6', '9', '12') ; stepRange
    840926
    841927        if c.rrint:
     
    10961182        Parameters
    10971183        ----------
    1098         ni : :obj:`integer`
     1184        ni : int
    10991185            Amount of zonal grid points.
    11001186
    1101         nj : :obj:`integer`
     1187        nj : int
    11021188            Amount of meridional grid points.
    11031189
    1104         nt : :obj:`integer`
     1190        nt : int
    11051191            Number of time steps.
    11061192
    1107         lsp_np : :obj:`numpy array` of :obj:`float`
     1193        lsp_np : numpy array of float
    11081194            The large scale precipitation fields for each time step.
    11091195            Shape (ni * nj, nt).
    11101196
    1111         cp_np : :obj:`numpy array` of :obj:`float`
     1197        cp_np : numpy array of float
    11121198            The convective precipitation fields for each time step.
    11131199            Shape (ni * nj, nt).
    11141200
    1115         date_list : :obj:`list` of :obj:`datetime`
     1201        date_list : list of datetime
    11161202            The list of dates for which the disaggregation is to be done.
    11171203
    1118         step_list : :obj:`list` of :obj:`integer`
     1204        step_list : list of int
    11191205            The list of steps for a single forecast time.
    11201206            Only necessary for pure forecasts.
    11211207
    1122         c : :obj:`ControlFile`
     1208        c : ControlFile
    11231209            Contains all the parameters of CONTROL file and
    11241210            command line.
     
    12171303        Parameters
    12181304        ----------
    1219         ifile : :obj:`string`
     1305        ifile : str
    12201306            Filename of the input file to read the grib messages from.
    12211307
    1222         inputdir : :obj:`string`, optional
     1308        inputdir : str, optional
    12231309            Path to the directory where the retrieved data is stored.
    12241310
     
    12551341        Parameters
    12561342        ----------
    1257         inputfiles : :obj:`UioFiles`
     1343        inputfiles : UioFiles
    12581344            Contains a list of files.
    12591345
    1260         c : :obj:`ControlFile`
     1346        c : ControlFile
    12611347            Contains all the parameters of CONTROL file and
    12621348            command line.
     
    14861572        Parameters
    14871573        ----------
    1488         c : :obj:`ControlFile`
     1574        c : ControlFile
    14891575            Contains all the parameters of CONTROL file and
    14901576            command line.
     
    15451631        Parameters
    15461632        ----------
    1547         c : :obj:`ControlFile`
     1633        c : ControlFile
    15481634            Contains all the parameters of CONTROL file and
    15491635            command line.
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG