Changeset 936 for trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py
- Timestamp:
- Apr 22, 2013, 8:31:47 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py
r934 r936 710 710 plobj.label = "" 711 711 if self.nfin > 1: plobj.label = plobj.label + " file #"+str(i+1) 712 if self.nvin > 1: plobj.label = plobj.label + " var #"+str(j+1)713 if self.nplott > 1: plobj.label = plobj.label + " t #"+str(t+1)714 if self.nplotz > 1: plobj.label = plobj.label + " z #"+str(z+1)715 if self.nploty > 1: plobj.label = plobj.label + " y #"+str(y+1)716 if self.nplotx > 1: plobj.label = plobj.label + " x #"+str(x+1)712 if self.nvin > 1: plobj.label = plobj.label + " var "+plobj.var 713 if self.nplott > 1: plobj.label = plobj.label + " t="+str(self.t[t]) 714 if self.nplotz > 1: plobj.label = plobj.label + " z="+str(self.z[z]) 715 if self.nploty > 1: plobj.label = plobj.label + " y="+str(self.y[y]) 716 if self.nplotx > 1: plobj.label = plobj.label + " x="+str(self.x[x]) 717 717 # specific 2d plot stuff 718 718 if dp == 2: … … 1174 1174 self.name_t = "nothing" 1175 1175 for c in glob_listt: 1176 if c in self.f. dimensions.keys():1176 if c in self.f.variables.keys(): 1177 1177 self.name_t = c 1178 if self.verbose: print "**** OK. Found time variable: ",c 1178 1179 try: 1179 1180 # speed up: only get first value, last one. 1180 dafirst = self.f.variables[self.name_t][0] 1181 dalast = self.f.variables[self.name_t][self.dim_t-1] 1182 self.field_t = np.linspace(dafirst,dalast,num=self.dim_t) 1183 if dafirst == dalast: self.field_t = np.array([dafirst]) 1181 tabtime = self.f.variables[self.name_t] 1182 # (consider the case where tabtime is not dim 1) 1183 # (time is most often the first dimension) 1184 if tabtime.ndim == 2: tabtime = tabtime[:,0] 1185 elif tabtime.ndim == 3: tabtime = tabtime[:,0,0] 1186 elif tabtime.ndim == 4: tabtime = tabtime[:,0,0,0] 1187 # (now proceed) 1188 dafirst = tabtime[0] 1189 if self.dim_t == 1: 1190 self.field_t = np.array([dafirst]) 1191 else: 1192 daint = tabtime[1] - dafirst 1193 dalast = dafirst + (self.dim_t-1)*daint 1194 if dalast != tabtime[self.dim_t-1] and self.verbose: 1195 print "!! WARNING !! Time axis has been recast to be monotonic",dalast,tabtime[self.dim_t-1] 1196 self.field_t = np.linspace(dafirst,dalast,num=self.dim_t) 1184 1197 except: 1185 1198 # ... or if a problem encountered, define a simple time axis
Note: See TracChangeset
for help on using the changeset viewer.