Changeset 0f89116 in flex_extract.git for Source/Python/Classes/GribUtil.py


Ignore:
Timestamp:
Dec 19, 2019, 8:07:12 PM (4 years ago)
Author:
Anne Philipp <anne.philipp@…>
Branches:
master, ctbto, dev
Children:
a73c0f6
Parents:
0d99607
Message:

diverse changes due to PEP8 style guide and eliminating grib2flexpart; removed unused parameter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Source/Python/Classes/GribUtil.py

    rc77630a r0f89116  
    6868
    6969
    70     def get_keys(self, keynames, wherekeynames=[], wherekeyvalues=[]):
     70    def get_keys(self, keynames, wherekeynames, wherekeyvalues):
    7171        '''Get keyvalues for a given list of keynames a where statement
    7272        can be given (list of key and list of values)
     
    7777            List of keynames.
    7878
    79         wherekeynames : :obj:`list` of :obj:`string`, optional
    80             Default value is an empty list.
    81 
    82         wherekeyvalues : :obj:`list` of :obj:`string`, optional
    83             Default value is an empty list.
     79        wherekeynames : :obj:`list` of :obj:`string`
     80            List of key names for indexing grib message parameter.
     81
     82        wherekeyvalues : :obj:`list` of :obj:`string`
     83            List of key values corresponding the key names.
    8484
    8585        Return
     
    122122
    123123
    124     def set_keys(self, fromfile, keynames, keyvalues, wherekeynames=[],
    125                  wherekeyvalues=[], strict=False, filemode='wb'):
     124    def set_keys(self, fromfile, keynames, keyvalues, wherekeynames,
     125                 wherekeyvalues, filemode='wb'):
    126126        '''Opens the file to read the grib messages and then write
    127127        the selected messages (with wherekeys) to a new output file.
     
    141141            Default is an empty list.
    142142
    143         wherekeynames : :obj:`list` of :obj:`string`, optional
     143        wherekeynames : :obj:`list` of :obj:`string`
    144144            List of keynames to select correct message.
    145             Default value is an empty list.
    146 
    147         wherekeyvalues : :obj:`list` of :obj:`string`, optional
     145
     146        wherekeyvalues : :obj:`list` of :obj:`string`
    148147            List of keyvalues for keynames to select correct message.
    149             Default value is an empty list.
    150 
    151         strict : :obj:`boolean`, optional
    152             Decides if everything from keynames and keyvalues
    153             is written out the grib file (False) or only those
    154             meeting the where statement (True). Default is False.
    155148
    156149        filemode : :obj:`string`, optional
     
    200193        return
    201194
    202     def copy_dummy_msg(self, filename_in, selectWhere=True,
    203                  keynames=[], keyvalues=[], filemode='wb'):
     195    def copy_dummy_msg(self, filename_in, keynames, keyvalues,
     196                       selectwhere=True, filemode='wb'):
    204197        '''Add the content of another input grib file to the objects file but
    205198        only messages corresponding to keys/values passed to the function.
     
    212205            Filename of the input file to read the grib messages from.
    213206
    214         selectWhere : :obj:`boolean`, optional
     207        selectwhere : :obj:`boolean`, optional
    215208            Decides if to copy the keynames and values equal to (True) or
    216209            different to (False) the keynames/keyvalues list passed to the
    217210            function. Default is True.
    218211
    219         keynames : :obj:`list` of :obj:`string`, optional
    220             List of keynames. Default is an empty list.
    221 
    222         keyvalues : :obj:`list` of :obj:`string`, optional
    223             List of keyvalues. Default is an empty list.
     212        keynames : :obj:`list` of :obj:`string`
     213            List of keynames.
     214
     215        keyvalues : :obj:`list` of :obj:`string`
     216            List of keyvalues.
    224217
    225218        filemode : :obj:`string`, optional
     
    254247                    raise Exception("Key was not defined")
    255248
    256                 if selectWhere:
     249                if selectwhere:
    257250                    select = (select and (str(keyvalues[i]) ==
    258251                                          str(codes_get(gid, key))))
     
    272265        return
    273266
    274     def index(self, index_keys=["mars"], index_file="my.idx"):
     267    def index(self, index_keys, index_file="my.idx"):
    275268        '''Create index file from a list of files if it does not exist or
    276269        read an index file.
     
    278271        Parameters
    279272        ----------
    280         index_keys: :obj:`list` of :obj:`string`, optional
     273        index_keys: :obj:`list` of :obj:`string`
    281274            Contains the list of key parameter names from
    282275            which the index is to be created.
    283             Default is a list with a single entry string "mars".
    284276
    285277        index_file: :obj:`string`, optional
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG