Python

The standard module for visualization in Python is Matplotlib. Matplotlib is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. matplotlib can be used in python scripts, the python and ipython shell (ala MATLAB®* or Mathematica®), web application servers, and six graphical user interface toolkits.

matplotlib is free available: http://matplotlib.org/

For Python 3 Cartopy (https://pypi.org/project/Cartopy/), a cartographic python library with Matplotlib support for visualization, is used instead of Basemap.

How to use the example scripts at DKRZ

On Levante you have to load the python 3 module first:

module load python3/2022.01-gcc-11.2.0

The module python includes the matplotlib package already.

Copy the example script you want to use to your work space. Not all example data sets are available but most files are stored in

/work/kv0653/NCL/data_examples

Modify and execute the script:

python <script name>

For example

python matplotlib_contour_filled.py

Note

DKRZ has created a GitHub Python repository named PyEarthScience that contains Visualization, Analysis and IO example scripts. The sence of the repository is to establish a kind of a platform for Earth scientists for searching and representing Python scripts, tutorials, and packages using PyNGL/PYNIO, matplotlib, cartopy, xarray, etc.

https://github.com/KMFleischer/PyEarthScience/

Categories

Maps

map resources, functions, sub-regions

XY-plots

1D data line plots, timeseries, scatter plots, statistics

Contours

2D data line, color fill (shaded), fill pattern, overlays

Vectors

2D vector data, e.g. wind components uv

Overlays

contour line on filled contour plot, vector on contours, different grid resolutions

Grids

rectilinear, curvilinear, unstructured grids

Special plots

miscellaneous plots

Maps

Matplotlib maps 1 example w200

Matplotlib maps 2 example w200

Projections

XY-plots

Matplotlib xy-plot example w200

xy-plot

Matplotlib xy-plot example 2 w200

multi-timeseries plot

Matplotlib different anomalies w200

different anomalies plot

Contours

Matplotlib contour lines example w200

Contour line plot

Matplotlib contour filled example w200

Contour fill plot

Vectors

Matplotlib vectors w200

Vector plot

Matplotlib vectors on contour fill w200

Vectors on contour fill plot

Overlays

Matplotlib overlays w200 Overlay regional on global grid

Grids

Matplotlib curvilinear rotated grid w200

Curvilinear grid with rotated pole e.g. CORDEX EUR-11

Matplotlib ICON contour plot w200

ICON contour plot

Matplotlib ICON triangles py2 w200

ICON triangles (Python 2)

Matplotlib ICON triangles py3 w200

ICON triangles (Python 3)

Matplotlib ICON triangles with vectors py3 w200

ICON triangles with vectors (Python 3)

Matplotlib ICON R02B09 datashader w200

ICON R02B09 make it fast

Special plots

Matplotlib wind speed direction polar projection w200

Wind speed and direction with polar projection

Matplotlib wind speed direction polar projection count w200

Wind speed and direction with polar projection colored by frequency

Matplotlib high res bck image w200

High resolution background image

Matplotlib quality points 1 w200 Matplotlib quality points 2 w200

Box plot and points plot sized by quality factor

Matplotlib arctic death spiral w200

Sea Ice Spiral plot based on ‘Arctic Death Spiral’ from Andy Lee Robinson