Changeset 1432 in lmdz_wrf for trunk/tools/nc_var_tools.py
- Timestamp:
- Jan 20, 2017, 1:09:01 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r1430 r1432 17899 17899 ncf.sync() 17900 17900 17901 # CFing dimensions 17902 CFdims = {'time_counter': 'time', 'presnivs': 'pres'} 17903 for dimn in CFdims.keys(): 17904 if gen.searchInlist(ncdims,dimn): 17905 # Making sure CF dimension is not in the file 17906 if not gen.searchInlist(ncdims,CFdims[dimn]): 17907 newname = ncf.renameDimension(dimn,CFdims[dimn]) 17908 ncf.sync() 17909 17901 17910 # CFing variable 'time_centerd' 17902 17911 if gen.searchInlist(ncvars,'time'): … … 17906 17915 otime[:] = newtvals 17907 17916 timeattrs = otime.ncattrs() 17908 chgattrs = ['standard_name', 'long_name', 'units', 'time_origin']17917 chgattrs= ['standard_name','long_name','units', 'time_origin', 'cell_method'] 17909 17918 for chga in chgattrs: 17910 17919 if gen.searchInlist(timeattrs,chga): … … 17913 17922 newattr = set_attribute(otime, 'long_name', 'Time') 17914 17923 newattr = set_attribute(otime, 'units', CFtimeUnits) 17924 newattr = set_attribute(otime, 'cell_method', 'time mean') 17915 17925 else: 17916 17926 newvar = ncf.createVariable('time', 'f8', ('time')) … … 17919 17929 newattr = set_attribute(newvar, 'long_name', 'Time') 17920 17930 newattr = set_attribute(newvar, 'units', CFtimeUnits) 17921 ncf.sync() 17922 17923 # CFing dimensions 17924 CFdims = {'time_counter': 'time', 'presnivs': 'pres'} 17925 for dimn in CFdims.keys(): 17926 if gen.searchInlist(ncdims,dimn): 17927 # Making sure CF dimension is not in the file 17928 if not gen.searchInlist(ncdims,CFdims[dimn]): 17929 newname = ncf.renameDimension(dimn,CFdims[dimn]) 17931 newattr = set_attribute(otime, 'cell_method', 'time mean') 17930 17932 ncf.sync() 17931 17933
Note: See TracChangeset
for help on using the changeset viewer.