Changeset 944 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Jun 24, 2016, 11:27:27 AM (8 years ago)
Author:
lfita
Message:

Adding cyclong `refm' in 'CFmonthU_daysU'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/generic_tools.py

    r942 r944  
    79627962    newdatev = np.zeros((len(datev)), dtype=np.float)
    79637963    for itv in range(len(datev)):
    7964         if mm + datev[itv] - refm > 12:
    7965             yr = yr + 1
     7964        while mm + datev[itv] - refm > 12.:
     7965            yr = int(yr + 1)
    79667966            refm = refm + 12
    79677967
    7968         print itv, datev[itv], yr, refm, mm + datev[itv] - refm
    7969         idate = dt.datetime(yr, mm + datev[itv] - refm, dd, hh, mi, ss)
     7968        newmm = mm + datev[itv] - refm
     7969        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)
    79707976       
    79717977        diffT = idate - refT
     
    79777983    return newdatev, newtunits
    79787984
    7979 print CFmonthU_daysU([1,2,3,4,5,6,17,18,], 'months since 1979-12-01 00:00:00')
    7980 
    79817985#quit()
    79827986
Note: See TracChangeset for help on using the changeset viewer.