Changeset 70fee58 in flex_extract.git for source/python/classes
- Timestamp:
- Oct 12, 2018, 1:17:12 PM (6 years ago)
- Branches:
- master, ctbto, dev
- Children:
- 785b882
- Parents:
- 5827ff6
- Location:
- source/python/classes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
source/python/classes/ControlFile.py
r0e576fc r70fee58 60 60 sys.path.append('../') 61 61 import _config 62 from mods.tools import my_error 62 from mods.tools import my_error, silent_remove 63 63 64 64 # ------------------------------------------------------------------------------ … … 188 188 189 189 try: 190 with open(os.path.join(_config.PATH_CONTROLFILES,191 self.controlfile)) as f:190 cfile = os.path.join(_config.PATH_CONTROLFILES, self.controlfile) 191 with open(cfile) as f: 192 192 fdata = f.read().split('\n') 193 193 except IOError: 194 print('Could not read CONTROL file "' + args.controlfile + '"')194 print('Could not read CONTROL file "' + cfile + '"') 195 195 print('Either it does not exist or its syntax is wrong.') 196 196 print('Try "' + sys.argv[0].split('/')[-1] + \ … … 450 450 self.mailops = [self.mailops] 451 451 452 if queue in ['ecgate', 'cca']and \452 if queue in _config.QUEUES_LIST and \ 453 453 not self.gateway or not self.destination or \ 454 454 not self.ecuid or not self.ecgid: … … 463 463 _config.FILE_MARS_REQUESTS) 464 464 if os.path.isfile(marsfile): 465 os.remove(marsfile)465 silent_remove(marsfile) 466 466 467 467 # check all logical variables for data type -
source/python/classes/EcFlexpart.py
raa275fc r70fee58 85 85 codes_get_values, codes_set_values, codes_set, 86 86 codes_write, codes_release, codes_new_from_index, 87 codes_index_release )87 codes_index_release, codes_index_get) 88 88 89 89 # software specific classes and modules from flex_extract … … 136 136 self.types = dict() 137 137 138 if c.maxstep > len(c.type): # Pure forecast mode 138 # Pure forecast mode 139 if c.maxstep > len(c.type) and 'AN' not in c.type: 139 140 c.type = [c.type[0]] 140 141 c.step = ['{:0>3}'.format(int(c.step[0]))] … … 168 169 btlist = [13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0] 169 170 170 if ((ty.upper() == 'AN' and 171 int(c.time[i]) % int(c.dtime) ==0) or 172 (ty.upper() != 'AN' and 173 int(c.step[i]) % int(c.dtime) == 0 and 174 int(c.step[i]) % int(c.dtime) == 0) ) and \ 171 if ((ty.upper() == 'AN' and (int(c.time[i]) % int(c.dtime)) == 0) or 172 (ty.upper() != 'AN' and (int(c.step[i]) % int(c.dtime)) == 0 and 173 (int(c.step[i]) % int(c.dtime) == 0)) ) and \ 175 174 (int(c.time[i]) in btlist or c.maxstep > 24): 176 175 … … 434 433 #index_vals.append(grib_index_get(iid, key)) 435 434 #print(index_vals[-1]) 436 key_vals = grib_index_get(iid, key)435 key_vals = codes_index_get(iid, key) 437 436 print(key_vals) 438 437 # have to sort the steps for disaggregation, … … 532 531 if isinstance(pv, str): 533 532 continue 534 retr_param_dict['type'] = '' +ftype533 retr_param_dict['type'] = ftype 535 534 retr_param_dict['time'] = self.types[ftype]['times'] 536 535 retr_param_dict['step'] = self.types[ftype]['steps'] … … 538 537 retr_param_dict['stream'] = self.stream 539 538 retr_param_dict['target'] = \ 540 self._mk_targetname(ftype, pk, 539 self._mk_targetname(ftype, 540 pk, 541 541 retr_param_dict['date'].split('/')[0]) 542 542 retr_param_dict['param'] = pv[0] … … 689 689 690 690 loader = TemplateLoader(_config.PATH_TEMPLATES, auto_reload=False) 691 compile_template = loader.load(_config.TEMPFILE_NAMELIST,691 namelist_template = loader.load(_config.TEMPFILE_NAMELIST, 692 692 cls=NewTextTemplate) 693 693 … … 701 701 maxb = int((area[0] - area[2]) / grid[0]) + 1 702 702 703 stream = compile_template.generate(703 stream = namelist_template.generate( 704 704 maxl = str(maxl), 705 705 maxb = str(maxb), … … 1216 1216 print(self.outputfilelist) 1217 1217 1218 if c.format.lower() == 'grib2': 1219 for ofile in self.outputfilelist: 1218 for ofile in self.outputfilelist: 1219 ofile = os.path.join(self.inputdir, ofile) 1220 1221 if c.format.lower() == 'grib2': 1220 1222 p = subprocess.check_call(['grib_set', '-s', 'edition=2, \ 1221 1223 productDefinitionTemplateNumber=8', … … 1223 1225 p = subprocess.check_call(['mv', ofile + '_2', ofile]) 1224 1226 1225 if c.ectrans and not c.ecapi: 1226 for ofile in self.outputfilelist: 1227 if c.ectrans and not c.ecapi: 1227 1228 p = subprocess.check_call(['ectrans', '-overwrite', '-gateway', 1228 1229 c.gateway, '-remote', c.destination, 1229 1230 '-source', ofile]) 1230 1231 1231 if c.ecstorage and not c.ecapi: 1232 for ofile in self.outputfilelist: 1232 if c.ecstorage and not c.ecapi: 1233 1233 p = subprocess.check_call(['ecp', '-o', ofile, 1234 1234 os.path.expandvars(c.ecfsdir)]) 1235 1235 1236 if c.outputdir != c.inputdir: 1237 for ofile in self.outputfilelist: 1236 if c.outputdir != c.inputdir: 1238 1237 p = subprocess.check_call(['mv', 1239 1238 os.path.join(c.inputdir, ofile), -
source/python/classes/MarsRetrieval.py
r0e576fc r70fee58 418 418 # open a file to store all requests to 419 419 with open(os.path.join(inputdir, 420 420 _config.FILE_MARS_REQUESTS), 'a') as f: 421 421 f.write(str(request_number) + ', ') 422 422 f.write(', '.join(str(attrs[key])
Note: See TracChangeset
for help on using the changeset viewer.