Changeset 982 for trunk/UTIL


Ignore:
Timestamp:
Jun 7, 2013, 3:23:01 PM (12 years ago)
Author:
aslmd
Message:

UTIL PYTHON planetoplot_v2. Finished the job about striding. Possibility to stride vectors and not field. Updated vector.py

Location:
trunk/UTIL/PYTHON/planetoplot_v2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/PYTHON/planetoplot_v2/examples/vector.py

    r923 r982  
    99u.z = "50000"
    1010u.filename = "vector"
    11 u.get()
    12 u.defineplot()
    13 #u.p[0].proj = "ortho"
    14 #u.p[0].blat = -45.
    15 u.makeplot()
     11
     12# stride both x and y
     13# this impacts field + vector
     14u.stridex = 3
     15u.stridey = 3
     16u.getplot()
     17u.stridex = 1 # (reinitialise)
     18u.stridey = 1 # (reinitialise)
     19
     20# stride vectors only
     21# not field (here topography)
     22u.stridevecx = 3
     23u.stridevecy = 3
     24u.getplot()
     25
    1626
    1727
  • trunk/UTIL/PYTHON/planetoplot_v2/pp.py

    r981 r982  
    9292parser.add_option('-M','--vmax',action='append',dest='vmax',type="float",default=None,help='[2D] float: maximum value for displayed field')
    9393parser.add_option('-W','--wscale',action='append',dest='wscale',type="float",default=None,help='[2D] float: set size of reference wind vector')
     94parser.add_option('--stridevecx',action='store',dest='stridevecx',type="int",default=1,help="Define an abscissa stride on vectors only -- not on field")
     95parser.add_option('--stridevecy',action='store',dest='stridevecy',type="int",default=1,help="Define an ordinate stride on vectors only -- not on field")
     96###########################
    9497(opt,args) = parser.parse_args()
    9598# remains F G R 
     
    133136user.stridez = opt.stridez
    134137user.stridet = opt.stridet
     138user.stridevecx = opt.stridevecx
     139user.stridevecy = opt.stridevecy
    135140# define field
    136141user.define()
  • trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py

    r981 r982  
    135135                      stridex=1,stridey=1,\
    136136                      stridez=1,stridet=1,\
     137                      stridevecx=1,\
     138                      stridevecy=1,\
    137139                      compute="mean",\
    138140                      verbose=False,\
     
    182184        self.stridex = stridex ; self.stridey = stridey
    183185        self.stridez = stridez ; self.stridet = stridet
     186        self.stridevecx = stridevecx
     187        self.stridevecy = stridevecy
    184188        self.compute = compute
    185189        self.verbose = verbose
     
    799803                        if self.vmin is not None: plobj.vmin = self.vmin
    800804                        if self.vmax is not None: plobj.vmax = self.vmax
     805                        plobj.stridevecx = self.stridevecx
     806                        plobj.stridevecy = self.stridevecy
    801807                    # finally append plot object
    802808                    self.p.append(plobj)
  • trunk/UTIL/PYTHON/planetoplot_v2/ppplot.py

    r981 r982  
    513513                 showcb=True,\
    514514                 wscale=None,\
     515                 stridevecx=1,\
     516                 stridevecy=1,\
    515517                 colorvec="black"):
    516518        ## get initialization from parent class
     
    531533        self.showcb = showcb
    532534        self.wscale = wscale
     535        self.stridevecx = stridevecx
     536        self.stridevecy = stridevecy
    533537
    534538    # define_from_var
     
    729733        ############################################################################################
    730734        ### not expecting NaN in self.addvecx and self.addvecy. masked arrays is just enough.
    731         stride = 3
    732         stride = 1 ## no need to stride. done with data. except if you want to stride wind and not field TBD.
    733735        if self.addvecx is not None and self.addvecy is not None:
     736                # vectors on map projection or simple 2D mapping
    734737                if self.mapmode: [vecx,vecy] = m.rotate_vector(self.addvecx,self.addvecy,self.absc,self.ordi) # for metwinds only ?
    735738                else: vecx,vecy = self.addvecx,self.addvecy ; x,y = np.meshgrid(x,y)
     
    738741                # make vector field
    739742                if self.mapmode:
    740                     q = m.quiver( x[::stride,::stride],y[::stride,::stride],\
    741                                   vecx[::stride,::stride],vecy[::stride,::stride],\
     743                    q = m.quiver( x[::self.stridevecy,::self.stridevecx],y[::self.stridevecy,::self.stridevecx],\
     744                                  vecx[::self.stridevecy,::self.stridevecx],vecy[::self.stridevecy,::self.stridevecx],\
    742745                                  angles='xy',color=self.colorvec,pivot='tail',\
    743746                                  scale=self.wscale*reducevec,width=widthvec )
    744747                else:
    745                     q = mpl.quiver( x[::stride,::stride],y[::stride,::stride],\
    746                                     vecx[::stride,::stride],vecy[::stride,::stride],\
     748                    q = mpl.quiver( x[::self.stridevecy,::self.stridevecx],y[::self.stridevecy,::self.stridevecx],\
     749                                    vecx[::self.stridevecy,::self.stridevecx],vecy[::self.stridevecy,::self.stridevecx],\
    747750                                    angles='xy',color=self.colorvec,pivot='tail',\
    748751                                    scale=self.wscale*reducevec,width=widthvec )
Note: See TracChangeset for help on using the changeset viewer.