[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[IDV #NJK-709837]: IDV function for land/sea topo scaling
- Subject: [IDV #NJK-709837]: IDV function for land/sea topo scaling
- Date: Fri, 05 Mar 2010 15:09:40 -0700
Rich-
For some reason, the jython lost it's formatting in the message. Hopefully
you get the idea. I took the syntax from the workshop example at:
http://www.unidata.ucar.edu/software/IDV/docs/workshop/formulas/MoreWithJython.html
Don
> > What I want is:
> >
> > a=a/10 (a>0)
> > a=a (a<=0)
>
> Define a Jython procedure:
>
> def scaleGrid(grid):
> p = grid.clone()
> for i in range(len(p)):
> a = p[i]
> if a > 0:
> p[i]=a/10
> return p
>
> You could modify that to pass in a scale and threshold and provide defaults:
>
> def scaleGrid(grid, thresh=0, scale=10):
> p = grid.clone()
> t = int(thresh)
> s = int(scale)
> for i in range(len(p)):
> a = p[i]
> if a > t:
> p[i]=a/s
> return p
>
> Don
> > On Fri, Mar 5, 2010 at 4:54 PM, Unidata IDV Support
> > <address@hidden> wrote:
> > >> Jeff,
> > >> I seem to remember you saying to pass new function ideas along, so here
> > >> goes...
> > >>
> > >> I often want to load in DEM data (land topo/sea bathy) for visualizing
> > >> along with ocean modeling applications in IDV, but I want to provide a
> > >> different vertical exaggeration for the land and ocean topography,
> > >> because I want to clearly show the coastal ocean topography, but
> > >> without the land topography looking like skyscrapers. For example,
> > >> I'd like to scale the depths below 0 by a different factor than the
> > >> elevations above 0. I imagine this is pretty simple, but still
> > >> don't know how.
> > >>
> > >
> > > Hi Rich,
> > > Just make a formula called scale, e.g., to scale by 2:
> > >
> > > fieldYouWantToScale*2
> > >
> > > That should work.
> > >
> > > -Jeff
> > >
> > >
> > >
> > >
> > >
> > > Ticket Details
> > > ===================
> > > Ticket ID: NJK-709837
> > > Department: Support IDV
> > > Priority: Normal
> > > Status: Closed
> > >
> > >
> >
> >
> >
> > --
> > Dr. Richard P. Signell (508) 457-2229
> > USGS, 384 Woods Hole Rd.
> > Woods Hole, MA 02543-1598
> >
> >
>
Ticket Details
===================
Ticket ID: NJK-709837
Department: Support IDV
Priority: Normal
Status: Open