4.2.2 Doing More With Formulas

Formulas can be used to do simple arithmetic such as the simple difference, or they can be used to call Jython procedures as in the previous excercise. They can also be used to call Java methods and nest Jython procedures. In this exercise, we will show how to create more complex formulas from the set of diagnostic functions in the IDV.

First review Basics of IDV Formulas.

1. Calculating the ageostrophic wind
• Clear all displays and data.
• Load in the ETA 1998-06-29 00:00 data source.
• Create the following displays:
• 500 mb contours of geopotential height
• 500 mb flow vectors of grid relative winds. Set the skip interval to 2 and the range to be -30 to 30. Save the display settings as Workshop->Flow fields.
• 500 mb flow vectors of the geostrophic wind. Use the display settings saved in the previous step.
• The ageostropic wind is the difference between the geostropic wind and the actual wind.
AGEO = OBS - GEO
• We could simply create a formula that is OBS - GEO and select the flow vector field and the geostropic wind. For this exercise, we will look at how we can do this from the basic fields, on the fly.
• Open the Jython Library and look at the library. This is a set of diagnostic functions that can be applied to grids. The names closely match the set of grid diagnostics in GEMPAK. Look at the page in the Jython Library section of the User's Guide.
• From the Formulas Data Source, select the formula.
• Select the , the Workshop->Flow fields display setting and create the display.
• You will be prompted for the formula. In the dialog, type in:
vsub(vecr(u,v),geo(z))
This will take the vector difference (vsub) between the vector (vecr) defined by u and v components and the geostrophic wind (geo) calculated from the geopotential height field (z).
• Click the OK button.
• For the fields, select the u and v wind components and the geopotential height for u,v and z respectively. Select the 500 hPa level for each of the grids.
• Zoom in to see the detail of the plots.
2. Calculating the magnitude of the ageostrophic wind
• The magnitude (speed) of the ageostrophic wind can be calulated using the mag function. To save some steps, we'll save the ageostropic wind field in the cache and use that.
• Use the ageostrophic vector control's menu to save the data in the cache. You can leave the name as is or change it to ageo.
• Select the formula and the Contour Plan View Display.
• In the dialog, type:
mag(v)
• For the field, select the cached data.