Changeset 972 for trunk/UTIL
- Timestamp:
- May 24, 2013, 8:09:13 PM (12 years ago)
- Location:
- trunk/UTIL/PYTHON/planetoplot_v2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/planetoplot_v2/pp.py
r963 r972 64 64 parser.add_option('-Z','--logy',action='store_true',dest='logy',default=False,help="set log for vertical axis") 65 65 parser.add_option('-O','--save',action='store',dest='out',type="string",default="gui",help="save mode: 'gui' 'png' 'pdf' 'eps' 'svg' 'ps'") 66 parser.add_option('-V','--void',action='store_true',dest='void',default=False,help="no colorbar, no title, no labels") 67 parser.add_option('-U','--units',action='append',dest='units',type="string",default=None,help="units for the field") 66 68 # -- 1D plot 67 69 parser.add_option('-L','--lstyle',action='append',dest='lstyle',type="string",default=None,help="[1D] linestyle: '-' '--' '.' '..'") … … 74 76 # -- 2D plot 75 77 parser.add_option('-C','--colorb',action='append',dest='colorb',type="string",default=None,help="[2D] colormap: http://micropore.files.wordpress.com/2010/06/colormaps.png") 76 parser.add_option('-P','--proj',action='append',dest='proj',type="string",default=None,help="[2D] map projection: 'cyl' 'npstere' 'spstere' 'ortho' 'moll' 'robin' 'lcc' 'laea' 'merc' ")78 parser.add_option('-P','--proj',action='append',dest='proj',type="string",default=None,help="[2D] map projection: 'cyl' 'npstere' 'spstere' 'ortho' 'moll' 'robin' 'lcc' 'laea' 'merc' 'noproj'") 77 79 parser.add_option('-B','--back',action='append',dest='back',type="string",default=None,help='[2D] predefined map background (cf. set_back.txt)') 78 80 parser.add_option('-A','--area',action='append',dest='area',type="string",default=None,help='[2D] predefined region of mapping (cf. set_area.txt)') … … 81 83 parser.add_option('-N','--vmin',action='append',dest='vmin',type="float",default=None,help='[2D] float: minimum value for displayed field') 82 84 parser.add_option('-M','--vmax',action='append',dest='vmax',type="float",default=None,help='[2D] float: maximum value for displayed field') 85 parser.add_option('-W','--wscale',action='append',dest='wscale',type="float",default=None,help='[2D] float: set size of reference wind vector') 83 86 (opt,args) = parser.parse_args() 87 # remains F G R 84 88 85 89 ###################################### … … 129 133 user.folder = opt.folder 130 134 user.out = opt.out 135 # if noproj is given for proj, no map mode 136 if opt.proj is not None: 137 if 'noproj' in opt.proj: 138 user.noproj = True 131 139 # if user wants to give a name, we drop the indication of date 132 140 if opt.filename != "myplot": … … 135 143 user.defineplot() 136 144 # user-defined plot settings 145 # ... shouldn't this be before defineplot? 137 146 user.getopt(opt) 138 147 # make plot -
trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py
r964 r972 1017 1017 # (except a few cases such as trans) 1018 1018 for iii in range(self.howmanyplots): 1019 if opt.void: 1020 self.p[iii].showcb = False 1021 else: 1022 self.p[iii].showcb = True 1019 1023 ### 1020 1024 try: self.p[iii].trans = opt.trans … … 1032 1036 except: pass 1033 1037 ### 1034 try: self.p[iii].title = opt.title[iii] 1035 except: 1038 if opt.void: 1039 self.p[iii].title = "" 1040 else: 1041 try: self.p[iii].title = opt.title[iii] 1042 except: 1036 1043 try: self.p[iii].title = opt.title[0] 1037 1044 except: pass 1038 1045 ### 1039 try: self.p[iii].xlabel = opt.xlabel[iii] 1040 except: 1046 if opt.void: 1047 self.p[iii].xlabel = "" 1048 else: 1049 try: self.p[iii].xlabel = opt.xlabel[iii] 1050 except: 1041 1051 try: self.p[iii].xlabel = opt.xlabel[0] 1042 1052 except: pass 1043 1053 ### 1044 try: self.p[iii].ylabel = opt.ylabel[iii] 1045 except: 1054 if opt.void: 1055 self.p[iii].ylabel = "" 1056 else: 1057 try: self.p[iii].ylabel = opt.ylabel[iii] 1058 except: 1046 1059 try: self.p[iii].ylabel = opt.ylabel[0] 1047 1060 except: pass … … 1111 1124 try: self.p[iii].ycoeff = opt.ycoeff[0] 1112 1125 except: pass 1126 ### 1127 try: self.p[iii].units = opt.units[iii] 1128 except: 1129 try: self.p[iii].units = opt.units[0] 1130 except: pass 1131 ### 1132 try: self.p[iii].wscale = opt.wscale[iii] 1133 except: 1134 try: self.p[iii].wscale = opt.wscale[0] 1135 except: pass 1136 1113 1137 1114 1138 … … 1251 1275 elif tabtime.ndim == 3: tabtime = tabtime[:,0,0] 1252 1276 elif tabtime.ndim == 4: tabtime = tabtime[:,0,0,0] 1253 # (now proceed) 1254 dafirst = tabtime[0] 1277 # (now proceed) (the +0. just ensures this is a number) 1278 dafirst = tabtime[0] + 0. 1255 1279 if self.dim_t == 1: 1256 1280 self.field_t = np.array([dafirst]) … … 1263 1287 except: 1264 1288 # ... or if a problem encountered, define a simple time axis 1289 if self.verbose: print "**** OK. There is something weird. Let us go for a simple time axis." 1265 1290 self.field_t = np.array(range(self.dim_t)) 1266 1291 self.name_t = "t grid points" -
trunk/UTIL/PYTHON/planetoplot_v2/ppplot.py
r964 r972 489 489 vmax=None,\ 490 490 showcb=True,\ 491 wscale=None,\ 491 492 colorvec="black"): 492 493 ## get initialization from parent class … … 507 508 self.vmin = vmin ; self.vmax = vmax 508 509 self.showcb = showcb 510 self.wscale = wscale 509 511 510 512 # define_from_var … … 608 610 #mertab = np.r_[wlon[0]:wlon[1]:steplon] ; merlab = [0,0,0,1] 609 611 #partab = np.r_[wlat[0]:wlat[1]:steplat] ; parlab = [1,0,0,0] 610 mertab = np.r_[- 360.:360.:steplon] ; merlab = [0,0,0,1]612 mertab = np.r_[-180.:180.:steplon] ; merlab = [0,0,0,1] #-360:360. 611 613 partab = np.r_[-90.:90.:steplat] ; parlab = [1,0,0,0] 612 614 format = '%.1f' … … 712 714 #vecx,vecy = self.addvecx,self.addvecy 713 715 # reference vector is scaled 714 zescale = ppcompute.mean(np.sqrt(self.addvecx*self.addvecx+self.addvecy*self.addvecy)) 715 #zescale = 25. 716 if self.wscale is None: self.wscale = ppcompute.mean(np.sqrt(self.addvecx*self.addvecx+self.addvecy*self.addvecy)) 716 717 # make vector field 717 718 q = m.quiver( x[::stride,::stride],y[::stride,::stride],\ 718 719 vecx[::stride,::stride],vecy[::stride,::stride],\ 719 720 angles='xy',color=self.colorvec,pivot='middle',\ 720 scale= zescale*reducevec,width=widthvec )721 scale=self.wscale*reducevec,width=widthvec ) 721 722 # make vector key. 722 723 #keyh = 1.025 ; keyv = 1.05 # upper right corner over colorbar 723 keyh = 0.98 ; keyv = 1.06 724 keyh = 0.98 ; keyv = 1.07 724 keyh = 0.97 ; keyv = 1.05 725 725 #keyh = -0.03 ; keyv = 1.08 # upper left corner 726 726 p = mpl.quiverkey(q,keyh,keyv,\ 727 zescale,str(int(zescale)),\ 727 self.wscale,str(int(self.wscale)),\ 728 fontproperties={'size': 'small'},\ 728 729 color='black',labelpos='S',labelsep = 0.07) 729 730 ############################################################################################
Note: See TracChangeset
for help on using the changeset viewer.