Scroll pdf ignore | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
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.
...
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.
...
Panel |
---|
Returns a copy of the input fieldset (first argument) with zero or more of its values replaced with grib missing value indicators. If the second argument is a number, then any value equal to that number in the input fieldset is replaced with the missing value indicator. If the second argument is another fieldset with the same number of fields as the first fieldset, then the result takes the arrangement of missing values from the second fieldset. If the second argument is another fieldset with one field, the arrangement of missing values from that field are copied into all fields of the output fieldset. See also
Returns a copy of the input fieldset (first argument) with all of its missing values replaced with the number specified by the second argument. See also |
...
Compute the mean value over a sub-area rather than over the whole globe. Note that the integrate()
function can do this:
Code Block | ||
---|---|---|
| ||
europe = [75,-12.5,35,42.5]
x = integrate(field,europe) |
There is another function, average()
, to compute the mean value of a field. Find its documentation to see what the difference is. How different is the result?
Cheat: the integrate()
function can accept an additional argument of a field of 1s and 0s, and will only compute the mean value where this field has 1s. Using this functionality, you can avoid using the bitmap functions altogether, at least in this particular computation! See Fieldset Functions.
The Land-sea mask
Write a line of macro code which will compute the number of land points in the lsm
variable. There are two methods:
accumulate()
- adds all the values in a field to return a single number; this should do the job, since the values are 1 over land and 0 over seadatainfo()
- returns information about the number of points and missing values in the field