Ignore:
Timestamp:
Apr 25, 2013, 10:51:36 PM (12 years ago)
Author:
aslmd
Message:

UTIL PYTHON planetoplot_v2. handling time for mesoscale files. added -E
to pp_reload to loop on several colormaps to try. corrected a bug for 1D

plots with linestyle and colors. added a functionality to easily add te

xt (or crosses, dots, etc...) on a map through a text file add_text.txt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py

    r936 r942  
    538538              obj.file = self.file[i]
    539539              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
    540543              # indicate the computation method
    541544              obj.compute = self.compute
     
    547550              obj.changetime = self.changetime
    548551              obj.performtimechange()
    549               ### get methods
    550               obj.method_x = mx ; obj.method_y = my
    551               obj.method_z = mz ; obj.method_t = mt           
    552552              ### get index
    553553              obj.getindextime(dalist=st,ind=t,stride=self.stridet)
     
    12061206    # --------------------------
    12071207    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:
    12101209            if self.verbose: print "**** OK. Converting time axis:",self.changetime
     1210            ### option added by T. Navarro
    12111211            if self.changetime == "mars_sol2ls":
    12121212                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!
    12131243            else:
    12141244                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())
    12151246
    12161247    # get list of index to be retrieved for time axis
Note: See TracChangeset for help on using the changeset viewer.