Changeset 0f89116 in flex_extract.git for Source/Python/Mods/tools.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/Mods/tools.py
rc77630a r0f89116 69 69 import subprocess 70 70 import traceback 71 # pylint: disable=unused-import 71 72 try: 72 73 import exceptions 73 74 except ImportError: 74 75 import builtins as exceptions 76 # pylint: enable=unused-import 75 77 from datetime import datetime, timedelta 76 78 from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter … … 268 270 and destination for ECMWF server environments. 269 271 ''' 270 envs = {}272 envs = {} 271 273 try: 272 274 with open(filepath, 'r') as f: … … 279 281 280 282 sys.exit('\n... Error occured while trying to read ECMWF_ENV ' 281 283 'file: ' + str(filepath)) 282 284 283 285 return envs … … 302 304 print("... clean inputdir!") 303 305 304 cleanlist = [file for file in glob.glob(os.path.join(c.inputdir, "*")) 305 if not os.path.basename(file).startswith(c.prefix)] 306 cleanlist = [filename for filename in 307 glob.glob(os.path.join(c.inputdir, "*")) 308 if not os.path.basename(filename).startswith(c.prefix)] 306 309 307 310 if cleanlist: … … 371 374 stderr=subprocess.PIPE, 372 375 bufsize=1) 373 pout = p.communicate(input=message .encode()+ '\n\n')[0]376 pout = p.communicate(input=message + '\n\n')[0] 374 377 except ValueError as e: 375 378 print('... ERROR: ' + str(e)) … … 531 534 return [] 532 535 if not isinstance(pars, str): 533 pars =str(pars)536 pars = str(pars) 534 537 535 538 cpar = pars.upper().split('/') … … 575 578 return [] 576 579 if not isinstance(pars, str): 577 pars =str(pars)580 pars = str(pars) 578 581 579 582 cpar = pars.upper().split('/') … … 768 771 769 772 # information needed from grib message 770 keys = [ 771 'Ni', 773 keys = ['Ni', 772 774 'Nj', 773 775 'latitudeOfFirstGridPointInDegrees', … … 783 785 for key in keys: 784 786 # Get the value of the key in a grib message. 785 data[key] = codes_get(gid, key)786 print("%s = %s" % (key, data[key]))787 data[key] = codes_get(gid, key) 788 print("%s = %s" % (key, data[key])) 787 789 788 790 # Free the memory for the message referred as gribid.
Note: See TracChangeset
for help on using the changeset viewer.