Changeset 3f36e42 in flex_extract.git for source/python/classes/ControlFile.py
- Timestamp:
- Dec 4, 2018, 9:46:22 PM (5 years ago)
- Branches:
- master, ctbto, dev
- Children:
- fdda1b9
- Parents:
- 97f4f4c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/python/classes/ControlFile.py
r97f4f4c r3f36e42 61 61 import _config 62 62 from mods.tools import my_error, silent_remove 63 from mods.checks import check_grid _area63 from mods.checks import check_grid, check_area, check_levels 64 64 65 65 # ------------------------------------------------------------------------------ … … 345 345 sys.exit(1) 346 346 347 # assure consistency of levelist and level 348 if not self.levelist and not self.level: 349 print('Warning: neither levelist nor level \ 350 specified in CONTROL file') 351 sys.exit(1) 352 elif not self.levelist and self.level: 353 self.levelist = '1/to/' + self.level 354 elif (self.levelist and not self.level) or \ 355 (self.levelist[-1] != self.level[-1]): 356 self.level = self.levelist.split('/')[-1] 357 else: 358 pass 359 360 # check if max level is a valid level 361 if int(self.level) not in _config.MAX_LEVEL_LIST: 362 print('ERROR: ') 363 print('LEVEL must be the maximum level of a specified ' 364 'level list from ECMWF, e.g.') 365 print(_config.MAX_LEVEL_LIST) 366 print('Check parameter "LEVEL" or the max level of "LEVELIST"!') 367 sys.exit(1) 347 self.levelist, self.level = check_levels(self.levelist, self.level) 348 349 # # assure consistency of levelist and level 350 # if not self.levelist and not self.level: 351 # print('Warning: neither levelist nor level \ 352 # specified in CONTROL file') 353 # sys.exit(1) 354 # elif not self.levelist and self.level: 355 # self.levelist = '1/to/' + self.level 356 # elif (self.levelist and not self.level) or \ 357 # (self.levelist[-1] != self.level[-1]): 358 # self.level = self.levelist.split('/')[-1] 359 # else: 360 # pass 361 362 # # check if max level is a valid level 363 # if int(self.level) not in _config.MAX_LEVEL_LIST: 364 # print('ERROR: ') 365 # print('LEVEL must be the maximum level of a specified ' 366 # 'level list from ECMWF, e.g.') 367 # print(_config.MAX_LEVEL_LIST) 368 # print('Check parameter "LEVEL" or the max level of "LEVELIST"!') 369 # sys.exit(1) 368 370 369 371 # prepare step list if "/" signs are found … … 477 479 478 480 479 self.grid, self.area = check_grid_area(self.grid, self.area, 480 self.upper, self.lower, 481 self.left, self.right) 482 483 484 485 # convert grid and area components to correct format and input 486 #if 'N' in self.grid: # Gaussian output grid 487 # self.area = 'G' 488 # else: 489 # if '/' in self.grid: 490 # gridx, gridy = self.grid.split('/') 491 # if gridx == gridy: 492 # self.grid = gridx 493 494 495 # # check on grid format 496 # if float(self.grid) / 100. >= 0.5: 497 # # grid is defined in 1/1000 degrees; old format 498 # self.grid = '{}/{}'.format(float(self.grid) / 1000., 499 # float(self.grid) / 1000.) 500 # self.area = '{}/{}/{}/{}'.format(float(self.upper) / 1000., 501 # float(self.left) / 1000., 502 # float(self.lower) / 1000., 503 # float(self.right) / 1000.) 504 # elif float(self.grid) / 100. < 0.5: 505 # # grid is defined in normal degree; new format 506 # self.grid = '{}/{}'.format(float(self.grid), float(self.grid)) 507 # self.area = '{}/{}/{}/{}'.format(float(self.upper), 508 # float(self.left), 509 # float(self.lower), 510 # float(self.right)) 481 self.grid = check_grid(self.grid) 482 483 self.area = check_area(self.grid, self.area, self.upper, self.lower, 484 self.left, self.right) 485 511 486 512 487 return … … 555 530 return sorted(l) 556 531 557 def check_ppid(self, ppid):558 '''Sets the current PPID.559 560 Parameters561 ----------562 ppid : :obj:`int` or :obj:`None`563 Contains the ppid number provided by the command line parameter564 of is None otherwise.565 566 Return567 ------568 569 '''570 571 if not ppid:572 self.ppid = str(os.getppid())573 else:574 self.ppid = ppid575 576 return
Note: See TracChangeset
for help on using the changeset viewer.