Versions Compared

Key

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

...

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
languagepy
result = integrate(....)
if result = nil then
    print('No valid data points')
else
    print('Mean value: ', result)
end if

 

Extra Work

Computing different means

...