Changeset 949 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Jun 24, 2016, 5:13:03 PM (8 years ago)
Author:
lfita
Message:

Fixing fractional months for 'CFUmonhts_Udays'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/generic_tools.py

    r946 r949  
    79687968        newmm = mm + datev[itv] - refm
    79697969        if newmm/int(newmm) - 1. != 0.:
    7970             print errormsg
    7971             print '  ' + fname + ': fractional months values', newmm, 'not ready!!'
    7972             quit(-1)
    7973         newmm = np.int(newmm)
    7974 
    7975         idate = dt.datetime(yr, newmm, dd, hh, mi, ss)
     7970            print warnmsg
     7971            print '  ' + fname + ': fractional months values', newmm, '!!'
     7972            mmdec = newmm - int(newmm)*1.
     7973            newmm = np.int(newmm)
     7974            daysnextmon = days_month(yr,newmm+1)
     7975            newdd = daysnextmon*mmdec
     7976            dddec = newdd - int(newdd)*1.
     7977            newdd = int(newdd)
     7978            newhh = dddec*24.
     7979            hhdec = newhh - int(newhh)*1.
     7980            newhh = int(newhh)
     7981            newmi = hhdec*60.
     7982            midec = newmi - int(newmi)*1.
     7983            newmi = int(newmi)
     7984            newss = midec*60.
     7985            ssdec = newss - int(newss)*1.
     7986            newss = int(newss)
     7987            if ssdec != 0.: print '    residual seconds after adjustmen:', ssdec
     7988        else:
     7989            newmm = np.int(newmm)
     7990            newdd = np.int(newdd)
     7991            newhh = np.int(newhh)
     7992            newmi = np.int(newmi)
     7993            newss = np.int(newss)
     7994
     7995        idate = dt.datetime(yr, newmm, newdd, newhh, newmi, newss)
    79767996       
    79777997        diffT = idate - refT
Note: See TracChangeset for help on using the changeset viewer.