Versions Compared

Key

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

...

Visualise the supplied land_sea_mask.grib icon using the grid_shade icon. This Contouring icon is set up to shade the grid points exactly as they are in the data with no interpolation. To help illustrate what's going on, we've chosen low-resolution fields - this one is 4x4 degrees. The values are 0 over the sea, 1 over the land and somewhere between 0 and 1 on points which are close to both sea and land. Before we can use this field as a mask, we must do something with those "in-between" points and decide whether they count as land or sea! Let's say that a value of 0.5 or more is land. The plots above show the 'raw' land-sea field and then the 'cleaned' one.

Create a new Macro icon and rename it land_points. Type the following code:

...

The variable lsm has been replaced with a stricter mask. Applying boolean operators such as < and > returns a result consisting entirely of 1s (where the grid values pass the test) and 0s (where the grid values fail the test). Plot the result with grid_shade to confirm this change. The plots above show the 'raw' land-sea field and then the 'cleaned' one.

Now we want to read t2m.grib - this contains 2 metre temperature analysis data from 5 days. Add a line of code to read this file into a new variable t2m. Compute the mean value of the points using the integrate() function. It will return a list of values - the mean value from each field.

...