Changeset 0f89116 in flex_extract.git for Source/Python/Mods/tools.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/Mods/tools.py

    rc77630a r0f89116  
    6969import subprocess
    7070import traceback
     71# pylint: disable=unused-import
    7172try:
    7273    import exceptions
    7374except ImportError:
    7475    import builtins as exceptions
     76# pylint: enable=unused-import
    7577from datetime import datetime, timedelta
    7678from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
     
    268270        and destination for ECMWF server environments.
    269271    '''
    270     envs= {}
     272    envs = {}
    271273    try:
    272274        with open(filepath, 'r') as f:
     
    279281
    280282        sys.exit('\n... Error occured while trying to read ECMWF_ENV '
    281                      'file: ' + str(filepath))
     283                 'file: ' + str(filepath))
    282284
    283285    return envs
     
    302304    print("... clean inputdir!")
    303305
    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)]
    306309
    307310    if cleanlist:
     
    371374                                 stderr=subprocess.PIPE,
    372375                                 bufsize=1)
    373             pout = p.communicate(input=message.encode() + '\n\n')[0]
     376            pout = p.communicate(input=message + '\n\n')[0]
    374377        except ValueError as e:
    375378            print('... ERROR: ' + str(e))
     
    531534        return []
    532535    if not isinstance(pars, str):
    533         pars=str(pars)
     536        pars = str(pars)
    534537
    535538    cpar = pars.upper().split('/')
     
    575578        return []
    576579    if not isinstance(pars, str):
    577         pars=str(pars)
     580        pars = str(pars)
    578581
    579582    cpar = pars.upper().split('/')
     
    768771
    769772        # information needed from grib message
    770         keys = [
    771                 'Ni',
     773        keys = ['Ni',
    772774                'Nj',
    773775                'latitudeOfFirstGridPointInDegrees',
     
    783785        for key in keys:
    784786            # 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]))
    787789
    788790        # Free the memory for the message referred as gribid.
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG