Changeset 942 for trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py
- Timestamp:
- Apr 25, 2013, 10:51:36 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py
r936 r942 538 538 obj.file = self.file[i] 539 539 obj.var = self.var[j] 540 # get methods 541 obj.method_x = mx ; obj.method_y = my 542 obj.method_z = mz ; obj.method_t = mt 540 543 # indicate the computation method 541 544 obj.compute = self.compute … … 547 550 obj.changetime = self.changetime 548 551 obj.performtimechange() 549 ### get methods550 obj.method_x = mx ; obj.method_y = my551 obj.method_z = mz ; obj.method_t = mt552 552 ### get index 553 553 obj.getindextime(dalist=st,ind=t,stride=self.stridet) … … 1206 1206 # -------------------------- 1207 1207 def performtimechange(self): 1208 if self.changetime is not None \ 1209 and self.name_t != "t grid points": 1208 if self.changetime is not None: 1210 1209 if self.verbose: print "**** OK. Converting time axis:",self.changetime 1210 ### option added by T. Navarro 1211 1211 if self.changetime == "mars_sol2ls": 1212 1212 self.field_t = ppcompute.mars_sol2ls(self.field_t) 1213 ### options added by A. Spiga 1214 elif "mars_meso" in self.changetime: 1215 if 'Times' not in self.f.variables.keys(): 1216 if self.verbose: print "!! WARNING !! Variable Times not in file. Cannot proceed to change of time axis." 1217 else: 1218 # get the array of strings describing dates 1219 dates = self.f.variables['Times'] 1220 dates.set_auto_maskandscale(False) # necessary to solve the api Times bug! 1221 # get ls sol utc from those strings 1222 ls, sol, utc = ppcompute.mars_date(dates[:]) 1223 # populate self.field_t with the right output from mars_date 1224 if self.changetime == "mars_meso_ls": 1225 self.field_t = ls 1226 self.name_t = "Ls" 1227 elif self.changetime == "mars_meso_sol": 1228 self.field_t = sol 1229 self.name_t = "sol" 1230 elif self.changetime == "mars_meso_utc" \ 1231 and ( self.changetime == "mars_meso_lt" \ 1232 and not hasattr(self.f,'CEN_LON') ): 1233 self.field_t = ppcompute.timecorrect(utc) 1234 self.name_t = "utc" 1235 if self.method_t == "fixed": 1236 self.field_t = self.field_t % 24 # so that the user is not mistaken! 1237 elif self.changetime == "mars_meso_lt": 1238 self.field_t = ppcompute.timecorrect(utc) + getattr(self.f,'CEN_LON') / 15. 1239 self.field_t = ppcompute.timecorrect(self.field_t) 1240 self.name_t = "local time (center of domain)" 1241 if self.method_t == "fixed": 1242 self.field_t = self.field_t % 24 # so that the user is not mistaken! 1213 1243 else: 1214 1244 print "!! WARNING !! This time change is not implemented. Nothing is done." 1245 if self.verbose: print "**** OK. new t axis values [%5.1f,%5.1f]" % (self.field_t.min(),self.field_t.max()) 1215 1246 1216 1247 # get list of index to be retrieved for time axis
Note: See TracChangeset
for help on using the changeset viewer.