Changeset 0f89116 in flex_extract.git for Source/Python/Classes/GribUtil.py
- Timestamp:
- Dec 19, 2019, 8:07:12 PM (4 years ago)
- Branches:
- master, ctbto, dev
- Children:
- a73c0f6
- Parents:
- 0d99607
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Source/Python/Classes/GribUtil.py
rc77630a r0f89116 68 68 69 69 70 def get_keys(self, keynames, wherekeynames =[], wherekeyvalues=[]):70 def get_keys(self, keynames, wherekeynames, wherekeyvalues): 71 71 '''Get keyvalues for a given list of keynames a where statement 72 72 can be given (list of key and list of values) … … 77 77 List of keynames. 78 78 79 wherekeynames : :obj:`list` of :obj:`string` , optional80 Default value is an empty list.81 82 wherekeyvalues : :obj:`list` of :obj:`string` , optional83 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. 84 84 85 85 Return … … 122 122 123 123 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'): 126 126 '''Opens the file to read the grib messages and then write 127 127 the selected messages (with wherekeys) to a new output file. … … 141 141 Default is an empty list. 142 142 143 wherekeynames : :obj:`list` of :obj:`string` , optional143 wherekeynames : :obj:`list` of :obj:`string` 144 144 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` 148 147 List of keyvalues for keynames to select correct message. 149 Default value is an empty list.150 151 strict : :obj:`boolean`, optional152 Decides if everything from keynames and keyvalues153 is written out the grib file (False) or only those154 meeting the where statement (True). Default is False.155 148 156 149 filemode : :obj:`string`, optional … … 200 193 return 201 194 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'): 204 197 '''Add the content of another input grib file to the objects file but 205 198 only messages corresponding to keys/values passed to the function. … … 212 205 Filename of the input file to read the grib messages from. 213 206 214 select Where : :obj:`boolean`, optional207 selectwhere : :obj:`boolean`, optional 215 208 Decides if to copy the keynames and values equal to (True) or 216 209 different to (False) the keynames/keyvalues list passed to the 217 210 function. Default is True. 218 211 219 keynames : :obj:`list` of :obj:`string` , optional220 List of keynames. Default is an empty list.221 222 keyvalues : :obj:`list` of :obj:`string` , optional223 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. 224 217 225 218 filemode : :obj:`string`, optional … … 254 247 raise Exception("Key was not defined") 255 248 256 if select Where:249 if selectwhere: 257 250 select = (select and (str(keyvalues[i]) == 258 251 str(codes_get(gid, key)))) … … 272 265 return 273 266 274 def index(self, index_keys =["mars"], index_file="my.idx"):267 def index(self, index_keys, index_file="my.idx"): 275 268 '''Create index file from a list of files if it does not exist or 276 269 read an index file. … … 278 271 Parameters 279 272 ---------- 280 index_keys: :obj:`list` of :obj:`string` , optional273 index_keys: :obj:`list` of :obj:`string` 281 274 Contains the list of key parameter names from 282 275 which the index is to be created. 283 Default is a list with a single entry string "mars".284 276 285 277 index_file: :obj:`string`, optional
Note: See TracChangeset
for help on using the changeset viewer.