Versions Compared

Key

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

Here are some different ways that you can use Metview's Python interface. Make sure you have set up your environment first.

Table of Contents

Text editor and command line

Perhaps the simplest - just use any text editor to edit the Python code and run it from the command line, e.g.

Code Block
languagebash
python3 my_metv_python_script.py

Python IDE

Python IDEs, such as PyCharm, provide an interactive environment and even debugging facilities.

Jupyter notebook

A Jupyter notebook provides an interactive workspace combining code, plots and documentation. It runs in a web browser and can be started from the command-line as follows:

...

mv.setoutput('jupyter') for inline plotsWith no setoutput command, an interactive plot window

A Metview session

A Metview Python script can be created, edited and run from within an interactive Metview session in the same way that a Metview Macro can.

From the main user interface, right-click on an empty part of the Metview desktop, select Create New Icon and choose Python Script.

You can either just start writing your Python code, or you can use Metview to help you. Any Metview icons can be dropped into Metview's Code Editor, and the corresponding Python code with will be automatically generated for you, giving a convenient way of trying things out interactively before committing them to code.

...