Metview's documentation is now on readthedocs!

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Overview

Fields and observations can often contain missing values - it can be important to understand the implications of these, and also how to use them to remove unwanted data points. Using a mask of missing values can enable Metview to perform computations on a specific subset of points.

XXXX Download data

Computing the mean surface temperature over land

XXXXXXX image

As an example, we will use a land-sea mask field as the basis of performing a computation on only the land points, excluding all sea points.

Visualise the supplied land_sea_mask.grib icon using the gridvals contour icon. 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.

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

lsm = read('land_sea_mask.grib')
lsm = (lsm >= 0.5)

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). Visualise the result to confirm this change.

Now we want to read t2m.grib and 'deactivate' the points where the land-sea mask is 0 (the sea points).

When performing computations between two fields, they must be on the same grid, with the same number of points. If this is not the case, you will need to use interpolation to transform one field onto the other's grid. See Processing Data.

 

One way to do this could be to simply multiply 

 

  • No labels