...
The code should in fact only be a few lines. All of Metview's functions will respect missing values and treat them properly.
As an experiment, try setting all the values to missing values (just change the threshold in the expression "(lsm >= 0.5)
"). The integrate() function should now return nil
as its result. This is a special variable in Macro, and trying to do anything with it (e.g. multiplying it by a number) will result in an error. To make your code bullet-proof, you can test for it with something like this:
Code Block | ||
---|---|---|
| ||
result = integrate(....)
if result = nil then
print('No valid data points')
else
print('Mean value: ', result)
end if |
Extra Work
Computing different means
...