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


Ignore:
Timestamp:
Sep 12, 2016, 5:16:07 PM (8 years ago)
Author:
lfita
Message:

Addding python dependency on the existence of dt.deltatime.total_seconds()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/generic_tools.py

    r1101 r1102  
    599599# Seconds between dates
    600600    DT = edateT - idateT
    601     Nsecs = DT.total_seconds()
     601    # Python version depending
     602    if searchInlist(dir(DT), 'total_seconds'):
     603        Nsecs = DT.total_seconds()
     604    else:
     605        Nsecs = DT.days*24*3600. + DT.seconds
    602606
    603607    oinf = oinf + ',' + str(Nsecs)
     
    10371041# Seconds between dates
    10381042    DT = edateT - idateT
    1039     Nsecs = DT.total_seconds()
     1043    # Python version depending
     1044    if searchInlist(dir(DT), 'total_seconds'):
     1045        Nsecs = DT.total_seconds()
     1046    else:
     1047        Nsecs = DT.days*24*3600. + DT.seconds
    10401048
    10411049    oinf = oinf + ',' + str(Nsecs)
Note: See TracChangeset for help on using the changeset viewer.