Changeset 2137 in lmdz_wrf


Ignore:
Timestamp:
Sep 13, 2018, 12:00:30 AM (6 years ago)
Author:
lfita
Message:

Fixing netcdf_fold_concatenation_HMT by `WRFtime'?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r2109 r2137  
    1153811538        print infmsg
    1153911539        print '    ' + fname + ": creation of variable 'time' from WRF 'Times' !!"
    11540         odimvar = ncobjs[0].variables['Times']
    11541         timewrfv = odimvar[:]
    11542         tvals, urefvals = compute_WRFtime(timewrfv, refdate='19491201000000', tunitsval='minutes')
     11540        tvals = []
     11541        for ifile in range(Nfiles):
     11542            odimvar = ncobjs[ifile].variables['Times']
     11543            timewrfv = odimvar[:]
     11544            tvals0, urefvals = compute_WRFtime(timewrfv, refdate='19491201000000',   \
     11545              tunitsval='minutes')
     11546            tvals = tvals + list(tvals0)
     11547        tvals = np.array(tvals)
    1154311548        dimtwrf = len(tvals)
    1154411549        if not gen.searchInlist(newnc.dimensions,'time'):
    1154511550            newnc.createDimension('time',None)
    1154611551        newvar = newnc.createVariable('time', 'f8', 'time')
     11552        newvar[:] = np.zeros((totcondim), dtype=np.float64)
    1154711553        basicvardef(newvar, 'time', 'Time', urefvals)
    1154811554        newvar.setncattr('axis', 'T')
     
    1160111607            timewrfvf = odimvarf[:]
    1160211608            tvalsf, utimef = compute_WRFtime(timewrfvf, refdate='19491201000000', tunitsval='minutes')
    11603             ldimfile = tvals.shape[0]
     11609            ldimfile = tvalsf.shape[0]
    1160411610            dimn = 'time'
    1160511611            condimn = 'time'
    11606             if dimn == condim:
     11612            if dimn == condim or (condim == 'Time' and vardimname == 'WRFtime'):
    1160711613                slicevartot.append(slice(begslicetot,begslicetot+ldimfile))
    1160811614                begslicetot = begslicetot + ldimfile
Note: See TracChangeset for help on using the changeset viewer.