Changeset d727af2 in flex_extract.git for source/python/mods/tools.py


Ignore:
Timestamp:
Mar 10, 2019, 4:48:16 PM (5 years ago)
Author:
Anne Philipp <anne.philipp@…>
Branches:
master, ctbto, dev
Children:
90a1ca0
Parents:
79729d5
Message:

updated rrint processes (added missing rr for ensembles and wrote all precip fields into the output files with different steps to distingush)

File:
1 edited

Legend:

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

    r79729d5 rd727af2  
    6969except ImportError:
    7070    import builtins as exceptions
    71 from datetime import datetime
     71from datetime import datetime, timedelta
    7272from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
    7373
     
    869869
    870870    return
     871
     872
     873def generate_retrieval_period_boundary(c):
     874    '''Generates retrieval period boundary datetimes from CONTROL information.
     875
     876    Parameters
     877    ----------
     878    c : ControlFile
     879        Contains all the parameters of CONTROL file and
     880        command line.
     881
     882    Return
     883    ------
     884    start_period : datetime
     885        The first timestamp of the actual retrieval period disregarding
     886        the temporary times which were used for processing reasons.
     887
     888    end_period : datetime
     889        The last timestamp of the actual retrieval period disregarding
     890        the temporary times which were used for processing reasons.
     891    '''
     892    # generate start and end timestamp of the retrieval period
     893    start_period = datetime.strptime(c.start_date + c.time[0], '%Y%m%d%H')
     894    start_period = start_period + timedelta(hours=int(c.step[0]))
     895    end_period = datetime.strptime(c.end_date + c.time[-1], '%Y%m%d%H')
     896    end_period = end_period + timedelta(hours=int(c.step[-1]))
     897
     898
     899    return start_period, end_period
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG