Versions Compared

Key

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

...

  • drop your NetCDF Visualiser icon into the Macro Editor, also add the Contouring icon
  • create a Text Plotting icon and enter a random title string, then drop this into the Macro Editor
  • replace the value to the right of text_line_1 with the value of the long_name attribute
  • add a plot() command which contains the NetCDF Visualiser variable, the Contouring variable and the Text Plotting variable
  • feel free to add the units attribute to the title as well, using the ampersand operator & to concatenate parts of the string

Computations on netCDF data

Simple computations between netCDFs can be performed in a similar way to fieldsets, but they are only performed on the current variable for each netCDF. The folder contains two netCDF files: fc_12.nc and fc_36.nc, representing a 12-hour and a 36-hour forecast valid at the same time. Write a small macro which reads both files, sets their current variable to t2m and computes the difference. The last line should look something like:

Code Block
diff = fc_36 - fc_12

The variable diff is also a netCDF variable - confirm with this line: "print(type(diff))". Its contents should be identical to the first netCDF in the computation (fc_36), but with the values of its t2m variable updated to be the differences between the two fields. Adapt some of the code from the previous exercise to plot the difference field (and use the supplied Contouring icons pos_shade and neg_shade).

Note that in these netCDF files, the data values are scaled in the netCDF file.

Other ASCII Data

ASCII Table Data

...

Have a look at the macro netcdf_info in the solutions folder to see how to extract meta-data from the netCDF file.