- Timestamp:
- Jun 20, 2016, 8:54:53 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r913 r916 8964 8964 * [integer]: which value of the dimension 8965 8965 * -1: all along the dimension 8966 * -9: last value along the dimension 8966 8967 * [beg]:[end] slice from [beg] to [end] 8967 8968 NOTE: that dimension of the variables which not appear al values will be used … … 9126 9127 objnewnc.sync() 9127 9128 9129 # Statistics of the variable dimension along the dimensions operated 9130 basicoper = ['min', 'max', 'menan', 'mean2', 'sum'] 9131 9128 9132 # operating variable dimension 9129 9133 print ' ' + fname + ': Opering slice of variable dimension _______' … … 9221 9225 objnewnc.sync() 9222 9226 9227 # Statistics of the variable dimension along the dimensions operated 9228 for op in basicoper: 9229 if op != operkind: 9230 finalvarv, finalds = operdim(varvals,varsliceddims,dimsoper,op) 9231 if varinf.FillValue is not None: 9232 newvar = objnewnc.createVariable(vn+op, nctype(varinf.dtype),\ 9233 tuple(finalds), fillValue=varinf.FillValue) 9234 else: 9235 newvar = objnewnc.createVariable(vn+op, nctype(varinf.dtype),\ 9236 tuple(finalds)) 9237 newNvar = newNvar + 1 9238 newvar[:] = finalvarv[:] 9239 newattr = basicvardef(newvar, stdname + op, lname + ' '+ op + \ 9240 ' along ' + dimsoperS, uname) 9241 objnewnc.sync() 9242 9223 9243 # Including operation dimensions on the new slice for the variables dimension 9224 9244 # but, which value along the operated dimension should be taken? … … 9267 9287 attrv = ov.getncattr(attrn) 9268 9288 newattr = set_attribute(newvar, attrn, attrv) 9269 # LLUIS9270 9289 objnewnc.sync() 9271 9272 9290 9273 9291 # global attributes … … 13344 13362 slicedict[dimn] = [value] 13345 13363 [value] = -1, all the values 13364 [value] = -9, last values 13346 13365 [value] = int, a single value 13347 13366 [value] = [beg, end, frq], from a beginning to an end with a given frequency … … 13366 13385 if dictv == -1: 13367 13386 slicevals.append(slice(0,varshape[idim])) 13387 slicefinaldims.append(dim) 13388 elif dictv == -9: 13389 slicevals.append(varshape[idim]-1) 13368 13390 slicefinaldims.append(dim) 13369 13391 else:
Note: See TracChangeset
for help on using the changeset viewer.