...
Ensure that the difference fieldset is visualised with the contouring applied. One way to generate a Metview Macro script from this plot is to click the Generate Macro button (also available from the File menu). A new Macro script will be generated - have a look at it to confirm that it contains code to read the data, compute the difference and plot the result. Run the macro to obtain the plot, either by using the Run button from the Macro Editor, or by selecting visualise from the icon's context menu). By default, the macro is written so that it will produce an interactive plot window; it will generate a PostScript file if it is run with the execute command, or if it is run from the command line.
Notice how simple the computation of the field differences isHave a look at the generated macro code. With a little cleanup, the code to read the GRIB files and compute their difference is just this:
| Code Block | ||
|---|---|---|
| ||
temperature_forecast = read("temperature_forecast.grib")
temperature_analysis = read("temperature_analysis.grib")
fc_an_diff = temperature_forecast - temperature_analysis |
The variables temperature_forecast and temperature_analysis are of type fieldset, which is Metview Macro's own data type for storing fields. You can confirm this, and print the number of fields with these lines of code:
| Code Block | ||
|---|---|---|
| ||
print(type(temperature_forecast))
print(count(temperature_forecast)) |
variables, coming, as they do, from GRIB data. Any operation on or between fieldsets is applied to every grid point in every field in the fieldset. Metview Macro has a large set of functions and operators on fieldsets.
...