Changeset 1890 in lmdz_wrf


Ignore:
Timestamp:
Apr 4, 2018, 5:24:51 PM (7 years ago)
Author:
lfita
Message:

Adding calculation of conform frequency in `itime'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r1889 r1890  
    2430024300    print 'diffdate_2nd-1st:', diffdate
    2430124301    print 'diff_seconds_2nd-1st:', totsecs
     24302    secfreq = totsecs
     24303
     24304    if np.mod(secfreq, 100 * 365 * 24 * 3600.) == 0.:
     24305        Sfreq = str(int(secfreq/(100 * 365 * 24 * 3600.))) + 'C'
     24306    elif np.mod(secfreq, 365 * 24 * 3600.) == 0.:
     24307        Sfreq = str(int(secfreq/(365 * 24 * 3600.))) + 'Y'
     24308    elif np.mod(secfreq, 7 * 24 * 3600.) == 0.:
     24309        Sfreq = str(int(secfreq/(7 * 24 * 3600.))) + 'W'
     24310    elif np.mod(secfreq, 24 * 3600.) == 0.:
     24311        Sfreq = str(int(secfreq/(24.*3600.))) + 'D'
     24312    elif np.mod(secfreq,3600.) == 0.:
     24313        Sfreq = str(int(secfreq/3600.)) + 'H'
     24314    elif np.mod(secfreq,60.) == 0.:
     24315        Sfreq = str(int(secfreq/60.)) + 'M'
     24316    else:
     24317        print '  ' + fname + ": data from file does not conform "+\
     24318          "any know time-units!!"
     24319        print '    frequency from file:', secfreq, ' seconds _______'
     24320        print '      century:', secfreq/(100 * 365 * 24 * 3600.)
     24321        print '      year (365d):', secfreq/(365 * 24 * 3600.)
     24322        print '      week:', secfreq/(7 * 24 * 3600.)
     24323        print '      day:', secfreq/(24 * 3600.)
     24324        print '      hour:', secfreq/(3600.)
     24325        print '      minute:', secfreq/(60.)
     24326        print '      second:', secfreq
     24327    print 'diff_conform:', Sfreq
    2430224328
    2430324329    for it in range(1,dimt-1):
Note: See TracChangeset for help on using the changeset viewer.