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

20040820: IDV - vertical wind shear



>From: "Dave Ahijevych" <address@hidden>
>Organization: UCAR/MMM
>Keywords: 200408201827.i7KIRTjg000271 IDV wind shear

Hi Dave-

Sorry for the delay in responding.

>Institution: MMM
>Package Version: 1.1
>Operating System: os.name:Linux; os.arch:i386; os.version:2.4.22-1.2188.nptlsm
> p; 
>Hardware Information: java.vendor:Sun Microsystems Inc.; java.version:1.4.2_01
> ; java.home:/sharp/ahijevyc/IDV/jre; 
>Inquiry: How can I derive wind shear between two arbitrary vertical levels in 
> a numerical model?

You could do this with a Jython script.  If you open the Jython
libraries editor from the Edit->Formulas->Jython Library menu,
you could paste in the following:


#calculate the wind shear between discrete layers
# shear = sqrt((u(top)-u(bottom))^2 + (v(top)-v(bottom))^2)/zdiff
def windShear(u, v, z, top, bottom):
   import ucar.unidata.data.grid.GridUtil as gu
   udiff = layerDiff(u, top, bottom)
   vdiff = layerDiff(v, top, bottom)
   zdiff = layerDiff(z, top, bottom)
#  adjust to altitude if units are gpm
   zdiff = getAltitude(zdiff)
   windDiff = sqrt(udiff*udiff + vdiff*vdiff)
   return windDiff/zdiff

# wrapper for calculating layer difference
def layerDiff(grid, top, bottom):
   from ucar.unidata.data.grid.DerivedGridFactory import *
   return createLayerDifference(grid, top, bottom)

#change units from geopotential meters to meters
def getAltitude(z):
   import ucar.visad.quantities.GeopotentialAltitude as ga
   import ucar.visad.quantities.Gravity as gr
   import ucar.unidata.data.grid.GridUtil as gu
   zUnit = gu.getParamType(z).getRealComponents()[0].getDefaultUnit()
   if zUnit.equals(ga.getGeopotentialMeter()):
      z = z.divide(gr.newReal())
   return z

and then click the Save button.  This will add in the necessary 
routines to your local library.

Now create a formula to call the windShear routine.
From the Edit->Formulas->Formula->Create Formulas menu, open
the formula editor.  Fill out the form (this assumes version
1.1):

- for the name, enter wind shear
- for the Formula, enter:
windShear(u, v, z, top[isuser=true,default=500], 
bottom[isuser=true,default=850])
(note if you are using an earlier version (e.g., 1.1 beta 3), try:
    windShear(u, v, z, user_top, user_bottom)

optionally:

if the Advanced panel is not opened, click on the down arrow
- for the Description, enter something like Layer Wind Shear
- for the Displays, click the Use selected: radio button and

After you have your gridded data loaded in, select the Formulas
data source and the Layer Wind Shear field and the type of plan
view display you want, then click the "Create Display" button.

You will first be prompted for the layers you want.  If using 1.1
and have set the defaults and that's what you want, click OK.

Next you will be prompted for the u, v, and z values for the 
calculation.  Select these, click OK and then the calculation
should happen and you should see the values displayed.  

For my test dataset, the values came up in units of .1 s-1.  If
you want to change these, use the Edit->Change Display Unit menu
in the display control window for the particular display.

Let me know if you have problems with this or more questions.
The diagnostic capabilities of the IDV need some fleshing out.
I think this is a good addition and will merge it into the 
core library for the next release.

Don Murray
NOTE: All email exchanges with Unidata User Support are recorded in the
Unidata inquiry tracking system and then made publically 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.