Changeset 4971f63 in flex_extract.git


Ignore:
Timestamp:
Sep 27, 2018, 12:31:47 PM (11 months ago)
Author:
Anne Philipp <anne.philipp@…>
Branches:
dev
Children:
82b624a
Parents:
25b14be
Message:

eliminated some redundancy and exchanged CONTROL2 with the config-filename

Location:
source/python
Files:
6 edited

Legend:

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

    r25b14be r4971f63  
    180180
    181181        # read whole CONTROL file
    182         with open(os.path.join(_config.PATH_CONTROLFILES,
    183                                self.controlfile)) as f:
    184             fdata = f.read().split('\n')
     182
     183        try:
     184            with open(os.path.join(_config.PATH_CONTROLFILES,
     185                                   self.controlfile)) as f:
     186                fdata = f.read().split('\n')
     187        except IOError:
     188            print('Could not read CONTROL file "' + args.controlfile + '"')
     189            print('Either it does not exist or its syntax is wrong.')
     190            print('Try "' + sys.argv[0].split('/')[-1] + \
     191                      ' -h" to print usage information')
     192            sys.exit(1)
    185193
    186194        # go through every line and store parameter
  • source/python/classes/EcFlexpart.py

    r25b14be r4971f63  
    807807            over all messages in each grib file which were passed through the
    808808            parameter "inputfiles" to seperate specific parameters into fort.*
    809             files. Afterwards the FORTRAN program Convert2 is called to convert
     809            files. Afterwards the FORTRAN program is called to convert
    810810            the data fields all to the same grid and put them in one file
    811811            per unique time step (combination of "date", "time" and
     
    866866            # per date e.g. time = 0, 1200
    867867            # per time e.g. step = 3, 6, 9, 12
    868             # flag for Fortran program CONVERT2 and file merging
     868            # flag for Fortran program and file merging
    869869            convertFlag = False
    870870            print('current prod: ', prod)
     
    884884                # Combine all temporary data files into final grib file if
    885885                # gid is at least one time not None. Therefore set convertFlag
    886                 # to save information. The fortran program CONVERT2 is also
    887                 # only done if convertFlag is True
     886                # to save information. The Fortran program is also
     887                # only executed if convertFlag is True
    888888                convertFlag = True
    889889                # remove old fort.* files and open new ones
     
    997997                f.close()
    998998
    999             # call for CONVERT2 if flag is True
     999            # call for Fortran program if flag is True
    10001000            if convertFlag:
    10011001                pwd = os.getcwd()
     
    10091009
    10101010                # create the corresponding output file fort.15
    1011                 # (generated by CONVERT2) + fort.16 (paramId 167 and 168)
    1012                 p = subprocess.check_call([os.path.join(c.exedir, 'CONVERT2')],
    1013                                           shell=True)
     1011                # (generated by Fortran program) + fort.16 (paramId 167 and 168)
     1012                p = subprocess.check_call([os.path.join(
     1013                    c.exedir, _config.FORTRAN_EXECUTABLE)], shell=True)
    10141014                os.chdir(pwd)
    10151015
  • source/python/install.py

    r25b14be r4971f63  
    7878    '''
    7979
    80     #os.chdir(_config.PATH_LOCAL_PYTHON)
    81 
    8280    args = get_install_cmdline_arguments()
    83 
    84     try:
    85         c = ControlFile(args.controlfile)
    86     except IOError:
    87         print('Could not read CONTROL file "' + args.controlfile + '"')
    88         print('Either it does not exist or its syntax is wrong.')
    89         print('Try "' + sys.argv[0].split('/')[-1] +
    90               ' -h" to print usage information')
    91         exit(1)
    92 
     81    c = ControlFile(args.controlfile)
    9382    c.assign_args_to_control(args)
    9483    c.check_install_conditions()
  • source/python/mods/get_mars_data.py

    r25b14be r4971f63  
    7979
    8080    args = get_cmdline_arguments()
    81 
    82     try:
    83         c = ControlFile(args.controlfile)
    84     except IOError:
    85         print('Could not read CONTROL file "' + args.controlfile + '"')
    86         print('Either it does not exist or its syntax is wrong.')
    87         print('Try "' + sys.argv[0].split('/')[-1] + \
    88               ' -h" to print usage information')
    89         sys.exit(1)
     81    c = ControlFile(args.controlfile)
    9082
    9183    env_parameter = read_ecenv(_config.PATH_ECMWF_ENV)
  • source/python/mods/prepare_flexpart.py

    r25b14be r4971f63  
    8989
    9090    args = get_cmdline_arguments()
    91 
    92     try:
    93         c = ControlFile(args.controlfile)
    94     except IOError:
    95         print('Could not read CONTROL file "' + args.controlfile + '"')
    96         print('Either it does not exist or its syntax is wrong.')
    97         print('Try "' + sys.argv[0].split('/')[-1] + \
    98               ' -h" to print usage information')
    99         sys.exit(1)
     91    c = ControlFile(args.controlfile)
    10092
    10193    env_parameter = read_ecenv(_config.PATH_ECMWF_ENV)
  • source/python/submit.py

    r25b14be r4971f63  
    7777
    7878    args = get_cmdline_arguments()
    79 
    80     try:
    81         c = ControlFile(args.controlfile)
    82     except IOError:
    83         print('Could not read CONTROL file "' + args.controlfile + '"')
    84         print('Either it does not exist or its syntax is wrong.')
    85         print('Try "' + sys.argv[0].split('/')[-1] + \
    86               ' -h" to print usage information')
    87         sys.exit(1)
     79    c = ControlFile(args.controlfile)
    8880
    8981    env_parameter = read_ecenv(_config.PATH_ECMWF_ENV)
     
    9587    # on ECMWF server this would also be the local side
    9688    called_from_dir = os.getcwd()
    97     if args.queue is None:
     89    if not args.queue:
    9890        if c.inputdir[0] != '/':
    9991            c.inputdir = os.path.join(called_from_dir, c.inputdir)
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG