Changeset 1430 in lmdz_wrf
- Timestamp:
- Jan 20, 2017, 12:53:55 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r1429 r1430 17900 17900 17901 17901 # CFing variable 'time_centerd' 17902 if gen.searchInlist(ncvars,'time _centered'):17902 if gen.searchInlist(ncvars,'time'): 17903 17903 print warnmsg 17904 print fname + ": renaming variable 'time_centerd' as 'time' !!" 17905 newname = ncf.renameVariable('time_centered','time') 17904 print fname + ": readjusting variable 'time' !!" 17905 otime = ncf.variables['time'] 17906 otime[:] = newtvals 17907 timeattrs = otime.ncattrs() 17908 chgattrs = ['standard_name', 'long_name', 'units', 'time_origin'] 17909 for chga in chgattrs: 17910 if gen.searchInlist(timeattrs,chga): 17911 otime.delncattr(chga) 17912 newattr = set_attribute(otime, 'standard_name', 'time') 17913 newattr = set_attribute(otime, 'long_name', 'Time') 17914 newattr = set_attribute(otime, 'units', CFtimeUnits) 17915 else: 17916 newvar = ncf.createVariable('time', 'f8', ('time')) 17917 newvar[:] = newtvals 17918 newattr = set_attribute(newvar, 'standard_name', 'time') 17919 newattr = set_attribute(newvar, 'long_name', 'Time') 17920 newattr = set_attribute(newvar, 'units', CFtimeUnits) 17906 17921 ncf.sync() 17907 17922
Note: See TracChangeset
for help on using the changeset viewer.