Changeset 2465 in lmdz_wrf
- Timestamp:
- Apr 24, 2019, 2:38:00 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r2447 r2465 299 299 varn= variable name 300 300 """ 301 fname = 'varinfile' 301 302 if not ncf.variables.has_key(varn): 302 303 print emsg 303 print ' file "' + filen + '" does not have ' + vmsg + ' variable "' + varn + '" !!' 304 print emsg 304 print ' file "'+filen+'" does not have '+vmsg+ ' variable "' + varn + '" !!' 305 305 ncf.close() 306 quit(-1) 306 Varns = list(ncf.variables.keys()) 307 Varns.sort() 308 print ' avaialble ones:', Varns 309 quit(-1) 307 310 308 311 return … … 31284 31287 #compress_data(values, '/home/lluis/PY/wrfout_d01_1995-01-01_00:00:00', 'T2,LU_INDEX') 31285 31288 31286 31287 31289 def CFfile_creation(values, ncfile, variables): 31288 31290 """ Operation to create a file folowing CF-conventions … … 31500 31502 #CFfile_creation(values, 'CFtest.nc', varsS) 31501 31503 31504 def CFfile_fixTime(values, ncfile, variable): 31505 """ Operation to fix a netCDF file with a time axis folowing CF-conventions, but 31506 with a wrong set-up 31507 values= [operations] 31508 [operations]: ';' list of names of operations to perform 31509 'setRefDate',[YYYYMMDDHHMMSS]: re-set the reference date to [YYYYMMDDHHMMSS] 31510 'setCalendar': re-set the calendar to gregorian or standard 31511 ncfile= name of the file to fix its time-axis 31512 variable= name of the variable time 31513 """ 31514 fname = 'CFfile_fixTime' 31515 31516 if values == 'h': 31517 print fname + '_____________________________________________________________' 31518 print CFfile_fixTime.__doc__ 31519 quit() 31520 31521 expectargs = '[operations]' 31522 31523 gen.check_arguments(fname,values,expectargs,':') 31524 31525 operations = values.split(':')[0] 31526 31527 onc = NetCDFFile(ncfile,'a') 31528 if not onc.variables.has_key(variable): 31529 31530 31531 otime = onc.variables[variable] 31532 31533 for op in operations: 31534 31535 31502 31536 31503 31537
Note: See TracChangeset
for help on using the changeset viewer.