Versions Compared

Key

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

...

FunctionObject method

# find the locations where t is > 310K

t = mv.retrieve(param = 't', grid = [1,1])
hot = t > 310
locs = find(hot, 1)

# find the locations where t is > 310K

t = mv.retrieve(param = 't', grid = [1,1])
hot = t > 310
locs = hot.find(1)

Calling user-defined Macro functions from Python

Any user-defined Macro function can be called from Python as long as it satisfies both of these criteria:

  1. the function must reside in a file of the same name as the function
  2. the file must be in a directory listed in the METVIEW_MACRO_PATH environment variable; this variable can be modified by the user, but by default it will include $HOME/metview/System/Macros.

If these are satisfied, then the function may be invoked using the call() command as shown here:

Code Block
languagepy
import metview as mv
mv.call('my_func', 4, 1, 'my_string_arg'))

The first argument is the name of the function, the subsequent arguments will be passed to the function.