Changeset 926 for trunk/UTIL/PYTHON/planetoplot_v2
- Timestamp:
- Apr 3, 2013, 12:17:16 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py
r925 r926 1248 1248 self.method_y = "fixed" 1249 1249 if self.verbose: print "**** OK. no y dimension." 1250 ## CASE 0 above, this is just for continuity. 1250 ## CASE 0 above, this is just for continuity for free. 1251 ## ... for comp we have to select bounds. 1252 ## ... TBD: take the bool array strategy for what follows! 1251 1253 if self.method_x in ["free","comp"] and self.method_y in ["free","comp"]: 1254 ### ref1_dirty_hack 1255 ### ... for the moment this is a hack. but actually this is more powerful. 1256 if self.method_x == "comp": 1257 yeah = (self.field_x >= dalistx[indx][0])*(self.field_x <= dalistx[indx][1]) 1258 self.index_x = yeah[0,:] 1259 if self.method_y == "comp": 1260 yeah = (self.field_y >= dalisty[indy][0]) * (self.field_y <= dalisty[indy][1]) 1261 self.index_y = yeah[:,0] 1252 1262 self.index_x2d = self.index_x 1253 1263 self.index_y2d = self.index_y … … 1341 1351 # NB: ... always 4D array but possibly with "size 1" dimensions 1342 1352 # ... if one dimension is missing because 1D 2D or 3D requests, make it appear again 1343 self.field = np.reshape(self.field,(nt,nz,ny,nx)) 1353 try: 1354 self.field = np.reshape(self.field,(nt,nz,ny,nx)) 1355 except: 1356 # dirty hack (AS) ref1_dirty_hack 1357 # waiting for more fundamental modifications. case when self.index_y is a bool array. 1358 # ... be careful if no point... 1359 nx = np.sum(self.index_x) ## gives the size of the True part! 1360 ny = np.sum(self.index_y) 1361 self.field = np.reshape(self.field,(nt,nz,ny,nx)) 1344 1362 if self.verbose: print "**** OK. I got %7.1e values. This took me %6.4f seconds" % (nx*ny*nz*nt,timelib.time() - time0) 1345 1363 if self.verbose: print "**** OK. I got var "+self.var+" with shape",self.field.shape
Note: See TracChangeset
for help on using the changeset viewer.