Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
plot(fc_obs_diff, diff_symb_hot, diff_symb_cold)

Computing Wind Speed from U/V

The GRIB file uv850 contains analysis data for U and V wind components at 850hPa. The task is to compute the wind speed from this using a macro, so create a new Macro icon, rename it compute_wind_speed and edit it.

Perform the following steps:

  1. filter the U wind component into a variable called u (you may find it useful to use the GRIB Filter icon to do this and then drop it into the Macro Editor)
  2. filter the U wind component into a variable called v
  3. apply the formula speed = sqrt(u*u + v*v)

  4. plot the result

Returning a Computation for Further Interactive Use

The result of the above macro does not have to live entirely inside the macro - it can be passed back to the user interface or used as input to other icons. Do this:

  1. in the above macro, comment out the plot() command (using the hash, #, symbol)
  2. add a new line of code at the end:
    return speed

This passes the fieldset speed back to the user interface. Try it by right-clicking on the macro's icon and selecting examine, save or visualise. 

Extra Tasks

Computing relative differences

Adapt the macros from this tutorial so that they compute relative differences rather than absolute differences between the values. By this we mean compute the differences as percentages of the original analysis values. You will need to create new Contouring and Symbol Plotting icons to plot these nicely.

Overlaying wind speed with wind arrows

Write a macro which takes U and V wind components from a GRIB file and plots the wind speed as shaded contours with wind arrows overlaid on top.