[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20041022: how to handle staggered U & V in IDV?



>From: Rich Signell <address@hidden>
>Organization: USGS
>Keywords: 200410122002.i9CK2KUE001971 IDV  staggered grids

Hi Rich-

>Did you try this with my file?    I couldn't get this to work.  If I select
>the system formula "make flow vectors from u v data", and then choose
>"ubar" and "vbar" from the 2D variable list, I get the attached error
>message.

This file uncovered a bug in VisAD and also a flaw in how I
was resampling for the staggered grid case.  I put a new
idv.jar in the usual place with the usual caveats that will
allow you to plot the 2D wind vectors.  However, there are
other problems with the 3D components and that will take some
doing to fix.  Basically, the problem is the S coordinate
is on a different grid than the u and v components.  So, we'll
have to do some interpolation or something.  How would you
like that handled?

>Ideally I would average the U and V values to the grid cell centers, 
>which are defined
>by the 2D variables "lon_rho" and "lat_rho".    These lon,lat values do 
>not change with time.

With the new JAR, try the following:

1) create a Jython formula like:

# resample a grid to the domain of another
def resampleGrid(oldGrid, gridwithNewDomain):
   import ucar.unidata.data.grid.GridUtil as gu
   newLocs = gu.getSpatialDomain(gridwithNewDomain)
   return gu.resampleGrid(oldGrid, newLocs)

2) create a formula to call this:

Name: resample grid
Formula:  resampleGrid(grid, gridWithNewDomain)

For a vector display of the ubar and vbar variables at the
lon_rho, lat_rho points:

3) Load in your dataset

4) Select the new formula from the fields and select Vector Plan View
for the display and click Create Display.  

5) When prompted for the formula variables, select the Formula
"Make flow vectors from u and v data" for the
grid variable and select the grid with the new domain for the
other (zeta in your sample file), then click OK.

6) Now, select ubar and vbar for the u and v variables and click OK
again.

If all goes well, you should get the vectors located on the zeta grid.  If
you want, overlay the "Make flow vectors from u and v data" vectors
on top to see that they are in different places.  These would be
at the lon_u and lat_u points.

Alternatively, you could create a vector display of u resampled
to the newdomain and v (which would resample v to that).  That is
left as a simple exercise to the reader. ;-)

We're working on a solution for the 3D u and v, but that will
take a bit more work.
Don
NOTE: All email exchanges with Unidata User Support are recorded in the
Unidata inquiry tracking system and then made publicly available
through the web.  If you do not want to have your interactions made
available in this way, you must let us know in each email you send to us.