Changeset 8209738 in flex_extract.git for Source/Python/Mods/checks.py


Ignore:
Timestamp:
May 7, 2020, 3:32:03 PM (4 years ago)
Author:
anphi <anne.philipp@…>
Branches:
master, ctbto, dev
Children:
b936fd3
Parents:
05e9362
Message:

language corrections in comment sections and print commands

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Source/Python/Mods/checks.py

    r50f9ca6 r8209738  
    119119    '''Defines the correct area string.
    120120
    121     Checks on the format of the four area components. Wether it is of
    122     the order of 1000 or 1. Also checks wether area was already set by command
    123     line, then the four components are overwritten.
     121    Checks the format of the four area components wether it is on
     122    the order of 1000 or 1.
     123    Also checks wether area was already set on command line,
     124    then the four components are overwritten.
    124125    Convert to correct format of the order of magnitude "1" and sets the
    125126    area parameter (North/West/South/East).
     
    135136
    136137    upper : str
    137         The northern most latitude.
     138        The northernmost latitude.
    138139
    139140    lower : str
    140         The souther most latitude.
     141        The southernmost latitude.
    141142
    142143    left : str
    143         The western most longitude.
     144        The westernmost longitude.
    144145
    145146    right : str
    146         The eastern most longiude.
     147        The easternmost longitude.
    147148
    148149    Return
    149150    ------
    150151    grid : str
    151         Contains grid in format Lat/lon. E.g. 0.1/0.1
     152        Contains grid in format lat/lon. E.g. 0.1/0.1
    152153    '''
    153154    if 'N' in grid:  # Gaussian output grid
     
    180181                                    float(right))
    181182    else:
    182         raise ValueError('The area components have different '
     183        raise ValueError('Area components have inconsisten or unrecognised '
    183184                         'formats (upper, lower, left, right): '
    184185                         '{}/{}/{}/{}'.format(str(upper), str(lower),
     
    209210    level : str
    210211        Specifies the maximum level. It has to be one of the
    211         available maximum level number as contained in the variable
    212         MAX_LEVEL_LIST in "_config". E.g. [16, 19, 31, 40, 50, 60, 62, 91, 137]
     212        available maximum level numbers as contained in the variable
     213        MAX_LEVEL_LIST in "_config": [16, 19, 31, 40, 50, 60, 62, 91, 137]
    213214
    214215    '''
     
    346347    for i, val in enumerate(ftype):
    347348        if ftype[i] == 'AN' and int(steps[i]) != 0:
    348             print('Analysis retrievals must have STEP = 0 (now set to 0)')
     349            print('For analysis data, STEP = 0 is needed. Setting to 0 now.)')
    349350            ftype[i] = 0
    350351
     
    386387    maxstep : int
    387388        The maximum forecast time step in hours from the forecast base time.
    388         This is the maximum step for non flux (accumulated) forecast data.
     389        This is the maximum step for non-flux (not accumulated) forecast data.
    389390
    390391    purefc : int
     
    405406    if not len(ftype) == len(ftime) == len(steps):
    406407        raise ValueError('ERROR: The number of field types, times and steps '
    407                          'are not the same! Please check the setting in the '
     408                         'are not the same! Please check the settings in the '
    408409                         'CONTROL file!')
    409410
     
    423424
    424425def check_mail(mail):
    425     '''Check the string of mail addresses, seperate them and convert to a list.
     426    '''Check the string of mail addresses, separate them and convert to list.
    426427
    427428    Parameters
     
    529530
    530531def check_dates(start, end):
    531     '''Checks if there is at least a start date for a one day retrieval.
     532    '''Checks if there is at least a start date for a one-day retrieval.
    532533
    533534    Checks if end date lies after start date and end date is set.
     
    628629
    629630def check_request(request, marsfile):
    630     '''Check if there is an old mars request file and remove it.
     631    '''Check if there is an old MARS request file; if so, remove it.
    631632
    632633    Parameters
     
    651652
    652653def check_public(public, dataset):
    653     '''Check wether the dataset parameter is set for a
    654     public data set retrieval.
     654    '''Check wether the dataset parameter is set to a
     655    public data set.
    655656
    656657    Parameters
     
    667668    '''
    668669    if public and not dataset:
    669         raise ValueError('ERROR: If public mars data wants to be retrieved, '
    670                          'the "dataset"-parameter has to be set too!')
     670        raise ValueError('ERROR: If public MARS data are to be retrieved, '
     671                         'the "dataset"-parameter has to be set, too!')
    671672    return
    672673
     
    674675    '''Guarantees that the accumulation field type is set.
    675676
    676     If not set, it is derivated as in the old method (TYPE[1]).
     677    If not set, it is derived with the old method (TYPE[1]).
    677678
    678679    Parameters
     
    710711    '''Guarantees that the accumulation forecast times were set.
    711712
    712     If it is not set, it tries to set the value for some of the
    713     most commonly used data sets. Otherwise it raises an error.
     713    If not set, setting the value to some of the most commonly used data sets
     714    is attempted. Otherwise, an eror is raised.
    714715
    715716    Parameters
    716717    ----------
    717718    acctime : str
    718         The starting time from the accumulated forecasts.
     719        The starting time for the accumulated forecasts.
    719720
    720721    marsclass : str
     
    727728    ------
    728729    acctime : str
    729         The starting time from the accumulated forecasts.
     730        The starting time for the accumulated forecasts.
    730731    '''
    731732
    732733    if not acctime:
    733         print('... Control parameter ACCTIME was not defined.')
     734        print('... Control parameter ACCTIME was not set.')
    734735        print('... Value will be set depending on field type:\n '
    735736              '\t\t EA=06/18\n\t\t EI/OD=00/12\n\t\t EP=18')
     
    745746            acctime = time[0]
    746747        else:
    747             raise ValueError('ERROR: Accumulation forecast time can not '
    748                              'automatically be derived!')
     748            raise ValueError('ERROR: Accumulation forecast time can not be'
     749                             'derived automatically!')
    749750    return acctime
    750751
    751752def check_accmaxstep(accmaxstep, marsclass, purefc, maxstep):
    752     '''Guarantees that the accumulation forecast step were set.
     753    '''Guarantees that the accumulation forecast step was set.
    753754
    754755    Parameters
     
    765766    maxstep : str
    766767        The maximum forecast time step in hours from the forecast base time.
    767         This is the maximum step for non flux (accumulated) forecast data.
     768        This is the maximum step for non-flux (accumulated) forecast data.
    768769
    769770    Return
     
    773774    '''
    774775    if not accmaxstep:
    775         print('... Control parameter ACCMAXSTEP was not defined.')
     776        print('... Control parameter ACCMAXSTEP was not set.')
    776777        print('... Value will be set depending on field type/time: '
    777778              '\n\t\t EA/EI/OD=12\n\t\t EP=24')
     
    785786            print('... For pure forecast mode, the accumulated forecast must '
    786787                  'have the same maxstep as the normal forecast fields!\n'
    787                   '\t\t Accmaxstep was set to maxstep!')
     788                  '\t\t ACCMAXSTEP was set to MAXSTEP!')
    788789        else:
    789             raise ValueError('ERROR: Accumulation forecast step can not '
    790                              'automatically be derived!')
     790            raise ValueError('ERROR: Accumulation forecast step can not be'
     791                             'derived automatically!')
    791792    else:
    792793        if purefc and int(accmaxstep) != int(maxstep):
     
    794795            print('... For pure forecast mode, the accumulated forecast must '
    795796                  'have the same maxstep as the normal forecast fields!\n'
    796                   '\t\t Accmaxstep was set to maxstep!')
     797                  '\t\t ACCMAXSTEP was set to MAXSTEP!')
    797798    return accmaxstep
    798799
    799800def check_addpar(addpar):
    800801    '''Check that addpar has correct format of additional parameters in
    801     a single string, so that it can be easily appended to the hard coded
    802     parameters that are retrieved in any case.
     802    a single string, so that it can be easily appended to the hard-coded
     803    parameters retrieved in any case.
    803804
    804805    Parameters
     
    826827
    827828def check_job_chunk(job_chunk):
    828     '''Checks that if job chunk is set, the number is positive and non zero.
     829    '''Checks that if job chunk is set, the number is positive and nonzero.
    829830
    830831    Parameters
     
    844845
    845846    if job_chunk < 0:
    846         raise ValueError('ERROR: The number of job chunk is negative!\n'
     847        raise ValueError('ERROR: The number of job chunks is negative!\n'
    847848                         'It has to be a positive number!')
    848849    elif job_chunk == 0:
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG