Changeset d4696e0 in flex_extract.git for source/python/mods/checks.py


Ignore:
Timestamp:
Jan 18, 2019, 10:50:19 PM (5 years ago)
Author:
Anne Philipp <anne.philipp@…>
Branches:
master, ctbto, dev
Children:
4c1d7de
Parents:
6f951ca
Message:

bugfix retrievement with basetime parameter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/python/mods/checks.py

    r6f951ca rd4696e0  
    587587    Parameters
    588588    ----------
    589     basetime : str
     589    basetime : int or str or None
    590590        The time for a half day retrieval. The 12 hours upfront are to be
    591591        retrieved.
     
    593593    Return
    594594    ------
    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:
    599602            raise ValueError('ERROR: Basetime has an invalid value '
    600603                             '-> {}'.format(str(basetime)))
    601     return
     604    return basetime
    602605
    603606def check_request(request, marsfile):
     
    667670        try:
    668671            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.')
    670673                acctype = ftype[0]
    671674            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!')
    673676                acctype = ftype[1]
    674677        except:
     
    681684
    682685
    683 def check_acctime(acctime, acctype, purefc):
     686def check_acctime(acctime, marsclass, purefc):
    684687    '''Guarantees that the accumulation forecast times were set.
    685688
    686     If it is not set, it is tried to set the value fore some of the
     689    If it is not set, it tries to set the value for some of the
    687690    most commonly used data sets. Otherwise it raises an error.
    688691
     
    692695        The starting time from the accumulated forecasts.
    693696
    694     acctype : str
    695         The field type for the accumulated forecast fields.
     697    marsclass : str
     698        ECMWF data classification identifier.
    696699
    697700    purefc : int
     
    703706        The starting time from the accumulated forecasts.
    704707    '''
     708
    705709    if not acctime:
    706710        print('... Control parameter ACCTIME was not defined.')
    707711        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  EP=18')
    709         if acctype.upper() == 'EA': # Era 5
     712              '\t\t EA=06/18\n\t\t EI/OD=00/12\n\t\t EP=18')
     713        if marsclass.upper() == 'EA': # Era 5
    710714            acctime = '06/18'
    711         elif acctype.upper() == 'EI': # Era-Interim
     715        elif marsclass.upper() == 'EI': # Era-Interim
    712716            acctime = '00/12'
    713         elif acctype.upper() == 'EP': # CERA
     717        elif marsclass.upper() == 'EP': # CERA
    714718            acctime = '18'
    715         elif acctype.upper() == 'OD' and not purefc: # On-demand operational
     719        elif marsclass.upper() == 'OD' and not purefc: # On-demand
    716720            acctime = '00/12'
    717721        else:
     
    720724    return acctime
    721725
    722 def check_accmaxstep(accmaxstep, acctype, purefc, maxstep):
     726def check_accmaxstep(accmaxstep, marsclass, purefc, maxstep):
    723727    '''Guarantees that the accumulation forecast step were set.
    724728
     
    728732        The maximum forecast step for the accumulated forecast fields.
    729733
    730     acctype : str
    731         The field type for the accumulated forecast fields.
     734    marsclass : str
     735        ECMWF data classification identifier.
    732736
    733737    purefc : int
     
    746750        print('... Control parameter ACCMAXSTEP was not defined.')
    747751        print('... Value will be set depending on field type/time: '
    748               '\t\t EA/EI/OD=12\n\t\t EP=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:
    750754            # Era 5, Era-Interim, On-demand operational
    751755            accmaxstep = '12'
    752         elif acctype.upper() == 'EP': # CERA
     756        elif marsclass.upper() == 'EP': # CERA
    753757            accmaxstep = '18'
    754758        elif purefc and accmaxstep != maxstep:
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG