Versions Compared

Key

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

...

Warning
An include statement is interpreted before the rest of the macro is executed, including lines that precede the include statement. This means that you cannot, for instance, use a dynamically generated path to find the file to be included.

Function in a User/System Library

This is the method that can be really described as building a library of functions. Its principle is very simple - place macro functions in a particular folder which is searched by the function look- up procedure so they can be called from any macro program without the need for an include statement.

In our case, simply drag the wind_speed macro icon to the folder ~/metview/System/Mac­ros. From then on you can call this function from within any of your macros. Note that this only works when the name of the macro file is the same as the name of the function it contains. Remove the include statement from your call_wind_speed macro and see if it still works (it should). If you rename the wind_speed macro, it should no longer work.

This allows you to build your own personal function library. For a function to be available to other users, you can place the macros with the functions into shared folder on the file system; all users will need to set the environment variable METVIEW_MACRO_PATH to this location before starting Metview.