Changeset 917 for trunk/UTIL/PYTHON
- Timestamp:
- Mar 27, 2013, 11:14:53 PM (12 years ago)
- Location:
- trunk/UTIL/PYTHON/planetoplot_v2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/UTIL/PYTHON/planetoplot_v2/pp_reload.py ¶
r910 r917 9 9 # ----------------------------------------------------------------------- 10 10 parser = OptionParser() 11 parser.add_option('-o',action='store',dest='out',type="string",default="gui",help='Specify a new output format') 11 parser.add_option('-O','--out',action='store',dest='out',type="string",default="gui",help='Specify a new output format') 12 parser.add_option('-P','--proj',action='store',dest='proj',type="string",default=None,help='Define a new map projection') 12 13 (opt,args) = parser.parse_args() 13 14 # ----------------------------------------------------------------------- … … 16 17 yeah.defineplot(loadfile=files) 17 18 yeah.out = opt.out 19 if opt.proj is not None: 20 for plot in yeah.p: 21 plot.proj = opt.proj 18 22 yeah.makeplot() 19 23 -
TabularUnified trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py ¶
r916 r917 725 725 self.subv,self.subh = ppplot.definesubplot(self.howmanyplots,self.fig) 726 726 self.n = 0 727 ## adapted space for labels etc 728 ## ... except for ortho because there is no label anyway 729 customplot = self.p[0].field.ndim == 2 \ 730 and self.p[0].mapmode == True \ 731 and self.p[0].proj not in ["ortho"] 732 if customplot: 733 margin = 0.07 734 self.fig.subplots_adjust(left=margin,right=1-margin,bottom=margin,top=1-margin) 727 735 else: 728 736 # start from an existing figure. … … 765 773 self.n = self.n+1 766 774 # once completed show the plot (cannot show intermediate plotin) 775 # ... added a fix (customplot=True) for the label problem in basemap 767 776 print "**** Done step: makeplot" 768 if (self.n == self.howmanyplots): ppplot.save(mode=self.out,filename=self.filename,folder=self.folder) 777 if (self.n == self.howmanyplots): 778 ppplot.save(mode=self.out,filename=self.filename,folder=self.folder,custom=customplot) 769 779 # SAVE A PICKLE FILE WITH THE self.p ARRAY OF OBJECTS 770 780 if self.verbose: print "**** Saving session in "+self.filename + ".ppobj" -
TabularUnified trunk/UTIL/PYTHON/planetoplot_v2/ppplot.py ¶
r910 r917 218 218 # a generic function to show (GUI) or save a plot (PNG,EPS,PDF,...) 219 219 # ------------------------------- 220 def save(mode="gui",filename="plot",folder="./",includedate=True,res=150 ):220 def save(mode="gui",filename="plot",folder="./",includedate=True,res=150,custom=False): 221 221 # a few settings 222 222 possiblesave = ['eps','ps','svg','png','jpg','pdf'] … … 233 233 ## save file 234 234 print "**** Saving file in "+mode+" format... Please wait." 235 mpl.savefig(name,dpi=res,bbox_inches='tight',pad_inches=pad_inches_value) 235 if not custom: 236 # ... regular plots 237 mpl.savefig(name,dpi=res,pad_inches=pad_inches_value,bbox_inches='tight') 238 else: 239 # ... mapping mode, adapted space for labels etc... 240 mpl.savefig(name,dpi=res) 236 241 else: 237 242 print "!! ERROR !! File format not supported. Supported: ",possiblesave … … 538 543 # ... cyl is good for global and regional 539 544 if self.proj == "cyl": 540 pass545 format = '%.0f' 541 546 # ... global projections 542 547 elif self.proj in ["ortho","moll","robin"]: … … 603 608 if self.trans > 0.: 604 609 ## draw colorbar. settings are different with projections. or if not mapmode. 605 if not self.mapmode: orientation=zeorientation ; frac = 0.075 606 elif self.proj in ['moll']: orientation="horizontal" ; frac = 0.075 607 elif self.proj in ['cyl']: orientation="vertical" ; frac = 0.023 608 else: orientation = zeorientation ; frac = zefrac 610 if not self.mapmode: orientation=zeorientation ; frac = 0.075 ; pad = 0.03 611 elif self.proj in ['moll']: orientation="horizontal" ; frac = 0.075 ; pad = 0.03 612 elif self.proj in ['cyl']: orientation="vertical" ; frac = 0.023 ; pad = 0.03 613 else: orientation = zeorientation ; frac = zefrac ; pad = 0.03 609 614 zelevpal = np.linspace(zevmin,zevmax,num=min([ticks/2+1,21])) 610 zecb = mpl.colorbar(fraction=frac,pad= 0.03,\615 zecb = mpl.colorbar(fraction=frac,pad=pad,\ 611 616 format=self.fmt,orientation=orientation,\ 612 617 ticks=zelevpal,\ … … 629 634 scale=zescale*reducevec,width=widthvec ) 630 635 # make vector key. default is on upper left corner. 631 p = mpl.quiverkey(q,-0.0 6,0.98,\636 p = mpl.quiverkey(q,-0.03,1.08,\ 632 637 zescale,str(int(zescale)),\ 633 638 color='black',labelpos='S',labelsep = 0.07) 639 #### streamplot!!! avec basemap -
TabularUnified trunk/UTIL/PYTHON/planetoplot_v2/set_multiplot.txt ¶
r910 r917 4 4 ############################################ 5 5 1 ; 1 ; 1 ; 0.0 ; 0.0 ; 22 6 2 ; 1 ; 2 ; 0. 5 ; 0.0 ; 206 2 ; 1 ; 2 ; 0.35 ; 0.0 ; 20 7 7 #3 ; 3 ; 1 ; 0.0 ; 1.0 ; 18 8 3 ; 1 ; 3 ; 0. 7; 0.0 ; 188 3 ; 1 ; 3 ; 0.35 ; 0.0 ; 18 9 9 4 ; 2 ; 2 ; 0.8 ; 0.6 ; 18 10 10 6 ; 3 ; 2 ; 0.6 ; 1.0 ; 18
Note: See TracChangeset
for help on using the changeset viewer.