Changeset d4696e0 in flex_extract.git for source/python/mods/checks.py
- Timestamp:
- Jan 18, 2019, 10:50:19 PM (5 years ago)
- Branches:
- master, ctbto, dev
- Children:
- 4c1d7de
- Parents:
- 6f951ca
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/python/mods/checks.py
r6f951ca rd4696e0 587 587 Parameters 588 588 ---------- 589 basetime : str589 basetime : int or str or None 590 590 The time for a half day retrieval. The 12 hours upfront are to be 591 591 retrieved. … … 593 593 Return 594 594 ------ 595 596 ''' 597 if basetime: 598 if int(basetime) != 0 and int(basetime) != 12: 595 basetime : int or None 596 The time for a half day retrieval. The 12 hours upfront are to be 597 retrieved. 598 ''' 599 if basetime is not None: 600 basetime = int(basetime) 601 if basetime != 0 and basetime != 12: 599 602 raise ValueError('ERROR: Basetime has an invalid value ' 600 603 '-> {}'.format(str(basetime))) 601 return 604 return basetime 602 605 603 606 def check_request(request, marsfile): … … 667 670 try: 668 671 if len(ftype) == 1 and ftype[0] != 'AN': 669 print(' Use same field type as for the non-flux fields.')672 print('... Use same field type as for the non-flux fields.') 670 673 acctype = ftype[0] 671 674 elif len(ftype) > 1 and ftype[1] != 'AN': 672 print(' Use old setting by using TYPE[1] for flux forecast!')675 print('... Use old setting by using TYPE[1] for flux forecast!') 673 676 acctype = ftype[1] 674 677 except: … … 681 684 682 685 683 def check_acctime(acctime, acctype, purefc):686 def check_acctime(acctime, marsclass, purefc): 684 687 '''Guarantees that the accumulation forecast times were set. 685 688 686 If it is not set, it is tried to set the value foresome of the689 If it is not set, it tries to set the value for some of the 687 690 most commonly used data sets. Otherwise it raises an error. 688 691 … … 692 695 The starting time from the accumulated forecasts. 693 696 694 acctype: str695 The field type for the accumulated forecast fields.697 marsclass : str 698 ECMWF data classification identifier. 696 699 697 700 purefc : int … … 703 706 The starting time from the accumulated forecasts. 704 707 ''' 708 705 709 if not acctime: 706 710 print('... Control parameter ACCTIME was not defined.') 707 711 print('... Value will be set depending on field type:\n ' 708 '\t\t EA=06/18\n\t\t EI/OD=00/12\n\t\t 709 if acctype.upper() == 'EA': # Era 5712 '\t\t EA=06/18\n\t\t EI/OD=00/12\n\t\t EP=18') 713 if marsclass.upper() == 'EA': # Era 5 710 714 acctime = '06/18' 711 elif acctype.upper() == 'EI': # Era-Interim715 elif marsclass.upper() == 'EI': # Era-Interim 712 716 acctime = '00/12' 713 elif acctype.upper() == 'EP': # CERA717 elif marsclass.upper() == 'EP': # CERA 714 718 acctime = '18' 715 elif acctype.upper() == 'OD' and not purefc: # On-demand operational719 elif marsclass.upper() == 'OD' and not purefc: # On-demand 716 720 acctime = '00/12' 717 721 else: … … 720 724 return acctime 721 725 722 def check_accmaxstep(accmaxstep, acctype, purefc, maxstep):726 def check_accmaxstep(accmaxstep, marsclass, purefc, maxstep): 723 727 '''Guarantees that the accumulation forecast step were set. 724 728 … … 728 732 The maximum forecast step for the accumulated forecast fields. 729 733 730 acctype: str731 The field type for the accumulated forecast fields.734 marsclass : str 735 ECMWF data classification identifier. 732 736 733 737 purefc : int … … 746 750 print('... Control parameter ACCMAXSTEP was not defined.') 747 751 print('... Value will be set depending on field type/time: ' 748 '\ t\t EA/EI/OD=12\n\t\tEP=24')749 if acctype.upper() in ['EA', 'EI', 'OD'] and not purefc:752 '\n\t\t EA/EI/OD=12\n\t\t EP=24') 753 if marsclass.upper() in ['EA', 'EI', 'OD'] and not purefc: 750 754 # Era 5, Era-Interim, On-demand operational 751 755 accmaxstep = '12' 752 elif acctype.upper() == 'EP': # CERA756 elif marsclass.upper() == 'EP': # CERA 753 757 accmaxstep = '18' 754 758 elif purefc and accmaxstep != maxstep:
Note: See TracChangeset
for help on using the changeset viewer.