Changeset 1108 for trunk/UTIL/PYTHON
- Timestamp:
- Nov 19, 2013, 3:32:54 PM (11 years ago)
- Location:
- trunk/UTIL/PYTHON/planetoplot_v2
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py
r1094 r1108 165 165 svy=1,\ 166 166 compute="mean",\ 167 kind3d="tyx",\ 167 168 verbose=False,\ 168 169 quiet=False,\ … … 223 224 self.svy = svy 224 225 self.compute = compute 226 self.kind3d = kind3d 225 227 self.verbose = verbose 226 228 self.quiet = quiet … … 290 292 self.sx = other.sx ; self.sy = other.sy 291 293 self.sz = other.sz ; self.st = other.st 294 self.compute = other.compute 295 self.kind3d = other.kind3d 292 296 self.verbose = other.verbose 293 297 self.noproj = other.noproj … … 628 632 # indicate the computation method 629 633 obj.compute = self.compute 634 # indicate the kind of 3D fields 635 obj.kind3d = self.kind3d 630 636 # open the files (the same file might be opened several times but this is cheap) 631 637 obj.openfile() … … 749 755 elif obj.field.ndim == 2: 750 756 obj.field = ppcompute.smooth2d(obj.field,window=window) 757 #obj.field = ppcompute.smooth2diter(obj.field,n=window) 751 758 752 759 ############################################################################################## … … 1315 1322 self.sx = 1 ; self.sy = 1 ; self.sz = 1 ; self.st = 1 1316 1323 self.missing = '!! missing value: I am not set, damned !!' 1324 self.kind3d = '!! kind3d: I am not set, damned !!' 1317 1325 1318 1326 # open a file. for now it is netcdf. TBD for other formats. … … 1356 1364 elif self.dim == 3: 1357 1365 if self.verbose: print "**** OK. 3D field. I assume this is time-varying lat-lon map." 1358 self.dim_x = shape[2] ; self.dim_y = shape[1] ; self.dim_z = 1 ; self.dim_t = shape[0] 1366 ## see below for comment 1367 if self.kind3d == "tyx": 1368 self.dim_x = shape[2] ; self.dim_y = shape[1] ; self.dim_z = 1 ; self.dim_t = shape[0] 1369 elif self.kind3d == "tzy": 1370 self.dim_x = 1 ; self.dim_y = shape[2] ; self.dim_z = shape[1] ; self.dim_t = shape[0] 1371 else: 1372 print "!! ERROR !! This kind of 3D field is not supported. Please send feedback." 1373 print self.kind3d 1374 exit() 1359 1375 elif self.dim == 4: 1360 1376 if self.verbose: print "**** OK. 4D field." … … 1703 1719 self.field = self.f.variables[self.var][self.index_y,self.index_x] 1704 1720 elif self.dim == 3: 1705 nt = self.index_t.size ; nz = 1 ; ny = self.index_y.size ; nx = self.index_x.size 1706 self.field = self.f.variables[self.var][self.index_t,self.index_y,self.index_x] 1721 ## DEFAULT tyx (time-varying 2D field) 1722 if self.kind3d == "tyx": 1723 nt = self.index_t.size ; nz = 1 ; ny = self.index_y.size ; nx = self.index_x.size 1724 self.field = self.f.variables[self.var][self.index_t,self.index_y,self.index_x] 1725 ## CASE tzy (e.g. time-varying zonal mean y-z field) 1726 elif self.kind3d == "tzy": 1727 nt = self.index_t.size ; nz = self.index_z.size ; ny = self.index_y.size ; nx = 1 1728 self.field = self.f.variables[self.var][self.index_t,self.index_z,self.index_y] 1729 else: 1730 print "!! ERROR !! This kind of 3D field is not supported. Please send feedback." ; exit() 1707 1731 # this is far faster than retrieving each term with a loop 1708 1732 elif self.dim == 4:
Note: See TracChangeset
for help on using the changeset viewer.