- Timestamp:
- Sep 19, 2015, 11:50:23 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing.py
r638 r639 321 321 322 322 if len(objdimx.shape) <= 2: 323 odimxv = objdimx[:]324 odimyv = objdimy[:]323 odimxv0 = objdimx[:] 324 odimyv0 = objdimy[:] 325 325 326 326 elif len(objdimx.shape) == 3: 327 odimxv = objdimx[0,:]328 odimyv = objdimy[0,:]327 odimxv0 = objdimx[0,:] 328 odimyv0 = objdimy[0,:] 329 329 else: 330 330 print errormsg … … 339 339 timelabel = timevals.split('|')[4].replace('!',' ') 340 340 341 # Dimensional values 342 dimscut = {} 343 for dv in dimvals: 344 print dv 345 dvn = dv.split('|')[0] 346 dvv = dv.split('|')[1] 347 if dvv.find('@') != -1: 348 dimscut[dvn] = slice(int(dvv.split('@')[0]),int(dvv.split('@')[1])) 349 else: 350 if dvv == -1: 351 dnL = len(objsf.dimensions[dvn]) 352 dimscut[dvn] = slice(0,dnL) 353 else: 354 dimscut[dvn] = slice(dvv,dvv) 355 356 if not dr.searchInlist(dimscut.keys(), vdimxn): 357 dnL = len(objsf.dimensions[vdimxn]) 358 dimscut[vdimxn] = slice(0,dnL) 359 if not dr.searchInlist(dimscut.keys(), vdimyn): 360 dnL = len(objsf.dimensions[vdimyn]) 361 dimscut[vdimyn] = slice(0,dnL) 362 341 363 if vdimxn == timename: 342 odimxv = objsf.variables[vdimxn][:] 364 # odimxv = objsf.variables[vdimxn][:] 365 odimxv = objsf.variables[vdimxn][tuple(dimscut[vdimxn])] 343 366 odimxu = timelabel 344 367 timeaxis = 'x' 345 odimyv = objsf.variables[vdimyn] 368 odimyv = objsf.variables[vdimyn][tuple(dimscut[vdimyn])] 346 369 odimyu = odimyv.getncattr('units') 347 370 timepos, timelabels = drw.CFtimes_plot(odimxv, timeunit, timekind, timefmt) 348 371 elif vdimyn == timename: 349 odimyv = objsf.variables[vdimyn][ :]372 odimyv = objsf.variables[vdimyn][tuple(dimscut[vdimyn])] 350 373 odimyu = timelabel 351 374 timeaxis = 'y' 352 odimxv = objsf.variables[vdimxn] 375 odimxv = objsf.variables[vdimxn][tuple(dimscut[vdimxn])] 353 376 odimxu = odimxv.getncattr('units') 354 377 timepos, timelabels = drw.CFtimes_plot(odimyv, timeunit, timekind, timefmt)
Note: See TracChangeset
for help on using the changeset viewer.