Changeset 274f9ef in flex_extract.git for source/python/classes/ControlFile.py


Ignore:
Timestamp:
Oct 22, 2018, 11:44:47 AM (5 years ago)
Author:
Anne Philipp <anne.philipp@…>
Branches:
master, ctbto, dev
Children:
db27c09
Parents:
708c667
Message:

Converted docstrings to numpy style and build first structure for sphinxdocumentation (incl API)

File:
1 edited

Legend:

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

    r708c667 r274f9ef  
    7171
    7272    def __init__(self, filename):
    73         '''
    74         @Description:
    75             Initialises the instance of ControlFile class and defines
    76             all class attributes with default values. Afterwards calls
    77             function __read_controlfile__ to read parameter from
    78             Control file.
    79 
    80         @Input:
    81             self: instance of ControlFile class
    82                 Description see class documentation.
    83 
    84             filename: string
    85                 Name of CONTROL file.
    86 
    87         @Return:
    88             <nothing>
     73        '''Initialises the instance of ControlFile class and defines
     74        all class attributes with default values. Afterwards calls
     75        function __read_controlfile__ to read parameter from Control file.
     76
     77        Parameters
     78        ----------
     79        filename : :obj:`string`
     80            Name of CONTROL file.
     81
     82        Return
     83        ------
     84
    8985        '''
    9086
     
    162158
    163159    def __read_controlfile__(self):
    164         '''
    165         @Description:
    166             Read CONTROL file and assign all CONTROL file variables.
    167 
    168         @Input:
    169             self: instance of ControlFile class
    170                 Description see class documentation.
    171 
    172         @Return:
    173             <nothing>
     160        '''Read CONTROL file and assign all CONTROL file variables.
     161
     162        Parameters
     163        ----------
     164
     165        Return
     166        ------
     167
    174168        '''
    175169
     
    235229
    236230    def __str__(self):
    237         '''
    238         @Description:
    239             Prepares a string which have all the ControlFile
    240             class attributes with its associated values.
    241             Each attribute is printed in one line and in
    242             alphabetical order.
    243 
    244             Example:
    245             'age': 10
    246             'color': 'Spotted'
    247             'kids': 0
    248             'legs': 2
    249             'name': 'Dog'
    250             'smell': 'Alot'
    251 
    252         @Input:
    253             self: instance of ControlFile class
    254                 Description see class documentation.
    255 
    256         @Return:
    257             string of ControlFile class attributes with their values
     231        '''Prepares a string which have all the ControlFile class attributes
     232        with its associated values. Each attribute is printed in one line and
     233        in alphabetical order.
     234
     235        Example
     236        -------
     237        'age': 10
     238        'color': 'Spotted'
     239        'kids': 0
     240        'legs': 2
     241        'name': 'Dog'
     242        'smell': 'Alot'
     243
     244        Parameters
     245        ----------
     246
     247        Return
     248        ------
     249        string
     250            Single string of concatenated ControlFile class attributes
     251            with their values
    258252        '''
    259253        import collections
     
    265259
    266260    def assign_args_to_control(self, args):
    267         '''
    268         @Description:
    269             Overwrites the existing ControlFile instance attributes with
    270             the command line arguments.
    271 
    272         @Input:
    273             self: instance of ControlFile class
    274                 Description see class documentation.
    275 
    276             args: instance of ArgumentParser
    277                 Contains the commandline arguments from script/program call.
    278 
    279         @Return:
    280             <nothing>
     261        '''Overwrites the existing ControlFile instance attributes with
     262        the command line arguments.
     263
     264        Parameters
     265        ----------
     266        args : :obj:`Namespace`
     267            Contains the commandline arguments from script/program call.
     268
     269        Return
     270        ------
     271
    281272        '''
    282273
     
    294285
    295286    def assign_envs_to_control(self, envs):
    296         '''
    297         @Description:
    298             Assigns the ECMWF environment parameter.
    299 
    300         @Input:
    301             envs: dict of strings
    302                 Contains the ECMWF environment parameternames "ECUID", "ECGID",
    303                 "DESTINATION" and "GATEWAY" with its corresponding values.
    304                 They were read from the file "ECMWF_ENV".
    305 
    306         @Return:
    307             <nothing>
     287        '''Assigns the ECMWF environment parameter.
     288
     289        Parameters
     290        ----------
     291        envs : :obj:`dictionary` of :obj:`strings`
     292            Contains the ECMWF environment parameternames "ECUID", "ECGID",
     293            "DESTINATION" and "GATEWAY" with its corresponding values.
     294            They were read from the file "ECMWF_ENV".
     295
     296        Return
     297        ------
     298
    308299        '''
    309300
     
    314305
    315306    def check_conditions(self, queue):
    316         '''
    317         @Description:
    318             Checks a couple of necessary attributes and conditions,
    319             such as if they exist and contain values.
    320             Otherwise set default values.
    321 
    322         @Input:
    323             self: instance of ControlFile class
    324                 Description see class documentation.
    325 
    326             queue: string
    327                 Name of the queue if submitted to the ECMWF servers.
    328                 Used to check if ecuid, ecgid, gateway and destination
    329                 are set correctly and are not empty.
    330 
    331         @Return:
    332             <nothing>
     307        '''Checks a couple of necessary attributes and conditions,
     308        such as if they exist and contain values.
     309        Otherwise set default values.
     310
     311        Parameters
     312        ----------
     313        queue : :obj:`string`
     314            Name of the queue if submitted to the ECMWF servers.
     315            Used to check if ecuid, ecgid, gateway and destination
     316            are set correctly and are not empty.
     317
     318        Return
     319        ------
     320
    333321        '''
    334322        from mods.tools import my_error
     
    501489
    502490    def check_install_conditions(self):
    503         '''
    504         @Description:
    505             Checks a couple of necessary attributes and conditions
    506             for the installation such as if they exist and contain values.
    507             Otherwise set default values.
    508 
    509         @Input:
    510             self: instance of ControlFile class
    511                 Description see class documentation.
    512 
    513         @Return:
    514             <nothing>
     491        '''Checks a couple of necessary attributes and conditions
     492        for the installation such as if they exist and contain values.
     493        Otherwise set default values.
     494
     495        Parameters
     496        ----------
     497
     498        Return
     499        ------
     500
    515501        '''
    516502
     
    549535
    550536    def to_list(self):
    551         '''
    552         @Description:
    553             Just generates a list of strings containing the attributes and
    554             assigned values except the attributes "_expanded", "exedir",
     537        '''Just generates a list of strings containing the attributes and
     538        assigned values except the attributes "_expanded", "exedir",
     539        "ecmwfdatadir" and "flexpart_root_scripts".
     540
     541        Parameters
     542        ----------
     543
     544        Return
     545        ------
     546        l : :obj:`list`
     547            A sorted list of the all ControlFile class attributes with
     548            their values except the attributes "_expanded", "exedir",
    555549            "ecmwfdatadir" and "flexpart_root_scripts".
    556 
    557         @Input:
    558             self: instance of ControlFile class
    559                 Description see class documentation.
    560 
    561         @Return:
    562             l: list
    563                 A sorted list of the all ControlFile class attributes with
    564                 their values except the attributes "_expanded", "exedir",
    565                 "ecmwfdatadir" and "flexpart_root_scripts".
    566550        '''
    567551
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG