Create a wind-speed variable using Python

VAPOR allows you to derive new variables from the existing variables in the VDC.  We shall illustrate this by deriving a variable named "UVW" which will be equal to the wind speed.  [Note:  If you converted your data to a VDC following the instructions in this tutorial, then you will already have a wind-speed variable named "UVW_" which is equivalent to the variable we are deriving here.]

From the VAPOR Edit menu, click the entry "Edit Python Program defining a new variable".  This will launch the VAPOR Python Editor as follows:

Click the "Add 3D Variable" button and specify "UVW" as the 3D output variable name.

Then check the three input 3D variables U, V, and W.

Finally, type the following line into the text input area:

     UVW = numpy.sqrt(U*U+V*V+W*W)

Note:  numpy is the "Numerical Python" library, which supports many Python array operations.  Here we are applying the numpy square root operator "sqrt"  to the array defined by adding the squares of the three wind velocity components.

After typing in the above expression for UVW, click the "Test" button.  You should see a "Successful test" message.  Then click the "Apply" button, and the new variable UVW has been defined.

 

Note:  VAPOR provides a number of Python functions that are useful in analyzing and visualizing WRF-ARW data.  These include cloud-top temperature, radar reflectivity, equivalent potential temperature, relative humidity, potential vorticity, horizontal wind shear, sea-level pressure, dewpoint temperature, and temperature in degrees Kelvin.   These and other Python capabilities in VAPOR are documented here.