Changeset 2fb99de in flex_extract.git for python/prepare_flexpart.py
- Timestamp:
- Sep 20, 2018, 11:56:37 AM (6 years ago)
- Branches:
- master, ctbto, dev
- Children:
- 5d42acd
- Parents:
- 3232589
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/prepare_flexpart.py
r54a8a01 r2fb99de 57 57 import sys 58 58 import socket 59 import _config60 59 61 60 # software specific classes and modules from flex_extract 61 import _config 62 62 from UioFiles import UioFiles 63 63 from tools import clean_up, get_cmdline_arguments, read_ecenv … … 70 70 except ImportError: 71 71 ecapi = False 72 73 # add path to pythonpath so that python finds its buddies74 LOCAL_PYTHON_PATH = os.path.dirname(os.path.abspath(75 inspect.getfile(inspect.currentframe())))76 if LOCAL_PYTHON_PATH not in sys.path:77 sys.path.append(LOCAL_PYTHON_PATH)78 79 72 80 73 # ------------------------------------------------------------------------------ … … 100 93 c = ControlFile(args.controlfile) 101 94 except IOError: 102 try: 103 c = ControlFile(LOCAL_PYTHON_PATH + args.controlfile) 104 except IOError: 105 print 'Could not read CONTROL file "' + args.controlfile + '"' 106 print 'Either it does not exist or its syntax is wrong.' 107 print 'Try "' + sys.argv[0].split('/')[-1] + \ 108 ' -h" to print usage information' 109 sys.exit(1) 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) 110 100 111 env_parameter = read_ecenv( c.ecmwfdatadir + 'python/ECMWF_ENV')101 env_parameter = read_ecenv(_config.PATH_ECMWF_ENV) 112 102 c.assign_args_to_control(args, env_parameter) 113 103 c.assign_envs_to_control(env_parameter) 114 c.check_conditions( )104 c.check_conditions(args.queue) 115 105 prepare_flexpart(args.ppid, c) 116 106 … … 170 160 start = start - datetime.timedelta(days=1) 171 161 172 print 'Prepare ' + start.strftime("%Y%m%d") + \173 "/to/" + end.strftime("%Y%m%d") 162 print('Prepare ' + start.strftime("%Y%m%d") + 163 "/to/" + end.strftime("%Y%m%d")) 174 164 175 165 # create output dir if necessary … … 182 172 # deaccumulate the flux data 183 173 flexpart = EcFlexpart(c, fluxes=True) 184 flexpart.write_namelist(c, 'fort.4')174 flexpart.write_namelist(c, _config.FILE_NAMELIST) 185 175 flexpart.deacc_fluxes(inputfiles, c) 186 176 … … 197 187 # otherwise delete temporary files 198 188 if int(c.debug) != 0: 199 print '\nTemporary files left intact'189 print('\nTemporary files left intact') 200 190 else: 201 191 clean_up(c)
Note: See TracChangeset
for help on using the changeset viewer.