Changeset 2683 in lmdz_wrf for trunk


Ignore:
Timestamp:
Jul 14, 2019, 8:50:54 AM (5 years ago)
Author:
lfita
Message:

Using `CFtimeU_inf' in 'datetimeStr_conversion'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/generic_tools.py

    r2677 r2683  
    10221022    if typeSi[0:6] == 'cfTime' and typeSi[0:9] != 'cfTimeCal':
    10231023        timeval = np.float(StringDT)
     1024        cftunits = typeSi.split(',')[1]
    10241025        tunits = typeSi.split(',')[1].split(' ')[0]
    1025         Srefdate = typeSi.split(',')[1].split(' ')[2]
    1026 
    1027 # Does reference date contain a time value [YYYY]-[MM]-[DD] [HH]:[MI]:[SS]
    1028 ##
    1029         yrref=Srefdate[0:4]
    1030         monref=Srefdate[5:7]
    1031         dayref=Srefdate[8:10]
    1032 
    1033         trefT = typeSi.split(',')[1].find(':')
    1034         if not trefT == -1:
    1035             if len(typeSi.split(',')[1].split(' ')) == 3:
    1036                 horref=Srefdate[11:13]
    1037                 minref=Srefdate[14:16]
    1038                 secref=Srefdate[17:19]
    1039             else:
    1040                 Sreftime = typeSi.split(',')[1].split(' ')[3]
    1041                 horref=Sreftime[0:2]
    1042                 minref=Sreftime[3:5]
    1043                 secref=Sreftime[6:8]               
    1044             refdate = datetimeStr_datetime( yrref + '-' + monref + '-' + dayref +    \
    1045               '_' + horref + ':' + minref + ':' + secref)
    1046         else:
    1047             refdate = datetimeStr_datetime( yrref + '-' + monref + '-' + dayref +    \
    1048               '_00:00:00')
     1026        timeinf = CFtimeU_inf(cftunits)
     1027
     1028        Srefdate = timeinf.refdate
     1029        refdate = timeinf.refdateDT
    10491030
    10501031        if tunits == 'weeks':
Note: See TracChangeset for help on using the changeset viewer.