3.2.2 Doing More With Formulas

A formula for wind chill, and more details about formula names, categories, and variable names

First review Basics of IDV Formulas.

- A Formula for the JAG-TI Wind Chill
- Create an IDV formula named
`wind chill`

with the expression13.12 + 0.6215*T - 11.37*WS**0.16 + 0.3965*T*WS**0.16

- T is for air temperature and WS for wind speed. Choose data for the calculation using data from the case study model output. Use "temperature" and "Derived -> Windspeed (from Grid relative u and v)" from the 3D grids.
- Make a
`Contour Plan View`

display. - Check the contour values to see the results.
- We did not consider units. The temperature data is in Kelvins, and the wind speed is in m/s. The formula expects data in Celsius and kilometers per hour. So we have to put unit conversion into the formula. Use (T-273.15) for temperature and 3.6*WS for windspeed.
- Edit the formula and saved the changed formula.
The revised formula is
13.12 + 0.6215*(T-273.15) - 11.37*(WS*3.6)**0.16 + 0.3965*(T-273.15)*(WS*3.6)**0.16

- The formula is checked for valid Jython syntax when you save it. If you made a typing mistake a pop-up box appears with "The formula contains a Jython syntax error." Correct the formula and save again.
- Display the new computation.

Here is a wind chill contour plot:

More Details about Formula Names, Categories, and Variable Names

The `Description`

is listed in the
`Field Selector`

's `Fields`

panel.
If you leave the `Description`

field empty, the name
of the formula will be used as the description.

`Group`

is a way of categorizing your formulas and
is optional.
If the `Group`

does not already exist, it is added when
you save the new formula. If the `Group`

already exists,
the new formula will appear under that group's tab in the
`Field Selector`

's `Fields`

panel. If you
leave the `Group`

empty, the formula appears in the
list directly.

The variable names in the formula definition, such as dpt, are dummy names, and in principle can be anything, such as "a" or "var2". It is best to use variable names that suggest the parameter data they represent so that later in the parameter selection step you remember what the variables should represent. Use names like Temp500m, RelHum_surf, absvort, sst_jan, or whatever makes sense to you. If you use a variable names like V1 and V2, then later when the formula requests which real parameter name goes with which dummy variable name you may be puzzled.

Once you have defined a formula, it is saved and will appear in future
runs of your IDV. It is saved in your personal copy of the derived.xml
file, which usually is in the file
`~/.metapps/DefaultIdv/derived.xml`

on UNIX systems.

Holding the mouse pointer stationary over the formula name in the
`Field Selector`

's `Fields`

panel will cause a
tooltip box to appear showing the formula name and the mathematical formula.

Formulas are preserved by the IDV. Next time you start the IDV you will see formulas you created before. You can build up a library of your own formulas.

To remove a formula, click on
`Remove formula`

in the `Field Selector`

's
formula pull down menu.
This does not remove a display of calculations made with a formula, it removes
the formula itself from the
`Field Selector`

window. Usually you leave formulas
in place until you are sure you will not use them again.