Changeset 2705 in lmdz_wrf for trunk/tools/generic_tools.py


Ignore:
Timestamp:
Sep 18, 2019, 4:54:14 PM (5 years ago)
Author:
lfita
Message:

Dealing with lowering time-units

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/generic_tools.py

    r2704 r2705  
    645645          00 UTC)
    646646        refdateDT = reference date as datetime object
    647         Tunits = origtunits
     647        Tunits = units of time (one of 'weeks', 'days', 'hours', 'minutes', 'seconds')
    648648        utoweeks = Factor to convert values from original temporal units to weeks
    649649        utodays = Factor to convert values from original temporal units to days
     
    744744            self.refdateDT = None
    745745
    746         self.Tunits = origtunits
     746        self.Tunits = origtunits.lower()
    747747
    748748
     
    1061410614    fname = 'coincident_CFtimes'
    1061510615
    10616     tunitA = tunitA.replace('_',' ')
    10617     tunitB = tunitB.replace('_',' ')
    10618 
    10619     if len(tunitA) == 4:
    10620         trefA = tunitA.split(' ')[2] + ' ' + tunitA.split(' ')[3]
    10621     else:
    10622         print warnmsg
    10623         print '  ' + fname + ": time-units without time '" + tunitA + "' !!"
    10624         print "    adding: '00:00:00"
    10625         trefA = tunitA.split(' ')[2] + ' 00:00:00'
    10626 
    10627     if len(tunitB) == 4:
    10628         trefB = tunitB.split(' ')[2] + ' ' + tunitB.split(' ')[3]
    10629     else:
    10630         print warnmsg
    10631         print '  ' + fname + ": time-units without time '" + tunitB + "' !!"
    10632         print "    adding: '00:00:00"
    10633         trefB = tunitB.split(' ')[2] + ' 00:00:00'
    10634     tuA = tunitA.split(' ')[0]
    10635     tuB = tunitB.split(' ')[0]
     10616    tinfA = CFtimeU_inf(tunitA)
     10617    tinfB = CFtimeU_inf(tunitB)
     10618
     10619    trefA = tinfA.refdate
     10620    trefB = tinfB.refdate
     10621
     10622    tuA = tinfA.Tunits
     10623    tuB = tinfB.Tunits
    1063610624
    1063710625#    if tuB == 'months':
Note: See TracChangeset for help on using the changeset viewer.