Changeset a676cf7 in flex_extract.git for Source/Python/Mods/checks.py
- Timestamp:
- Oct 30, 2022, 1:13:24 AM (18 months ago)
- Branches:
- dev
- Children:
- 7271b6f
- Parents:
- ea754d1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Source/Python/Mods/checks.py
r5606fc9 ra676cf7 93 93 else: 94 94 raise ValueError('GRID parameter contains two ' 95 'different values: %s' (grid))95 'different values: %s', grid) 96 96 # # determine grid format 97 97 # if float(grid) / 100. >= 0.5: … … 236 236 return levelist, level 237 237 238 239 238 def check_ppid(c, ppid): 240 239 '''Sets the current PPID. … … 262 261 return 263 262 264 265 263 def check_purefc(ftype): 266 264 '''Check for a pure forecast mode. … … 283 281 284 282 return 0 285 286 283 287 284 def check_step(step): … … 404 401 Valid values are hours (HH) from forecast base time. 405 402 ''' 406 if not len(ftype) == len(ftime) == len(steps):407 raise ValueError('ERROR: The number of field types, times and steps '408 'are not the same! Please check the settings in the '409 'CONTROL file!')410 411 403 # if pure forecast is selected and only one field type/time is set 412 404 # prepare a complete list of type/time/step combination upto maxstep 413 if len(ft ype) == 1 and purefc:405 if len(ftime) == 1 and purefc: 414 406 nftype = [] 415 407 nsteps = [] … … 421 413 return nftype, nftime, nsteps 422 414 415 if not len(ftype) == len(ftime) == len(steps): 416 raise ValueError('ERROR: The number of field types, times and steps ' 417 'are not the same! Please check the settings in the ' 418 'CONTROL file!') 423 419 return ftype, ftime, steps 424 420 … … 605 601 return maxstep 606 602 607 def check_basetime(basetime ):603 def check_basetime(basetime, time, purefc): 608 604 '''Check if basetime is set and contains one of the two 609 605 possible values (0, 12). … … 615 611 retrieved. 616 612 613 time : str 614 The time in hours of the field. 615 616 purefc : int 617 1 if pure forecasts are to be retrieved. 0 if there are 618 analysis fields in between. 619 617 620 Return 618 621 ------ … … 620 623 The time for a half day retrieval. The 12 hours upfront are to be 621 624 retrieved. 625 626 time : str or list of str 627 The time in hours of the field. 622 628 ''' 623 629 if basetime is not None: … … 626 632 raise ValueError('ERROR: Basetime has an invalid value ' 627 633 '-> {}'.format(str(basetime))) 628 return basetime 634 if purefc: 635 time = str(basetime) 636 return basetime, time 629 637 630 638 def check_request(request, marsfile): … … 707 715 return acctype 708 716 709 710 def check_acctime(acctime, marsclass, purefc, time): 717 def check_acctime(acctime, marsclass, purefc, time, basetime, oper): 711 718 '''Guarantees that the accumulation forecast times were set. 712 719 … … 725 732 Switch for definition of pure forecast mode or not. 726 733 734 basetime : int 735 The time for a half day retrieval. The 12 hours upfront are to be 736 retrieved. 737 738 oper : int 739 Switch to prepare the operational job script. Start date, end date and 740 basetime will be prepared with environment variables. 741 727 742 Return 728 743 ------ … … 730 745 The starting time for the accumulated forecasts. 731 746 ''' 747 748 if acctime and basetime and oper: 749 return basetime 732 750 733 751 if not acctime: … … 817 835 if '/' in addpar: 818 836 parlist = addpar.split('/') 819 parlist = [p for p in parlist if p is not'']837 parlist = [p for p in parlist if p != ''] 820 838 else: 821 839 parlist = [addpar] … … 824 842 825 843 return addpar 826 827 844 828 845 def check_job_chunk(job_chunk): … … 853 870 854 871 return job_chunk 855 856 872 857 873 def check_number(number):
Note: See TracChangeset
for help on using the changeset viewer.