Changeset 2196 in lmdz_wrf
- Timestamp:
- Oct 18, 2018, 7:17:53 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r2195 r2196 26338 26338 26339 26339 newvard = ['slice_'+varn2,'slice_'+varn1] 26340 newvarN = onewnc.createVariable(varn+'Nsliced', 'f', tuple(newvard), \ 26341 fill_value=gen.fillValueF) 26342 basicvardef(newvarN, varn+'Nsliced','number of values in slice of ' + varn + \ 26343 'sliced by '+varn1+' & '+varn2, vu) 26344 add_varattrs(onc, onewnc, [varn], [varn+'Nsliced']) 26345 26340 26346 newvarn = onewnc.createVariable(varn+'minsliced', 'f', tuple(newvard), \ 26341 26347 fill_value=gen.fillValueF) … … 26362 26368 add_varattrs(onc, onewnc, [varn], [varn+'stdsliced']) 26363 26369 26370 newvarN[:] = np.sum(~manewvar.mask, axis=tuple(np.arange(vrank) + 2)) 26364 26371 newvarn[:] = np.min(manewvar, axis=tuple(np.arange(vrank) + 2)) 26365 26372 newvarx[:] = np.max(manewvar, axis=tuple(np.arange(vrank) + 2)) … … 26394 26401 #compute_slice2Dstats(values, '/home/lluis/PY/wrfout_d01_1995-01-01_00:00:00', 'T2,Q2') 26395 26402 26403 def same_delat_sign(values, ncfile, variable): 26404 """ Function to determine if a given series of 1D values share the same sign of 26405 increase/decrease between consecutive values 26406 values= [slicedims], values to the dimensions to perform a slice of variables 26407 [slicedims]: '|' separated list of [dimname]:[valdim] 26408 [valdim]: 26409 * [integer]: which value of the dimension 26410 * -1: all along the dimension 26411 * -9: last value of the dimension 26412 * [beg]@[end]@[freq] slice from [beg] to [end] every [freq] 26413 * NOTE, no dim name all the dimension size 26414 ncfile= netCDF file to use 26415 variable: ',' list of variables ('all' for all variables) 26416 """ 26417 fname = 'same_delat_sign' 26418 26419 if values == 'h': 26420 print fname + '_____________________________________________________________' 26421 print same_delat_sign.__doc__ 26422 quit() 26423 26424 expectargs = 'varn1,minvar1,maxvar1,slcevar1,varn2,minvar2,maxvar2,slcevar2,' + \ 26425 'dimvars' 26426 gen.check_arguments(fname, values, expectargs, ',') 26427 26428 varn1 = values.split(',')[0] 26429 minvar1 = np.float(values.split(',')[1]) 26430 26431 return 26432 26396 26433 #quit() 26397 26434
Note: See TracChangeset
for help on using the changeset viewer.