Changeset 353 in lmdz_wrf for trunk


Ignore:
Timestamp:
Mar 10, 2015, 1:08:16 PM (10 years ago)
Author:
lfita
Message:

Adding de-accumulated total precipitation 'pr'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/TS_ASCII_netCDF.py

    r352 r353  
    118118tsvaluesv = np.zeros( (dimt,Ntsvariables), dtype= np.float)
    119119
     120pracc = np.zeros((dimt), dtype=np.float)
     121
    120122itz = 0
    121123for it in range(dimt):
     
    125127        tsvaluesv[it,iv] = np.float(tsvals[itz][iv+5])
    126128
     129    pracc[it] = np.float(tsvals[it][16]) + np.float(tsvals[it][17])
    127130    itz = itz + 1
    128 # Surface variables
     131
     132# time
    129133newvar = objofile.createVariable('time','f8',('time'))
    130134newvar[:] = time_stepv
     
    139143    newattr = ncvar.basicvardef(newvar, tsvn[iv], tsvln[iv], tsvu[iv] )
    140144
     145# Extra vars
     146
     147# pr
     148varvals = np.zeros((dimt), dtype=np.float)
     149varvals[1:dimt] = pracc[1:dimt] - pracc[0:dimt-1]
     150
     151newvar = objofile.createVariable('pr', 'f4', ('time'))
     152newvar[:] = varvals
     153newattr = ncvar.basicvardef(newvar, 'pr', 'precipitation', 'mm' )
     154
    141155objofile.sync()
    142156objofile.close()
Note: See TracChangeset for help on using the changeset viewer.