Changeset 331 in lmdz_wrf for trunk/tools/nc_var_tools.py


Ignore:
Timestamp:
Feb 27, 2015, 2:33:46 PM (10 years ago)
Author:
lfita
Message:

Changing reference date on 'WRF_CFtime_creation'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r329 r331  
    1217912179
    1218012180    if wrfnc.variables.has_key(varn):
    12181         print errormsg
     12181        print warnmsg
    1218212182        print '  ' + fname + ": WRF file '" + ncfile + "' already has variable '" +  \
    1218312183          varn + "' !!!"
    12184         quit(-1)
     12184        print '    overwritting values'
    1218512185
    1218612186    timeobj = wrfnc.variables['Times']
     
    1219412194    secref=refdate[12:14]
    1219512195
    12196     refdateS = yrref + '/' + monref + '/' + dayref + '_' + horref + ':' + minref +   \
     12196    refdateS = yrref + '-' + monref + '-' + dayref + ' ' + horref + ':' + minref +   \
    1219712197      ':' + secref
    1219812198
     
    1220612206    tunits = tunitsval + ' since ' + refdateS
    1220712207
    12208     newvar = wrfnc.createVariable('time','f4',('Time'))
     12208    if wrfnc.variables.has_key(varn):
     12209        newvar = wrfnc.variables[varn]
     12210    else:
     12211        newvar = wrfnc.createVariable('time','f4',('Time'))
     12212
    1220912213    newattr = basicvardef(newvar, 'time','time',tunits)
    1221012214    newvar[:] = cftimes
Note: See TracChangeset for help on using the changeset viewer.