Changeset 930 for trunk/UTIL/PYTHON
- Timestamp:
- Apr 15, 2013, 12:55:29 PM (12 years ago)
- Location:
- trunk/UTIL/PYTHON/planetoplot_v2
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py
r926 r930 100 100 zesaxis[i,1] = float(a[1]) 101 101 return zesaxis 102 103 # look for comas in the input name to separate different names (files, variables,etc ..) 102 104 # (needed by readslices) 103 # look for comas in the input name to separate different names (files, variables,etc ..)104 105 def separatenames (name): 105 106 if name is None: names = None … … 141 142 filename="myplot",\ 142 143 folder="./",\ 144 includedate=True,\ 143 145 xlabel=None,ylabel=None,\ 144 146 xcoeff=None,ycoeff=None,\ … … 162 164 self.p = None 163 165 self.customplot = False 166 self.allfield = None 164 167 ## what could be defined by the user 165 168 self.file = file … … 180 183 self.filename = filename 181 184 self.folder = folder 185 self.includedate = includedate 182 186 ## here are user-defined plot settings 183 187 ## -- if not None, valid on all plots in the pp() objects … … 238 242 self.label = other.label 239 243 self.title = other.title 244 self.includedate = other.includedate 240 245 else: 241 246 print "!! ERROR !! argument must be a pp object." ; exit() … … 560 565 # check if things were done OK before 561 566 if self.status != "defined": print "!! ERROR !! Please use .define() to define your pp object." ; exit() 567 # create the list of allfield() objects 568 # --> so that the user can easily access values 569 self.allfield = [[[[[[ \ 570 [] \ 571 for x in range(self.nplotx)] for y in range(self.nploty)] \ 572 for z in range(self.nplotz)] for t in range(self.nplott)] \ 573 for j in range(self.nvin)] for i in range(self.nfin)] 562 574 ## first get fields 563 575 ## ... only what is needed is extracted from the files … … 572 584 obj.getfield() 573 585 obj.computations() 586 self.allfield[i][j][t][z][y][x] = obj.field 587 # get rid of useless dimensions in allfield 588 self.allfield = np.squeeze(self.allfield) 574 589 # change status 575 590 self.status = "retrieved" … … 860 875 print "**** PPCLASS. Done step: makeplot" 861 876 if (self.n == self.howmanyplots): 862 ppplot.save(mode=self.out,filename=self.filename,folder=self.folder,custom=self.customplot )877 ppplot.save(mode=self.out,filename=self.filename,folder=self.folder,custom=self.customplot,includedate=self.includedate) 863 878 mpl.close() 864 879 # SAVE A PICKLE FILE WITH THE self.p ARRAY OF OBJECTS … … 1380 1395 pass 1381 1396 elif test in ["fixedfree","fixedcomp"] or test in ["freefixed","compfixed"]: 1382 time0 = timelib.time() 1397 time0 = timelib.time() 1383 1398 # now have to obtain the new indexes which correspond to the extracted self.field 1384 1399 # for it to work with unique index, ensure that any index_* is a numpy array … … 1518 1533 totarea = np.tile(totarea,(1,self.index_x.size)) 1519 1534 elif self.method_x == "comp" and self.method_y == "comp": 1535 aire.field = aire.field[np.ix_(self.index_y, self.index_x)] # reduce to requested indexes only 1520 1536 totarea = ppcompute.sum(ppcompute.sum(aire.field,axis=1),axis=0) 1521 1537 else: … … 1527 1543 aire.field = np.tile(aire.field,(self.index_t.size,self.index_z.size,1,1)) 1528 1544 if self.field.shape != aire.field.shape: 1529 print "!! ERROR !! Problem in area(). Check array shapes." ; exit() 1545 print "!! ERROR !! Problem in area(). Check array shapes." 1546 print "Field vs. aire:",self.field.shape,aire.field.shape ; exit() 1530 1547 else: 1531 1548 self.field = self.field*aire.field -
trunk/UTIL/PYTHON/planetoplot_v2/ppplot.py
r929 r930 418 418 mpl.legend(loc="best",fancybox=True) 419 419 ## TBD: set with .div the number of ticks 420 ## TBD: be able to control plot limits421 420 #ticks = self.div + 1 422 421 #ax = mpl.gca() 423 422 #ax.get_xaxis().set_ticks(np.linspace(ppcompute.min(x),ppcompute.max(x),ticks/2+1)) 423 # control plot limits (TBD: be able to control those) 424 ax = mpl.gca() ; ax.set_xbound(lower=ppcompute.min(x), upper=ppcompute.max(x)) 425 424 426 425 427 ################################ … … 660 662 angles='xy',color=self.colorvec,pivot='middle',\ 661 663 scale=zescale*reducevec,width=widthvec ) 662 # make vector key. default is on upper left corner.663 keyh = 1.025 ; keyv = 1.05 664 #keyh = -0.03 ; keyv = 1.08 664 # make vector key. 665 keyh = 1.025 ; keyv = 1.05 # upper right corner over colorbar 666 #keyh = -0.03 ; keyv = 1.08 # upper left corner 665 667 p = mpl.quiverkey(q,keyh,keyv,\ 666 668 zescale,str(int(zescale)),\ -
trunk/UTIL/PYTHON/planetoplot_v2/set_area.txt
r910 r930 24 24 Xanadu ; -40 ; 20 ; 40 ; 120 25 25 Hyperboreae ; 80 ; 87 ; -70 ; -10 26 VM ; -15 ; 0 ; -90 ; -60 26 27 VM_alt ; -15 ; 0 ; 270 ; 300
Note: See TracChangeset
for help on using the changeset viewer.