Plotters and formatoption of the psy-maps psyplot plugin.

Classes:

BoxBase(key[, plotter, index_in_list, ...])

Abstract base class for specifying a longitude-latitude box

CenterLat(key[, plotter, index_in_list, ...])

Set the center latitude of the plot

CenterLon(key[, plotter, index_in_list, ...])

Set the center longitude of the plot

ClipAxes(key[, plotter, index_in_list, ...])

Clip the part outside the latitudes of the map extent

CombinedMapVectorPlot(*args, **kwargs)

Choose the vector plot type

CombinedPlotter([data, ax, auto_update, ...])

Combined 2D plotter and vector plotter on a map

FieldPlotter([data, ax, auto_update, ...])

Plotter for 2D scalar fields on a map

GoogleMap(key[, plotter, index_in_list, ...])

Show a map of google on the plot.

GridBase(*args, **kwargs)

Abstract base class for x- and y- grid lines

GridColor(key[, plotter, index_in_list, ...])

Set the color of the grid

GridLabelSize(key[, plotter, index_in_list, ...])

Modify the size of the grid tick labels

GridLabels(key[, plotter, index_in_list, ...])

Display the labels of the grid

GridSettings(key[, plotter, index_in_list, ...])

Modify the settings of the grid explicitly

LSM(*args, **kwargs)

Draw the continents

LonLatBox(key[, plotter, index_in_list, ...])

Set the longitude-latitude box of the data shown

MapBackground(key[, plotter, index_in_list, ...])

The background color for the matplotlib axes.

MapDataGrid(*args, **kwargs)

Show the grid of the data

MapDensity(*args, **kwargs)

Change the density of the arrows

MapExtent(key[, plotter, index_in_list, ...])

Set the extent of the map

MapPlot2D(*args, **kwargs)

Choose how to visualize a 2-dimensional scalar data field

MapPlotter([data, ax, auto_update, project, ...])

Base plotter for visualizing data on a map

MapVectorColor(*args, **kwargs)

Set the color for the arrows

MapVectorPlot(*args, **kwargs)

Choose the vector plot type

Projection(*args, **kwargs)

Specify the projection for the plot

ProjectionBase(key[, plotter, ...])

Base class for formatoptions that uses cartopy.crs.CRS instances

StockImage(key[, plotter, index_in_list, ...])

Display a stock image on the map

Transform(key[, plotter, index_in_list, ...])

Specify the coordinate system of the data

Transpose(key[, plotter, index_in_list, ...])

Transpose the data before plotting

VectorPlotter([data, ax, auto_update, ...])

Plotter for visualizing 2-dimensional vector data on a map

XGrid(*args, **kwargs)

Draw vertical grid lines (meridians)

YGrid(*args, **kwargs)

Draw horizontal grid lines (parallels)

Functions:

degree_format()

format_lats(x, pos)

format_lons(x, pos)

shiftdata(lonsin, datain, lon_0)

Shift longitudes (and optionally data) so that they match map projection region.

class psy_maps.plotters.BoxBase(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)

Bases: Formatoption

Abstract base class for specifying a longitude-latitude box

Possible types

str

A pattern that matches any of the keys in the psyplot.rcParams 'extents.boxes' item (contains user-defined longitude-latitude boxes) or the psyplot.plotter.boxes.lonlatboxes dictionary (contains longitude-latitude boxes of different countries and continents)

[lonmin, lonmax, latmin, latmax]

The surrounding longitude-latitude that shall be used. Values can be either a float or a string as above

See also

LonLatBox, MapExtent

Methods:

lola_from_pattern(s)

Calculate the longitude-latitude box based upon a pattern

lola_from_pattern(s)

Calculate the longitude-latitude box based upon a pattern

This method uses the psyplot.rcParams 'extents.boxes' item to find longitude that match s and takes the surrounding box.

Parameters:

s (str) – The pattern to use for the keys in the psyplot.plotter.maps.lonlatboxes dictionary and the 'extents.boxes' item in the psyplot.rcParams

Returns:

float – The surrounding longitude-latitude box of all items in psyplot.rcParams['extents.boxes'] whose key match s if there was any match. Otherwise None is returned

Return type:

lonmin, lonmax, latmin, latmax or None

class psy_maps.plotters.CenterLat(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)

Bases: BoxBase

Set the center latitude of the plot

Parameters:
  • None – Let the lonlatbox formatoption determine the center

  • float – Specifiy the center manually

  • str – A pattern that matches any of the keys in the psyplot.rcParams 'extents.boxes' item (contains user-defined longitude-latitude boxes) or the psyplot.plotter.boxes.lonlatboxes dictionary (contains longitude-latitude boxes of different countries and continents)

Attributes:

dependencies

list of str.

lonlatbox

lonlatbox Formatoption instance in the plotter

name

str.

priority

int.

requires_clearing

bool.

Methods:

update(value)

Method that is call to update the formatoption on the axes

dependencies = ['lonlatbox']

list of str. List of formatoptions that force an update of this formatoption if they are updated.

property lonlatbox

lonlatbox Formatoption instance in the plotter

name = 'Latitude of the center of the plot'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

priority = 30

int. Priority value of the the formatoption determining when the formatoption is updated.

  • 10: at the end (for labels, etc.)

  • 20: before the plotting (e.g. for colormaps, etc.)

  • 30: before loading the data (e.g. for lonlatbox)

requires_clearing = True

bool. True if an update of this formatoption requires a clearing of the axes and reinitialization of the plot

update(value)

Method that is call to update the formatoption on the axes

Parameters:

value – Value to update

class psy_maps.plotters.CenterLon(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)

Bases: BoxBase

Set the center longitude of the plot

Parameters:
  • None – Let the lonlatbox formatoption determine the center

  • float – Specifiy the center manually

  • str – A pattern that matches any of the keys in the psyplot.rcParams 'extents.boxes' item (contains user-defined longitude-latitude boxes) or the psyplot.plotter.boxes.lonlatboxes dictionary (contains longitude-latitude boxes of different countries and continents)

Attributes:

dependencies

list of str.

lonlatbox

lonlatbox Formatoption instance in the plotter

name

str.

priority

int.

requires_clearing

bool.

Methods:

update(value)

Method that is call to update the formatoption on the axes

dependencies = ['lonlatbox']

list of str. List of formatoptions that force an update of this formatoption if they are updated.

property lonlatbox

lonlatbox Formatoption instance in the plotter

name = 'Longitude of the center of the plot'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

priority = 30

int. Priority value of the the formatoption determining when the formatoption is updated.

  • 10: at the end (for labels, etc.)

  • 20: before the plotting (e.g. for colormaps, etc.)

  • 30: before loading the data (e.g. for lonlatbox)

requires_clearing = True

bool. True if an update of this formatoption requires a clearing of the axes and reinitialization of the plot

update(value)

Method that is call to update the formatoption on the axes

Parameters:

value – Value to update

class psy_maps.plotters.ClipAxes(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)

Bases: Formatoption

Clip the part outside the latitudes of the map extent

Possible types

None

Clip if all longitudes are shown (i.e. the extent goes from -180 to 180) and the projection is orthographic or stereographic

bool

True, clip, else, don’t

Notes

If the plot is clipped. You might need to update with replot=True!

Attributes:

connections

list of str.

lonlatbox

lonlatbox Formatoption instance in the plotter

map_extent

map_extent Formatoption instance in the plotter

priority

int.

Methods:

draw_circle()

remove()

Method to remove the effects of this formatoption

update(value)

Method that is call to update the formatoption on the axes

connections = ['lonlatbox', 'map_extent']

list of str. Connections to other formatoptions that are (different from dependencies and children) not important for the update process

draw_circle()
property lonlatbox

lonlatbox Formatoption instance in the plotter

property map_extent

map_extent Formatoption instance in the plotter

priority = 20

int. Priority value of the the formatoption determining when the formatoption is updated.

  • 10: at the end (for labels, etc.)

  • 20: before the plotting (e.g. for colormaps, etc.)

  • 30: before loading the data (e.g. for lonlatbox)

remove()

Method to remove the effects of this formatoption

This method is called when the axes is cleared due to a formatoption with requires_clearing set to True. You don’t necessarily have to implement this formatoption if your plot results are removed by the usual matplotlib.axes.Axes.clear() method.

update(value)

Method that is call to update the formatoption on the axes

Parameters:

value – Value to update

class psy_maps.plotters.CombinedMapVectorPlot(*args, **kwargs)

Bases: MapVectorPlot

Choose the vector plot type

Possible types

str

Plot types can be either

quiver

to make a quiver plot

stream

to make a stream plot

Attributes:

arrowsize

arrowsize Formatoption instance in the plotter

arrowstyle

arrowstyle Formatoption instance in the plotter

bounds

bounds Formatoption instance in the plotter

clat

clat Formatoption instance in the plotter

clip

clip Formatoption instance in the plotter

clon

clon Formatoption instance in the plotter

cmap

cmap Formatoption instance in the plotter

color

color Formatoption instance in the plotter

data_dependent

bool or a callable.

density

density Formatoption instance in the plotter

linewidth

linewidth Formatoption instance in the plotter

lonlatbox

lonlatbox Formatoption instance in the plotter

transform

transform Formatoption instance in the plotter

transpose

transpose Formatoption instance in the plotter

Methods:

update(*args, **kwargs)

Method that is call to update the formatoption on the axes

property arrowsize

arrowsize Formatoption instance in the plotter

property arrowstyle

arrowstyle Formatoption instance in the plotter

property bounds

bounds Formatoption instance in the plotter

property clat

clat Formatoption instance in the plotter

property clip

clip Formatoption instance in the plotter

property clon

clon Formatoption instance in the plotter

property cmap

cmap Formatoption instance in the plotter

property color

color Formatoption instance in the plotter

data_dependent = True

bool or a callable. This attribute indicates whether this Formatoption depends on the data and should be updated if the data changes. If it is a callable, it must accept one argument: the new data. (Note: This is automatically set to True for plot formatoptions)

property density

density Formatoption instance in the plotter

property linewidth

linewidth Formatoption instance in the plotter

property lonlatbox

lonlatbox Formatoption instance in the plotter

property transform

transform Formatoption instance in the plotter

property transpose

transpose Formatoption instance in the plotter

update(*args, **kwargs)

Method that is call to update the formatoption on the axes

Parameters:

value – Value to update

class psy_maps.plotters.CombinedPlotter(data=None, ax=None, auto_update=None, project=None, draw=False, make_plot=True, clear=False, enable_post=False, **kwargs)

Bases: CombinedBase, FieldPlotter, VectorPlotter

Combined 2D plotter and vector plotter on a map

See also

psyplot.plotter.simple.CombinedSimplePlotter

for a simple version of this class

FieldPlotter, VectorPlotter

Attributes:

density

Change the density of the arrows

plot

Choose how to visualize a 2-dimensional scalar data field

vplot

Choose the vector plot type

xgrid

Draw vertical grid lines (meridians)

ygrid

Draw horizontal grid lines (parallels)

density

Change the density of the arrows

Possible types

float

Scales the density of the arrows in x- and y-direction (1.0 means no scaling)

tuple (x, y)

Defines the scaling in x- and y-direction manually

plot

Choose how to visualize a 2-dimensional scalar data field

Possible types

None

Don’t make any plotting

‘mesh’

Use the matplotlib.pyplot.pcolormesh() function to make the plot or the matplotlib.pyplot.tripcolor() for an unstructered grid

‘poly’

Draw each polygon indivually. This method is used by default for unstructured grids. If there are no grid cell boundaries in the dataset, we will interpolate them

‘contourf’

Make a filled contour plot using the matplotlib.pyplot.contourf() function. The levels for the contour plot are controlled by the levels formatoption

‘contour’

Same a 'contourf', but does not make a filled contour plot, only lines.

vplot

Choose the vector plot type

Possible types

str

Plot types can be either

quiver

to make a quiver plot

stream

to make a stream plot

xgrid

Draw vertical grid lines (meridians)

This formatoption specifies at which longitudes to draw the meridians.

Possible types

None

Don’t draw gridlines (same as False)

bool

True: draw gridlines and determine position automatically False: don’t draw gridlines

numeric array

specifies the ticks manually

str or list [str, …]

A list of the below mentioned values of the mapping like [method, N, percmin, percmax, vmin, vmax], where only the first one is absolutely necessary

dict

Automatically determine the ticks corresponding to the data. The mapping can have the following keys, but only method is not optional.

N

An integer describing the number of boundaries (or ticks per power of ten, see log and symlog above)

percmin

The percentile to use for the minimum (by default, 0, i.e. the minimum of the array)

percmax

The percentile to use for the maximum (by default, 100, i.e. the maximum of the array)

vmin

The minimum to use (in which case it is not calculated from the specified method)

vmax

The maximum to use (in which case it is not calculated from the specified method)

method

A string that defines how minimum and maximum shall be set. This argument is not optional and can be one of the following:

data

plot the ticks exactly where the data is.

mid

plot the ticks in the middle of the data.

rounded

Sets the minimum and maximum of the ticks to the rounded data minimum or maximum. Ticks are rounded to the next 0.5 value with to the difference between data max- and minimum. The minimal tick will always be lower or equal than the data minimum, the maximal tick will always be higher or equal than the data maximum.

roundedsym

Same as rounded above but the ticks are chose such that they are symmetric around zero

minmax

Uses the minimum as minimal tick and maximum as maximal tick

sym

Same as minmax but symmetric around zero

log

Use logarithmic bounds. In this case, the given number N determines the number of bounds per power of tenth (i.e. N == 2 results in something like 1.0, 5.0, 10.0, 50.0, etc., If this second number is None, then it will be chosen such that we have around 11 boundaries but at least one per power of ten.

symlog

The same as log but symmetric around 0. If the number N is None, then we have around 12 boundaries but at least one per power of ten

int

Specifies how many ticks to use with the 'rounded' option. I.e. if integer i, then this is the same as ['rounded', i].

See also

ygrid, grid_color, grid_labels

ygrid

Draw horizontal grid lines (parallels)

This formatoption specifies at which latitudes to draw the parallels.

Possible types

None

Don’t draw gridlines (same as False)

bool

True: draw gridlines and determine position automatically False: don’t draw gridlines

numeric array

specifies the ticks manually

str or list [str, …]

A list of the below mentioned values of the mapping like [method, N, percmin, percmax, vmin, vmax], where only the first one is absolutely necessary

dict

Automatically determine the ticks corresponding to the data. The mapping can have the following keys, but only method is not optional.

N

An integer describing the number of boundaries (or ticks per power of ten, see log and symlog above)

percmin

The percentile to use for the minimum (by default, 0, i.e. the minimum of the array)

percmax

The percentile to use for the maximum (by default, 100, i.e. the maximum of the array)

vmin

The minimum to use (in which case it is not calculated from the specified method)

vmax

The maximum to use (in which case it is not calculated from the specified method)

method

A string that defines how minimum and maximum shall be set. This argument is not optional and can be one of the following:

data

plot the ticks exactly where the data is.

mid

plot the ticks in the middle of the data.

rounded

Sets the minimum and maximum of the ticks to the rounded data minimum or maximum. Ticks are rounded to the next 0.5 value with to the difference between data max- and minimum. The minimal tick will always be lower or equal than the data minimum, the maximal tick will always be higher or equal than the data maximum.

roundedsym

Same as rounded above but the ticks are chose such that they are symmetric around zero

minmax

Uses the minimum as minimal tick and maximum as maximal tick

sym

Same as minmax but symmetric around zero

log

Use logarithmic bounds. In this case, the given number N determines the number of bounds per power of tenth (i.e. N == 2 results in something like 1.0, 5.0, 10.0, 50.0, etc., If this second number is None, then it will be chosen such that we have around 11 boundaries but at least one per power of ten.

symlog

The same as log but symmetric around 0. If the number N is None, then we have around 12 boundaries but at least one per power of ten

int

Specifies how many ticks to use with the 'rounded' option. I.e. if integer i, then this is the same as ['rounded', i].

See also

xgrid, grid_color, grid_labels

class psy_maps.plotters.FieldPlotter(data=None, ax=None, auto_update=None, project=None, draw=False, make_plot=True, clear=False, enable_post=False, **kwargs)

Bases: Simple2DBase, MapPlotter, BasePlotter

Plotter for 2D scalar fields on a map

Attributes:

interp_bounds

Interpolate grid cell boundaries for 2D plots

levels

The levels for the contour plot

plot

Choose how to visualize a 2-dimensional scalar data field

interp_bounds

Interpolate grid cell boundaries for 2D plots

This formatoption can be used to tell enable and disable the interpolation of grid cell boundaries. Usually, netCDF files only contain the centered coordinates. In this case, we interpolate the boundaries between the grid cell centers.

Possible types

None

Interpolate the boundaries, except for circumpolar grids

bool

If True (the default), the grid cell boundaries are inter- and extrapolated. Otherwise, if False, the coordinate centers are used and the default behaviour of matplotlib cuts of the most outer row and column of the 2D-data. Note that this results in a slight shift of the data

levels

The levels for the contour plot

This formatoption sets the levels for the filled contour plot and only has an effect if the plot Formatoption is set to 'contourf'

Possible types

None

Use the settings from the bounds formatoption and if this does not specify boundaries, use 11

numeric array

specifies the ticks manually

str or list [str, …]

A list of the below mentioned values of the mapping like [method, N, percmin, percmax, vmin, vmax], where only the first one is absolutely necessary

dict

Automatically determine the ticks corresponding to the data. The mapping can have the following keys, but only method is not optional.

N

An integer describing the number of boundaries (or ticks per power of ten, see log and symlog above)

percmin

The percentile to use for the minimum (by default, 0, i.e. the minimum of the array)

percmax

The percentile to use for the maximum (by default, 100, i.e. the maximum of the array)

vmin

The minimum to use (in which case it is not calculated from the specified method)

vmax

The maximum to use (in which case it is not calculated from the specified method)

method

A string that defines how minimum and maximum shall be set. This argument is not optional and can be one of the following:

data

plot the ticks exactly where the data is.

mid

plot the ticks in the middle of the data.

rounded

Sets the minimum and maximum of the ticks to the rounded data minimum or maximum. Ticks are rounded to the next 0.5 value with to the difference between data max- and minimum. The minimal tick will always be lower or equal than the data minimum, the maximal tick will always be higher or equal than the data maximum.

roundedsym

Same as rounded above but the ticks are chose such that they are symmetric around zero

minmax

Uses the minimum as minimal tick and maximum as maximal tick

sym

Same as minmax but symmetric around zero

log

Use logarithmic bounds. In this case, the given number N determines the number of bounds per power of tenth (i.e. N == 2 results in something like 1.0, 5.0, 10.0, 50.0, etc., If this second number is None, then it will be chosen such that we have around 11 boundaries but at least one per power of ten.

symlog

The same as log but symmetric around 0. If the number N is None, then we have around 12 boundaries but at least one per power of ten

int

Specifies how many ticks to use with the 'rounded' option. I.e. if integer i, then this is the same as ['rounded', i].

plot

Choose how to visualize a 2-dimensional scalar data field

Possible types

None

Don’t make any plotting

‘mesh’

Use the matplotlib.pyplot.pcolormesh() function to make the plot or the matplotlib.pyplot.tripcolor() for an unstructered grid

‘poly’

Draw each polygon indivually. This method is used by default for unstructured grids. If there are no grid cell boundaries in the dataset, we will interpolate them

‘contourf’

Make a filled contour plot using the matplotlib.pyplot.contourf() function. The levels for the contour plot are controlled by the levels formatoption

‘contour’

Same a 'contourf', but does not make a filled contour plot, only lines.

class psy_maps.plotters.GoogleMap(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)

Bases: Formatoption

Show a map of google on the plot.

Possible types

None

Do not show anything

int

The level of detail to show (usually between 6 and 9, must be greater than or equal to 0).

Attributes:

data_dependent

bool or a callable.

dependencies

list of str.

map_extent

map_extent Formatoption instance in the plotter

Methods:

remove()

Method to remove the effects of this formatoption

update(value)

Draw or remove the image from the plot.

data_dependent = True

bool or a callable. This attribute indicates whether this Formatoption depends on the data and should be updated if the data changes. If it is a callable, it must accept one argument: the new data. (Note: This is automatically set to True for plot formatoptions)

dependencies = ['map_extent']

list of str. List of formatoptions that force an update of this formatoption if they are updated.

property map_extent

map_extent Formatoption instance in the plotter

remove()

Method to remove the effects of this formatoption

This method is called when the axes is cleared due to a formatoption with requires_clearing set to True. You don’t necessarily have to implement this formatoption if your plot results are removed by the usual matplotlib.axes.Axes.clear() method.

update(value)

Draw or remove the image from the plot.

class psy_maps.plotters.GridBase(*args, **kwargs)

Bases: DataTicksCalculator

Abstract base class for x- and y- grid lines

Possible types

None

Don’t draw gridlines (same as False)

bool

True: draw gridlines and determine position automatically False: don’t draw gridlines

numeric array

specifies the ticks manually

str or list [str, …]

A list of the below mentioned values of the mapping like [method, N, percmin, percmax, vmin, vmax], where only the first one is absolutely necessary

dict

Automatically determine the ticks corresponding to the data. The mapping can have the following keys, but only method is not optional.

N

An integer describing the number of boundaries (or ticks per power of ten, see log and symlog above)

percmin

The percentile to use for the minimum (by default, 0, i.e. the minimum of the array)

percmax

The percentile to use for the maximum (by default, 100, i.e. the maximum of the array)

vmin

The minimum to use (in which case it is not calculated from the specified method)

vmax

The maximum to use (in which case it is not calculated from the specified method)

method

A string that defines how minimum and maximum shall be set. This argument is not optional and can be one of the following:

data

plot the ticks exactly where the data is.

mid

plot the ticks in the middle of the data.

rounded

Sets the minimum and maximum of the ticks to the rounded data minimum or maximum. Ticks are rounded to the next 0.5 value with to the difference between data max- and minimum. The minimal tick will always be lower or equal than the data minimum, the maximal tick will always be higher or equal than the data maximum.

roundedsym

Same as rounded above but the ticks are chose such that they are symmetric around zero

minmax

Uses the minimum as minimal tick and maximum as maximal tick

sym

Same as minmax but symmetric around zero

log

Use logarithmic bounds. In this case, the given number N determines the number of bounds per power of tenth (i.e. N == 2 results in something like 1.0, 5.0, 10.0, 50.0, etc., If this second number is None, then it will be chosen such that we have around 11 boundaries but at least one per power of ten.

symlog

The same as log but symmetric around 0. If the number N is None, then we have around 12 boundaries but at least one per power of ten

int

Specifies how many ticks to use with the 'rounded' option. I.e. if integer i, then this is the same as ['rounded', i].

Attributes:

axis

The axis string

connections

list of str.

dependencies

list of str.

grid_color

grid_color Formatoption instance in the plotter

grid_labels

grid_labels Formatoption instance in the plotter

grid_settings

grid_settings Formatoption instance in the plotter

lonlatbox

lonlatbox Formatoption instance in the plotter

map_extent

map_extent Formatoption instance in the plotter

plot

plot Formatoption instance in the plotter

projection

projection Formatoption instance in the plotter

transform

transform Formatoption instance in the plotter

Methods:

get_fmt_widget(parent, project)

Get a widget to update the formatoption in the GUI

get_kwargs(loc)

remove()

Method to remove the effects of this formatoption

update(value)

Method that is call to update the formatoption on the axes

abstract property axis

The axis string

connections = ['plot']

list of str. Connections to other formatoptions that are (different from dependencies and children) not important for the update process

dependencies = ['transform', 'grid_labels', 'grid_color', 'grid_settings', 'projection', 'lonlatbox', 'map_extent']

list of str. List of formatoptions that force an update of this formatoption if they are updated.

get_fmt_widget(parent, project)

Get a widget to update the formatoption in the GUI

This method should return a QWidget that is loaded by the psyplot-gui when the formatoption is selected in the psyplot_gui.main.Mainwindow.fmt_widget. It should call the insert_text() method when the update text for the formatoption should be changed.

Parameters:
Returns:

The widget to control the formatoption

Return type:

PyQt5.QtWidgets.QWidget

get_kwargs(loc)
property grid_color

grid_color Formatoption instance in the plotter

property grid_labels

grid_labels Formatoption instance in the plotter

property grid_settings

grid_settings Formatoption instance in the plotter

property lonlatbox

lonlatbox Formatoption instance in the plotter

property map_extent

map_extent Formatoption instance in the plotter

property plot

plot Formatoption instance in the plotter

property projection

projection Formatoption instance in the plotter

remove()

Method to remove the effects of this formatoption

This method is called when the axes is cleared due to a formatoption with requires_clearing set to True. You don’t necessarily have to implement this formatoption if your plot results are removed by the usual matplotlib.axes.Axes.clear() method.

property transform

transform Formatoption instance in the plotter

update(value)

Method that is call to update the formatoption on the axes

Parameters:

value – Value to update

class psy_maps.plotters.GridColor(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)

Bases: Formatoption

Set the color of the grid

Possible types

None

Choose the default line color

color

Any valid color for matplotlib (see the matplotlib.pyplot.plot() documentation)

See also

grid_settings, grid_labels, grid_labelsize, xgrid, ygrid

Attributes:

connections

list of str.

name

str.

xgrid

xgrid Formatoption instance in the plotter

ygrid

ygrid Formatoption instance in the plotter

Methods:

update(value)

Method that is call to update the formatoption on the axes

connections = ['xgrid', 'ygrid']

list of str. Connections to other formatoptions that are (different from dependencies and children) not important for the update process

name = 'Color of the latitude-longitude grid'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

update(value)

Method that is call to update the formatoption on the axes

Parameters:

value – Value to update

property xgrid

xgrid Formatoption instance in the plotter

property ygrid

ygrid Formatoption instance in the plotter

class psy_maps.plotters.GridLabelSize(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)

Bases: Formatoption

Modify the size of the grid tick labels

Possible types

float

The absolute font size in points (e.g., 12)

string

Strings might be ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’.

See also

grid_color, grid_labels, xgrid, ygrid, grid_settings

Attributes:

dependencies

list of str.

name

str.

xgrid

xgrid Formatoption instance in the plotter

ygrid

ygrid Formatoption instance in the plotter

Methods:

update(value)

Method that is call to update the formatoption on the axes

dependencies = ['xgrid', 'ygrid']

list of str. List of formatoptions that force an update of this formatoption if they are updated.

name = 'Label size of the latitude-longitude grid'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

update(value)

Method that is call to update the formatoption on the axes

Parameters:

value – Value to update

property xgrid

xgrid Formatoption instance in the plotter

property ygrid

ygrid Formatoption instance in the plotter

class psy_maps.plotters.GridLabels(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)

Bases: Formatoption

Display the labels of the grid

Possible types

None

Grid labels are draw if possible

bool

If True, labels are drawn and if this is not possible, a warning is raised

See also

grid_color, grid_settings, grid_labelsize, xgrid, ygrid

Attributes:

connections

list of str.

dependencies

list of str.

name

str.

projection

projection Formatoption instance in the plotter

transform

transform Formatoption instance in the plotter

xgrid

xgrid Formatoption instance in the plotter

ygrid

ygrid Formatoption instance in the plotter

Methods:

update(value)

Method that is call to update the formatoption on the axes

connections = ['xgrid', 'ygrid']

list of str. Connections to other formatoptions that are (different from dependencies and children) not important for the update process

dependencies = ['projection', 'transform']

list of str. List of formatoptions that force an update of this formatoption if they are updated.

name = 'Labels of the latitude-longitude grid'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

property projection

projection Formatoption instance in the plotter

property transform

transform Formatoption instance in the plotter

update(value)

Method that is call to update the formatoption on the axes

Parameters:

value – Value to update

property xgrid

xgrid Formatoption instance in the plotter

property ygrid

ygrid Formatoption instance in the plotter

class psy_maps.plotters.GridSettings(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)

Bases: DictFormatoption

Modify the settings of the grid explicitly

Possible types

dict

Items may be any key-value-pair of the matplotlib.collections.LineCollection class

See also

grid_color, grid_labels, grid_labelsize, xgrid, ygrid

Attributes:

children

list of str.

connections

list of str.

grid_color

grid_color Formatoption instance in the plotter

grid_labels

grid_labels Formatoption instance in the plotter

name

str.

xgrid

xgrid Formatoption instance in the plotter

ygrid

ygrid Formatoption instance in the plotter

Methods:

set_value(value[, validate, todefault])

Set (and validate) the value in the plotter

update(value)

Method that is call to update the formatoption on the axes

children = ['grid_labels', 'grid_color']

list of str. List of formatoptions that have to be updated before this one is updated. Those formatoptions are only updated if they exist in the update parameters.

connections = ['xgrid', 'ygrid']

list of str. Connections to other formatoptions that are (different from dependencies and children) not important for the update process

property grid_color

grid_color Formatoption instance in the plotter

property grid_labels

grid_labels Formatoption instance in the plotter

name = 'Line properties of the latitude-longitude grid'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

set_value(value, validate=True, todefault=False)

Set (and validate) the value in the plotter

Parameters:
  • value – Value to set

  • validate (bool) – if True, validate the value before it is set

  • todefault (bool) – True if the value is updated to the default value

Notes

  • If the current value in the plotter is None, then it will be set with the given value, otherwise the current value in the plotter is updated

  • If the value is an empty dictionary, the value in the plotter is cleared

update(value)

Method that is call to update the formatoption on the axes

Parameters:

value – Value to update

property xgrid

xgrid Formatoption instance in the plotter

property ygrid

ygrid Formatoption instance in the plotter

class psy_maps.plotters.LSM(*args, **kwargs)

Bases: Formatoption

Draw the continents

Possible types

bool

True: draw the coastlines with a line width of 1 False: don’t draw anything

float

Specifies the linewidth of the coastlines

str

The resolution of the land-sea mask (see the cartopy.mpl.geoaxes.GeoAxesSubplot.coastlines() method. Must be one of ('110m', '50m', '10m').

list [str or bool, float]

The resolution and the linewidth

dict

A dictionary with any of the following keys

coast

The color for the coastlines

land

The fill color for the continents

ocean

The fill color for the oceans

res

The resolution (see above)

linewidth

The linewidth of the coastlines (see above)

Attributes:

background

background Formatoption instance in the plotter

dependencies

list of str.

lsm

name

str.

Methods:

draw_all(land, ocean, coast[, res, linewidth])

draw_coast(coast[, res, linewidth])

draw_land(land[, res])

draw_land_coast(land, coast[, res, linewidth])

draw_land_ocean(land, ocean[, res])

draw_ocean(ocean[, res])

draw_ocean_coast(ocean, coast[, res, linewidth])

get_fmt_widget(parent, project)

Get a widget to update the formatoption in the GUI

remove()

Method to remove the effects of this formatoption

update(value)

Method that is call to update the formatoption on the axes

property background

background Formatoption instance in the plotter

dependencies = ['background']

list of str. List of formatoptions that force an update of this formatoption if they are updated.

draw_all(land, ocean, coast, res='110m', linewidth=1)
draw_coast(coast, res='110m', linewidth=1.0)
draw_land(land, res='110m')
draw_land_coast(land, coast, res='110m', linewidth=1.0)
draw_land_ocean(land, ocean, res='110m')
draw_ocean(ocean, res='110m')
draw_ocean_coast(ocean, coast, res='110m', linewidth=1.0)
get_fmt_widget(parent, project)

Get a widget to update the formatoption in the GUI

This method should return a QWidget that is loaded by the psyplot-gui when the formatoption is selected in the psyplot_gui.main.Mainwindow.fmt_widget. It should call the insert_text() method when the update text for the formatoption should be changed.

Parameters:
Returns:

The widget to control the formatoption

Return type:

PyQt5.QtWidgets.QWidget

property lsm
name = 'Land-Sea mask'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

remove()

Method to remove the effects of this formatoption

This method is called when the axes is cleared due to a formatoption with requires_clearing set to True. You don’t necessarily have to implement this formatoption if your plot results are removed by the usual matplotlib.axes.Axes.clear() method.

update(value)

Method that is call to update the formatoption on the axes

Parameters:

value – Value to update

class psy_maps.plotters.LonLatBox(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)

Bases: BoxBase

Set the longitude-latitude box of the data shown

This formatoption extracts the data that matches the specified box.

Possible types

None

Use the full data

str

A pattern that matches any of the keys in the psyplot.rcParams 'extents.boxes' item (contains user-defined longitude-latitude boxes) or the psyplot.plotter.boxes.lonlatboxes dictionary (contains longitude-latitude boxes of different countries and continents)

[lonmin, lonmax, latmin, latmax]

The surrounding longitude-latitude that shall be used. Values can be either a float or a string as above

Notes

  • For only specifying the region of the plot, see the map_extent formatoption

  • If the coordinates are two-dimensional (e.g. for a circumpolar grid), than the data is not extracted but values outside the specified longitude-latitude box are set to NaN

See also

map_extent

Methods:

calc_lonlatbox(lon, lat[, is_unstructured])

data_dependent(data[, set_data])

bool(x) -> bool

mask_outside(data, lon, lat, lonmin, lonmax, ...)

shiftdata(lonsin, datain, lon_0)

Shift the data such that it matches the region we want to show

to_degree([units])

Converts arrays with radian units to degree

update(value)

Method that is call to update the formatoption on the axes

update_array(value, data, decoder[, base_var])

Update the given data array

Attributes:

dependencies

list of str.

lonlatbox_transformed

name

str.

priority

int.

requires_clearing

bool.

transform

transform Formatoption instance in the plotter

transpose

transpose Formatoption instance in the plotter

calc_lonlatbox(lon, lat, is_unstructured=False)
data_dependent(data, set_data=True)

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

dependencies = ['transform', 'transpose']

list of str. List of formatoptions that force an update of this formatoption if they are updated.

property lonlatbox_transformed
mask_outside(data, lon, lat, lonmin, lonmax, latmin, latmax, is_unstructured=False, decoder=None)
name = 'Longitude-Latitude box of the data'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

priority = 30

int. Priority value of the the formatoption determining when the formatoption is updated.

  • 10: at the end (for labels, etc.)

  • 20: before the plotting (e.g. for colormaps, etc.)

  • 30: before loading the data (e.g. for lonlatbox)

requires_clearing = True

bool. True if an update of this formatoption requires a clearing of the axes and reinitialization of the plot

shiftdata(lonsin, datain, lon_0)

Shift the data such that it matches the region we want to show

Parameters:

%(shiftdata.parameters)s

Notes

datain can also be multiple fields stored in a three-dimensional array. Then we shift all fields along the first dimension

to_degree(units=None, *args)

Converts arrays with radian units to degree

Parameters:
  • units (str) – if 'radian', the arrays in *args will be converted

  • *args – numpy arrays

Returns:

returns the arrays provided with *args

Return type:

list of np.ndarray

Notes

if units is 'radian', a copy of the array will be returned

property transform

transform Formatoption instance in the plotter

property transpose

transpose Formatoption instance in the plotter

update(value)

Method that is call to update the formatoption on the axes

Parameters:

value – Value to update

update_array(value, data, decoder, base_var=None)

Update the given data array

class psy_maps.plotters.MapBackground(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)

Bases: BackgroundColor

The background color for the matplotlib axes.

Possible types

‘rc’

to use matplotlibs rc params

None

to use a transparent color

color

Any possible matplotlib color

Methods:

update(value)

Method that is call to update the formatoption on the axes

update(value)

Method that is call to update the formatoption on the axes

Parameters:

value – Value to update

class psy_maps.plotters.MapDataGrid(*args, **kwargs)

Bases: DataGrid

Show the grid of the data

This formatoption shows the grid of the data (without labels)

Possible types

None

Don’t show the data grid

str

A linestyle in the form 'k-', where 'k' is the color and '-' the linestyle.

dict

any keyword arguments that are passed to the plotting function ( matplotlib.pyplot.triplot() for unstructured grids and matplotlib.pyplot.hlines() for rectilinear grids)

See also

mask_datagrid

To display cells with NaN

See also

xgrid, ygrid

Attributes:

mask_datagrid

mask_datagrid Formatoption instance in the plotter

plot

plot Formatoption instance in the plotter

transform

transform Formatoption instance in the plotter

Methods:

update(value)

Method that is call to update the formatoption on the axes

property mask_datagrid

mask_datagrid Formatoption instance in the plotter

property plot

plot Formatoption instance in the plotter

property transform

transform Formatoption instance in the plotter

update(value)

Method that is call to update the formatoption on the axes

Parameters:

value – Value to update

class psy_maps.plotters.MapDensity(*args, **kwargs)

Bases: Density

Change the density of the arrows

Possible types

float

Scales the density of the arrows in x- and y-direction (1.0 means no scaling)

tuple (x, y)

Defines the scaling in x- and y-direction manually

Attributes:

dependencies

list of str.

plot

plot Formatoption instance in the plotter

projection

projection Formatoption instance in the plotter

dependencies = ['plot', 'projection']

list of str. List of formatoptions that force an update of this formatoption if they are updated.

property plot

plot Formatoption instance in the plotter

property projection

projection Formatoption instance in the plotter

class psy_maps.plotters.MapExtent(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)

Bases: BoxBase

Set the extent of the map

Possible types

None

The map extent is specified by the data (i.e. by the lonlatbox formatoption)

‘global’

The whole globe is shown

‘data’

The extent is set to the longitude-latitute box defined by the lonlatbox formatoption

str

A pattern that matches any of the keys in the psyplot.rcParams 'extents.boxes' item (contains user-defined longitude-latitude boxes) or the psyplot.plotter.boxes.lonlatboxes dictionary (contains longitude-latitude boxes of different countries and continents)

[lonmin, lonmax, latmin, latmax]

The surrounding longitude-latitude that shall be used. Values can be either a float or a string as above

Notes

This formatoption sets the extent of the plot. For choosing the region for the data, see the lonlatbox formatoption

See also

lonlatbox

Attributes:

coords

dependencies

list of str.

lonlatbox

lonlatbox Formatoption instance in the plotter

name

str.

plot

plot Formatoption instance in the plotter

priority

int.

update_after_plot

bool.

vplot

vplot Formatoption instance in the plotter

Methods:

update(value)

Method that is call to update the formatoption on the axes

property coords
dependencies = ['lonlatbox', 'plot', 'vplot']

list of str. List of formatoptions that force an update of this formatoption if they are updated.

property lonlatbox

lonlatbox Formatoption instance in the plotter

name = 'Longitude-Latitude box of the plot'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

property plot

plot Formatoption instance in the plotter

priority = 10

int. Priority value of the the formatoption determining when the formatoption is updated.

  • 10: at the end (for labels, etc.)

  • 20: before the plotting (e.g. for colormaps, etc.)

  • 30: before loading the data (e.g. for lonlatbox)

update(value)

Method that is call to update the formatoption on the axes

Parameters:

value – Value to update

update_after_plot = True

bool. True if this formatoption needs an update after the plot has changed

property vplot

vplot Formatoption instance in the plotter

class psy_maps.plotters.MapPlot2D(*args, **kwargs)

Bases: Plot2D

Choose how to visualize a 2-dimensional scalar data field

Possible types

None

Don’t make any plotting

‘mesh’

Use the matplotlib.pyplot.pcolormesh() function to make the plot or the matplotlib.pyplot.tripcolor() for an unstructered grid

‘poly’

Draw each polygon indivually. This method is used by default for unstructured grids. If there are no grid cell boundaries in the dataset, we will interpolate them

‘contourf’

Make a filled contour plot using the matplotlib.pyplot.contourf() function. The levels for the contour plot are controlled by the levels formatoption

‘contour’

Same a 'contourf', but does not make a filled contour plot, only lines.

Methods:

add2format_coord(x, y)

Additional information for the format_coord()

remove(*args, **kwargs)

Method to remove the effects of this formatoption

Attributes:

array

The (masked) data array that is plotted

bounds

bounds Formatoption instance in the plotter

cell_nodes_x

The unstructured x-boundaries with shape (N, m) where m > 2

clip

clip Formatoption instance in the plotter

cmap

cmap Formatoption instance in the plotter

connections

list of str.

data_dependent

bool or a callable.

dependencies

list of str.

interp_bounds

interp_bounds Formatoption instance in the plotter

levels

levels Formatoption instance in the plotter

lonlatbox

lonlatbox Formatoption instance in the plotter

transform

transform Formatoption instance in the plotter

add2format_coord(x, y)

Additional information for the format_coord()

property array

The (masked) data array that is plotted

property bounds

bounds Formatoption instance in the plotter

property cell_nodes_x

The unstructured x-boundaries with shape (N, m) where m > 2

property clip

clip Formatoption instance in the plotter

property cmap

cmap Formatoption instance in the plotter

connections = ['transform', 'lonlatbox']

list of str. Connections to other formatoptions that are (different from dependencies and children) not important for the update process

data_dependent = True

bool or a callable. This attribute indicates whether this Formatoption depends on the data and should be updated if the data changes. If it is a callable, it must accept one argument: the new data. (Note: This is automatically set to True for plot formatoptions)

dependencies = ['levels', 'interp_bounds', 'clip']

list of str. List of formatoptions that force an update of this formatoption if they are updated.

property interp_bounds

interp_bounds Formatoption instance in the plotter

property levels

levels Formatoption instance in the plotter

property lonlatbox

lonlatbox Formatoption instance in the plotter

remove(*args, **kwargs)

Method to remove the effects of this formatoption

This method is called when the axes is cleared due to a formatoption with requires_clearing set to True. You don’t necessarily have to implement this formatoption if your plot results are removed by the usual matplotlib.axes.Axes.clear() method.

property transform

transform Formatoption instance in the plotter

class psy_maps.plotters.MapPlotter(data=None, ax=None, auto_update=None, project=None, draw=False, make_plot=True, clear=False, enable_post=False, **kwargs)

Bases: Base2D

Base plotter for visualizing data on a map

Attributes:

ax

Axes instance of the plot

background

The background color for the matplotlib axes.

clat

Set the center latitude of the plot

clip

Clip the part outside the latitudes of the map extent

clon

Set the center longitude of the plot

datagrid

Show the grid of the data

google_map_detail

Show a map of google on the plot.

grid_color

Set the color of the grid

grid_labels

Display the labels of the grid

grid_labelsize

Modify the size of the grid tick labels

grid_settings

Modify the settings of the grid explicitly

lonlatbox

Set the longitude-latitude box of the data shown

lsm

Draw the continents

map_extent

Set the extent of the map

projection

Specify the projection for the plot

stock_img

Display a stock image on the map

transform

Specify the coordinate system of the data

transpose

Transpose the data before plotting

xgrid

Draw vertical grid lines (meridians)

ygrid

Draw horizontal grid lines (parallels)

Methods:

convert_coordinate(coord, *variables)

Convert a coordinate from radian to degree.

fix_lonlatbox(*args, **kwargs)

Fix the data to the current extent of the axes.

fix_map_extent()

Fix the map extent to the current extent of the axes.

property ax

Axes instance of the plot

background

The background color for the matplotlib axes.

Possible types

‘rc’

to use matplotlibs rc params

None

to use a transparent color

color

Any possible matplotlib color

clat

Set the center latitude of the plot

Parameters:
  • None – Let the lonlatbox formatoption determine the center

  • float – Specifiy the center manually

  • str – A pattern that matches any of the keys in the psyplot.rcParams 'extents.boxes' item (contains user-defined longitude-latitude boxes) or the psyplot.plotter.boxes.lonlatboxes dictionary (contains longitude-latitude boxes of different countries and continents)

clip

Clip the part outside the latitudes of the map extent

Possible types

None

Clip if all longitudes are shown (i.e. the extent goes from -180 to 180) and the projection is orthographic or stereographic

bool

True, clip, else, don’t

Notes

If the plot is clipped. You might need to update with replot=True!

clon

Set the center longitude of the plot

Parameters:
  • None – Let the lonlatbox formatoption determine the center

  • float – Specifiy the center manually

  • str – A pattern that matches any of the keys in the psyplot.rcParams 'extents.boxes' item (contains user-defined longitude-latitude boxes) or the psyplot.plotter.boxes.lonlatboxes dictionary (contains longitude-latitude boxes of different countries and continents)

convert_coordinate(coord, *variables)

Convert a coordinate from radian to degree.

This method checks if the coordinate or one of the given variables has units in radian. If yes, the given coord is converted to degree.

Parameters:
  • coord (xr.Variable) – The variable to transform

  • *variables – The variables that are on the same unit as coord

Returns:

The transformed coord

Return type:

xr.Variable

datagrid

Show the grid of the data

This formatoption shows the grid of the data (without labels)

Possible types

None

Don’t show the data grid

str

A linestyle in the form 'k-', where 'k' is the color and '-' the linestyle.

dict

any keyword arguments that are passed to the plotting function ( matplotlib.pyplot.triplot() for unstructured grids and matplotlib.pyplot.hlines() for rectilinear grids)

See also

mask_datagrid

To display cells with NaN

See also

xgrid, ygrid

fix_lonlatbox(*args, **kwargs)

Fix the data to the current extent of the axes.

This method updates the map_extent formatoption to the current extent of the axes of the plotter.

Parameters:
  • fmt (dict) – Keys can be any valid formatoptions with the corresponding values (see the formatoptions attribute)

  • replot (bool) – Boolean that determines whether the data specific formatoptions shall be updated in any case or not.

  • force (str, list of str or bool) – If formatoption key (i.e. string) or list of formatoption keys, thery are definitely updated whether they changed or not. If True, all the given formatoptions in this call of the are update() method are updated

  • todefault (bool) – If True, all changed formatoptions (except the registered ones) are updated to their default value as stored in the rc attribute

  • draw (bool or None) – Boolean to control whether the figure of this array shall be drawn at the end. If None, it defaults to the ‘auto_draw’` parameter in the psyplot.rcParams dictionary

  • queues (list of Queue.Queue instances) – The queues that are passed to the psyplot.plotter.Plotter.start_update() method to ensure a thread-safe update. It can be None if only one single plotter is updated at the same time. The number of jobs that are taken from the queue is determined by the _njobs() attribute. Note that there this parameter is automatically configured when updating from a Project.

  • auto_update (bool) – Boolean determining whether or not the start_update() method is called at the end. This parameter has no effect if the no_auto_update attribute is set to True.

  • **kwargs – Any other formatoption that shall be updated (additionally to those in fmt)

fix_map_extent()

Fix the map extent to the current extent of the axes.

This method updates the map_extent formatoption to the current extent of the axes of the plotter.

google_map_detail

Show a map of google on the plot.

Possible types

None

Do not show anything

int

The level of detail to show (usually between 6 and 9, must be greater than or equal to 0).

grid_color

Set the color of the grid

Possible types

None

Choose the default line color

color

Any valid color for matplotlib (see the matplotlib.pyplot.plot() documentation)

grid_labels

Display the labels of the grid

Possible types

None

Grid labels are draw if possible

bool

If True, labels are drawn and if this is not possible, a warning is raised

grid_labelsize

Modify the size of the grid tick labels

Possible types

float

The absolute font size in points (e.g., 12)

string

Strings might be ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’.

grid_settings

Modify the settings of the grid explicitly

Possible types

dict

Items may be any key-value-pair of the matplotlib.collections.LineCollection class

lonlatbox

Set the longitude-latitude box of the data shown

This formatoption extracts the data that matches the specified box.

Possible types

None

Use the full data

str

A pattern that matches any of the keys in the psyplot.rcParams 'extents.boxes' item (contains user-defined longitude-latitude boxes) or the psyplot.plotter.boxes.lonlatboxes dictionary (contains longitude-latitude boxes of different countries and continents)

[lonmin, lonmax, latmin, latmax]

The surrounding longitude-latitude that shall be used. Values can be either a float or a string as above

Notes

  • For only specifying the region of the plot, see the map_extent formatoption

  • If the coordinates are two-dimensional (e.g. for a circumpolar grid), than the data is not extracted but values outside the specified longitude-latitude box are set to NaN

See also

map_extent

lsm

Draw the continents

Possible types

bool

True: draw the coastlines with a line width of 1 False: don’t draw anything

float

Specifies the linewidth of the coastlines

str

The resolution of the land-sea mask (see the cartopy.mpl.geoaxes.GeoAxesSubplot.coastlines() method. Must be one of ('110m', '50m', '10m').

list [str or bool, float]

The resolution and the linewidth

dict

A dictionary with any of the following keys

coast

The color for the coastlines

land

The fill color for the continents

ocean

The fill color for the oceans

res

The resolution (see above)

linewidth

The linewidth of the coastlines (see above)

map_extent

Set the extent of the map

Possible types

None

The map extent is specified by the data (i.e. by the lonlatbox formatoption)

‘global’

The whole globe is shown

‘data’

The extent is set to the longitude-latitute box defined by the lonlatbox formatoption

str

A pattern that matches any of the keys in the psyplot.rcParams 'extents.boxes' item (contains user-defined longitude-latitude boxes) or the psyplot.plotter.boxes.lonlatboxes dictionary (contains longitude-latitude boxes of different countries and continents)

[lonmin, lonmax, latmin, latmax]

The surrounding longitude-latitude that shall be used. Values can be either a float or a string as above

Notes

This formatoption sets the extent of the plot. For choosing the region for the data, see the lonlatbox formatoption

See also

lonlatbox

projection

Specify the projection for the plot

This formatoption defines the projection of the plot

Possible types

cartopy.crs.CRS

A cartopy projection instance (e.g. cartopy.crs.PlateCarree)

str

A string specifies the projection instance to use. The centered longitude and latitude are determined by the clon and clat formatoptions. Possible strings are (each standing for the specified projection)

cf

try to decode the CF-conventions

cyl

cartopy.crs.PlateCarree

robin

cartopy.crs.Robinson

moll

cartopy.crs.Mollweide

geo

cartopy.crs.Geostationary

northpole

cartopy.crs.NorthPolarStereo

southpole

cartopy.crs.SouthPolarStereo

ortho

cartopy.crs.Orthographic

stereo

cartopy.crs.Stereographic

near

cartopy.crs.NearsidePerspective

rotated

cartopy.crs.RotatedPole

The special case 'cf' tries to decode the CF-conventions in the data. If this is not possible, we assume a standard lat-lon projection ('cyl')

Warning

An update of the projection clears the axes!

stock_img

Display a stock image on the map

This formatoption uses the cartopy.mpl.geoaxes.GeoAxes.stock_img() method to display a downsampled version of the Natural Earth shaded relief raster on the map

Possible types

bool

If True, the image is displayed

transform

Specify the coordinate system of the data

This formatoption defines the coordinate system of the data (usually we expect a simple latitude longitude coordinate system)

Possible types

cartopy.crs.CRS

A cartopy projection instance (e.g. cartopy.crs.PlateCarree)

str

A string specifies the projection instance to use. The centered longitude and latitude are determined by the clon and clat formatoptions. Possible strings are (each standing for the specified projection)

cf

try to decode the CF-conventions

cyl

cartopy.crs.PlateCarree

robin

cartopy.crs.Robinson

moll

cartopy.crs.Mollweide

geo

cartopy.crs.Geostationary

northpole

cartopy.crs.NorthPolarStereo

southpole

cartopy.crs.SouthPolarStereo

ortho

cartopy.crs.Orthographic

stereo

cartopy.crs.Stereographic

near

cartopy.crs.NearsidePerspective

rotated

cartopy.crs.RotatedPole

The special case 'cf' tries to decode the CF-conventions in the data. If this is not possible, we assume a standard lat-lon projection ('cyl')

transpose

Transpose the data before plotting

This formatoption can be used in case the data order of the variable dimensions is (x, y) instead of (y, x)

xgrid

Draw vertical grid lines (meridians)

This formatoption specifies at which longitudes to draw the meridians.

Possible types

None

Don’t draw gridlines (same as False)

bool

True: draw gridlines and determine position automatically False: don’t draw gridlines

numeric array

specifies the ticks manually

str or list [str, …]

A list of the below mentioned values of the mapping like [method, N, percmin, percmax, vmin, vmax], where only the first one is absolutely necessary

dict

Automatically determine the ticks corresponding to the data. The mapping can have the following keys, but only method is not optional.

N

An integer describing the number of boundaries (or ticks per power of ten, see log and symlog above)

percmin

The percentile to use for the minimum (by default, 0, i.e. the minimum of the array)

percmax

The percentile to use for the maximum (by default, 100, i.e. the maximum of the array)

vmin

The minimum to use (in which case it is not calculated from the specified method)

vmax

The maximum to use (in which case it is not calculated from the specified method)

method

A string that defines how minimum and maximum shall be set. This argument is not optional and can be one of the following:

data

plot the ticks exactly where the data is.

mid

plot the ticks in the middle of the data.

rounded

Sets the minimum and maximum of the ticks to the rounded data minimum or maximum. Ticks are rounded to the next 0.5 value with to the difference between data max- and minimum. The minimal tick will always be lower or equal than the data minimum, the maximal tick will always be higher or equal than the data maximum.

roundedsym

Same as rounded above but the ticks are chose such that they are symmetric around zero

minmax

Uses the minimum as minimal tick and maximum as maximal tick

sym

Same as minmax but symmetric around zero

log

Use logarithmic bounds. In this case, the given number N determines the number of bounds per power of tenth (i.e. N == 2 results in something like 1.0, 5.0, 10.0, 50.0, etc., If this second number is None, then it will be chosen such that we have around 11 boundaries but at least one per power of ten.

symlog

The same as log but symmetric around 0. If the number N is None, then we have around 12 boundaries but at least one per power of ten

int

Specifies how many ticks to use with the 'rounded' option. I.e. if integer i, then this is the same as ['rounded', i].

ygrid

Draw horizontal grid lines (parallels)

This formatoption specifies at which latitudes to draw the parallels.

Possible types

None

Don’t draw gridlines (same as False)

bool

True: draw gridlines and determine position automatically False: don’t draw gridlines

numeric array

specifies the ticks manually

str or list [str, …]

A list of the below mentioned values of the mapping like [method, N, percmin, percmax, vmin, vmax], where only the first one is absolutely necessary

dict

Automatically determine the ticks corresponding to the data. The mapping can have the following keys, but only method is not optional.

N

An integer describing the number of boundaries (or ticks per power of ten, see log and symlog above)

percmin

The percentile to use for the minimum (by default, 0, i.e. the minimum of the array)

percmax

The percentile to use for the maximum (by default, 100, i.e. the maximum of the array)

vmin

The minimum to use (in which case it is not calculated from the specified method)

vmax

The maximum to use (in which case it is not calculated from the specified method)

method

A string that defines how minimum and maximum shall be set. This argument is not optional and can be one of the following:

data

plot the ticks exactly where the data is.

mid

plot the ticks in the middle of the data.

rounded

Sets the minimum and maximum of the ticks to the rounded data minimum or maximum. Ticks are rounded to the next 0.5 value with to the difference between data max- and minimum. The minimal tick will always be lower or equal than the data minimum, the maximal tick will always be higher or equal than the data maximum.

roundedsym

Same as rounded above but the ticks are chose such that they are symmetric around zero

minmax

Uses the minimum as minimal tick and maximum as maximal tick

sym

Same as minmax but symmetric around zero

log

Use logarithmic bounds. In this case, the given number N determines the number of bounds per power of tenth (i.e. N == 2 results in something like 1.0, 5.0, 10.0, 50.0, etc., If this second number is None, then it will be chosen such that we have around 11 boundaries but at least one per power of ten.

symlog

The same as log but symmetric around 0. If the number N is None, then we have around 12 boundaries but at least one per power of ten

int

Specifies how many ticks to use with the 'rounded' option. I.e. if integer i, then this is the same as ['rounded', i].

class psy_maps.plotters.MapVectorColor(*args, **kwargs)

Bases: VectorColor

Set the color for the arrows

This formatoption can be used to set a single color for the vectors or define the color coding

Possible types

float

Determines the greyness

color

Defines the same color for all arrows. The string can be either a html hex string (e.g. ‘#eeefff’), a single letter (e.g. ‘b’: blue, ‘g’: green, ‘r’: red, ‘c’: cyan, ‘m’: magenta, ‘y’: yellow, ‘k’: black, ‘w’: white) or any other color

string {‘absolute’, ‘u’, ‘v’}

Strings may define how the formatoption is calculated. Possible strings are

  • absolute: for the absolute wind speed

  • u: for the u component

  • v: for the v component

2D-array

The values determine the color for each plotted arrow. Note that the shape has to match the one of u and v.

See also

arrowsize, arrowstyle, density, linewidth

Attributes:

bounds

bounds Formatoption instance in the plotter

cmap

cmap Formatoption instance in the plotter

plot

plot Formatoption instance in the plotter

transpose

transpose Formatoption instance in the plotter

property bounds

bounds Formatoption instance in the plotter

property cmap

cmap Formatoption instance in the plotter

property plot

plot Formatoption instance in the plotter

property transpose

transpose Formatoption instance in the plotter

class psy_maps.plotters.MapVectorPlot(*args, **kwargs)

Bases: VectorPlot

Choose the vector plot type

Possible types

str

Plot types can be either

quiver

to make a quiver plot

stream

to make a stream plot

Methods:

add2format_coord(x, y)

Additional information for the format_coord()

set_value(value, *args, **kwargs)

Set (and validate) the value in the plotter.

Attributes:

arrowsize

arrowsize Formatoption instance in the plotter

arrowstyle

arrowstyle Formatoption instance in the plotter

bounds

bounds Formatoption instance in the plotter

clat

clat Formatoption instance in the plotter

clip

clip Formatoption instance in the plotter

clon

clon Formatoption instance in the plotter

cmap

cmap Formatoption instance in the plotter

color

color Formatoption instance in the plotter

data_dependent

bool or a callable.

density

density Formatoption instance in the plotter

dependencies

list of str.

linewidth

linewidth Formatoption instance in the plotter

lonlatbox

lonlatbox Formatoption instance in the plotter

transform

transform Formatoption instance in the plotter

transpose

transpose Formatoption instance in the plotter

add2format_coord(x, y)

Additional information for the format_coord()

property arrowsize

arrowsize Formatoption instance in the plotter

property arrowstyle

arrowstyle Formatoption instance in the plotter

property bounds

bounds Formatoption instance in the plotter

property clat

clat Formatoption instance in the plotter

property clip

clip Formatoption instance in the plotter

property clon

clon Formatoption instance in the plotter

property cmap

cmap Formatoption instance in the plotter

property color

color Formatoption instance in the plotter

data_dependent = True

bool or a callable. This attribute indicates whether this Formatoption depends on the data and should be updated if the data changes. If it is a callable, it must accept one argument: the new data. (Note: This is automatically set to True for plot formatoptions)

property density

density Formatoption instance in the plotter

dependencies = ['lonlatbox', 'transform', 'clon', 'clat', 'clip', 'transpose']

list of str. List of formatoptions that force an update of this formatoption if they are updated.

property linewidth

linewidth Formatoption instance in the plotter

property lonlatbox

lonlatbox Formatoption instance in the plotter

set_value(value, *args, **kwargs)

Set (and validate) the value in the plotter. This method is called by the plotter when it attempts to change the value of the formatoption.

Parameters:
  • value – Value to set

  • validate (bool) – if True, validate the value before it is set

  • todefault (bool) – True if the value is updated to the default value

property transform

transform Formatoption instance in the plotter

property transpose

transpose Formatoption instance in the plotter

class psy_maps.plotters.Projection(*args, **kwargs)

Bases: ProjectionBase

Specify the projection for the plot

This formatoption defines the projection of the plot

Possible types

cartopy.crs.CRS

A cartopy projection instance (e.g. cartopy.crs.PlateCarree)

str

A string specifies the projection instance to use. The centered longitude and latitude are determined by the clon and clat formatoptions. Possible strings are (each standing for the specified projection)

cf

try to decode the CF-conventions

cyl

cartopy.crs.PlateCarree

robin

cartopy.crs.Robinson

moll

cartopy.crs.Mollweide

geo

cartopy.crs.Geostationary

northpole

cartopy.crs.NorthPolarStereo

southpole

cartopy.crs.SouthPolarStereo

ortho

cartopy.crs.Orthographic

stereo

cartopy.crs.Stereographic

near

cartopy.crs.NearsidePerspective

rotated

cartopy.crs.RotatedPole

The special case 'cf' tries to decode the CF-conventions in the data. If this is not possible, we assume a standard lat-lon projection ('cyl')

Warning

An update of the projection clears the axes!

Attributes:

clat

clat Formatoption instance in the plotter

clon

clon Formatoption instance in the plotter

connections

list of str.

dependencies

list of str.

lonlatbox

lonlatbox Formatoption instance in the plotter

lonlatbox_transformed

Transform the lonlatbox according to the projection

name

str.

priority

int.

requires_clearing

an update of this formatoption requires that the axes is cleared

transform

transform Formatoption instance in the plotter

Methods:

initialize_plot(value[, clear])

Initialize the plot and set the projection for the axes

update(value)

Update the formatoption

property clat

clat Formatoption instance in the plotter

property clon

clon Formatoption instance in the plotter

connections = ['transform', 'lonlatbox']

list of str. Connections to other formatoptions that are (different from dependencies and children) not important for the update process

dependencies = ['clon', 'clat']

list of str. List of formatoptions that force an update of this formatoption if they are updated.

initialize_plot(value, clear=True)

Initialize the plot and set the projection for the axes

property lonlatbox

lonlatbox Formatoption instance in the plotter

property lonlatbox_transformed

Transform the lonlatbox according to the projection

name = 'Projection of the plot'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

priority = 30

int. Priority value of the the formatoption determining when the formatoption is updated.

  • 10: at the end (for labels, etc.)

  • 20: before the plotting (e.g. for colormaps, etc.)

  • 30: before loading the data (e.g. for lonlatbox)

requires_clearing = True

an update of this formatoption requires that the axes is cleared

property transform

transform Formatoption instance in the plotter

update(value)

Update the formatoption

Since this formatoption requires clearing, this method does nothing. Everything is done in the initialize_plot() method.

class psy_maps.plotters.ProjectionBase(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)

Bases: Formatoption

Base class for formatoptions that uses cartopy.crs.CRS instances

Possible types

cartopy.crs.CRS

A cartopy projection instance (e.g. cartopy.crs.PlateCarree)

str

A string specifies the projection instance to use. The centered longitude and latitude are determined by the clon and clat formatoptions. Possible strings are (each standing for the specified projection)

cf

try to decode the CF-conventions

cyl

cartopy.crs.PlateCarree

robin

cartopy.crs.Robinson

moll

cartopy.crs.Mollweide

geo

cartopy.crs.Geostationary

northpole

cartopy.crs.NorthPolarStereo

southpole

cartopy.crs.SouthPolarStereo

ortho

cartopy.crs.Orthographic

stereo

cartopy.crs.Stereographic

near

cartopy.crs.NearsidePerspective

rotated

cartopy.crs.RotatedPole

The special case 'cf' tries to decode the CF-conventions in the data. If this is not possible, we assume a standard lat-lon projection ('cyl')

Methods:

albers_conical_equal_area_from_cf(crs)

azimuthal_equidistant_from_cf(crs)

geostationary_from_cf(crs)

get_kwargs(value[, clon, clat])

lambert_azimuthal_equal_area_from_cf(crs)

lambert_conformal_conic_from_cf(crs)

lambert_cylindrical_equal_area_from_cf(crs)

latitude_longitude_from_cf(crs)

mercator_from_cf(crs)

orthographic_from_cf(crs)

polar_stereographic_from_cf(crs)

rotated_latitude_longitude_from_cf(crs)

set_projection(value, *args, **kwargs)

sinusoidal_from_cf(crs)

stereographic_from_cf(crs)

transform_lonlatbox(value)

Transform a lon-lat-box to the specific projection

transverse_mercator_from_cf(crs)

Attributes:

cf_projection

projection_kwargs

projections

supported_crs

albers_conical_equal_area_from_cf(crs)
azimuthal_equidistant_from_cf(crs)
property cf_projection
geostationary_from_cf(crs)
get_kwargs(value, clon=None, clat=None)
lambert_azimuthal_equal_area_from_cf(crs)
lambert_conformal_conic_from_cf(crs)
lambert_cylindrical_equal_area_from_cf(crs)
latitude_longitude_from_cf(crs)
mercator_from_cf(crs)
orthographic_from_cf(crs)
polar_stereographic_from_cf(crs)
projection_kwargs = {'cyl': ['central_longitude'], 'geo': ['central_longitude'], 'moll': ['central_longitude'], 'near': ['central_longitude', 'central_latitude'], 'northpole': ['central_longitude'], 'ortho': ['central_longitude', 'central_latitude'], 'robin': ['central_longitude'], 'rotated': ['pole_longitude', 'pole_latitude'], 'southpole': ['central_longitude'], 'stereo': ['central_longitude', 'central_latitude']}
projections = {'cyl': <class 'cartopy.crs.PlateCarree'>, 'geo': <class 'cartopy.crs.Geostationary'>, 'moll': <class 'cartopy.crs.Mollweide'>, 'near': <class 'cartopy.crs.NearsidePerspective'>, 'northpole': <class 'cartopy.crs.NorthPolarStereo'>, 'ortho': <class 'cartopy.crs.Orthographic'>, 'robin': <class 'cartopy.crs.Robinson'>, 'rotated': <class 'cartopy.crs.RotatedPole'>, 'southpole': <class 'cartopy.crs.SouthPolarStereo'>, 'stereo': <class 'cartopy.crs.Stereographic'>}
rotated_latitude_longitude_from_cf(crs)
set_projection(value, *args, **kwargs)
sinusoidal_from_cf(crs)
stereographic_from_cf(crs)
supported_crs = ['albers_conical_equal_area', 'azimuthal_equidistant', 'geostationary', 'lambert_azimuthal_equal_area', 'lambert_conformal_conic', 'lambert_cylindrical_equal_area', 'latitude_longitude', 'mercator', 'orthographic', 'polar_stereographic', 'rotated_latitude_longitude', 'sinusoidal', 'stereographic', 'transverse_mercator']
transform_lonlatbox(value)

Transform a lon-lat-box to the specific projection

transverse_mercator_from_cf(crs)
class psy_maps.plotters.StockImage(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)

Bases: Formatoption

Display a stock image on the map

This formatoption uses the cartopy.mpl.geoaxes.GeoAxes.stock_img() method to display a downsampled version of the Natural Earth shaded relief raster on the map

Possible types

bool

If True, the image is displayed

Attributes:

connections

list of str.

image

name

str.

plot

plot Formatoption instance in the plotter

priority

int.

Methods:

remove()

Method to remove the effects of this formatoption

update(value)

Method that is call to update the formatoption on the axes

connections = ['plot']

list of str. Connections to other formatoptions that are (different from dependencies and children) not important for the update process

image = None
name = 'Display Natural Earth shaded relief raster'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

property plot

plot Formatoption instance in the plotter

priority = 10

int. Priority value of the the formatoption determining when the formatoption is updated.

  • 10: at the end (for labels, etc.)

  • 20: before the plotting (e.g. for colormaps, etc.)

  • 30: before loading the data (e.g. for lonlatbox)

remove()

Method to remove the effects of this formatoption

This method is called when the axes is cleared due to a formatoption with requires_clearing set to True. You don’t necessarily have to implement this formatoption if your plot results are removed by the usual matplotlib.axes.Axes.clear() method.

update(value)

Method that is call to update the formatoption on the axes

Parameters:

value – Value to update

class psy_maps.plotters.Transform(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)

Bases: ProjectionBase

Specify the coordinate system of the data

This formatoption defines the coordinate system of the data (usually we expect a simple latitude longitude coordinate system)

Possible types

cartopy.crs.CRS

A cartopy projection instance (e.g. cartopy.crs.PlateCarree)

str

A string specifies the projection instance to use. The centered longitude and latitude are determined by the clon and clat formatoptions. Possible strings are (each standing for the specified projection)

cf

try to decode the CF-conventions

cyl

cartopy.crs.PlateCarree

robin

cartopy.crs.Robinson

moll

cartopy.crs.Mollweide

geo

cartopy.crs.Geostationary

northpole

cartopy.crs.NorthPolarStereo

southpole

cartopy.crs.SouthPolarStereo

ortho

cartopy.crs.Orthographic

stereo

cartopy.crs.Stereographic

near

cartopy.crs.NearsidePerspective

rotated

cartopy.crs.RotatedPole

The special case 'cf' tries to decode the CF-conventions in the data. If this is not possible, we assume a standard lat-lon projection ('cyl')

Attributes:

cf_projection

connections

list of str.

name

str.

plot

plot Formatoption instance in the plotter

priority

int.

vplot

vplot Formatoption instance in the plotter

Methods:

update(value)

Method that is call to update the formatoption on the axes

property cf_projection
connections = ['plot', 'vplot']

list of str. Connections to other formatoptions that are (different from dependencies and children) not important for the update process

name = 'Coordinate system of the data'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

property plot

plot Formatoption instance in the plotter

priority = 30

int. Priority value of the the formatoption determining when the formatoption is updated.

  • 10: at the end (for labels, etc.)

  • 20: before the plotting (e.g. for colormaps, etc.)

  • 30: before loading the data (e.g. for lonlatbox)

update(value)

Method that is call to update the formatoption on the axes

Parameters:

value – Value to update

property vplot

vplot Formatoption instance in the plotter

class psy_maps.plotters.Transpose(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)

Bases: Formatoption

Transpose the data before plotting

This formatoption can be used in case the data order of the variable dimensions is (x, y) instead of (y, x)

Attributes:

group

str.

name

str.

priority

int.

Methods:

update(value)

Method that is call to update the formatoption on the axes

group = 'axes'

str. Key of the group name in groups of this formatoption keyword

name = 'Transpose (switch) x- and y-dimensions'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

priority = 30

int. Priority value of the the formatoption determining when the formatoption is updated.

  • 10: at the end (for labels, etc.)

  • 20: before the plotting (e.g. for colormaps, etc.)

  • 30: before loading the data (e.g. for lonlatbox)

update(value)

Method that is call to update the formatoption on the axes

Parameters:

value – Value to update

class psy_maps.plotters.VectorPlotter(data=None, ax=None, auto_update=None, project=None, draw=False, make_plot=True, clear=False, enable_post=False, **kwargs)

Bases: MapPlotter, BaseVectorPlotter, BasePlotter

Plotter for visualizing 2-dimensional vector data on a map

See also

psyplot.plotter.simple.SimpleVectorPlotter

for a simple version of drawing vector data

FieldPlotter

for plotting scaler fields

CombinedPlotter

for combined scalar and vector fields

Attributes:

color

Set the color for the arrows

density

Change the density of the arrows

plot

Choose the vector plot type

color

Set the color for the arrows

This formatoption can be used to set a single color for the vectors or define the color coding

Possible types

float

Determines the greyness

color

Defines the same color for all arrows. The string can be either a html hex string (e.g. ‘#eeefff’), a single letter (e.g. ‘b’: blue, ‘g’: green, ‘r’: red, ‘c’: cyan, ‘m’: magenta, ‘y’: yellow, ‘k’: black, ‘w’: white) or any other color

string {‘absolute’, ‘u’, ‘v’}

Strings may define how the formatoption is calculated. Possible strings are

  • absolute: for the absolute wind speed

  • u: for the u component

  • v: for the v component

2D-array

The values determine the color for each plotted arrow. Note that the shape has to match the one of u and v.

See also

arrowsize, arrowstyle, density, linewidth

density

Change the density of the arrows

Possible types

float

Scales the density of the arrows in x- and y-direction (1.0 means no scaling)

tuple (x, y)

Defines the scaling in x- and y-direction manually

plot

Choose the vector plot type

Possible types

str

Plot types can be either

quiver

to make a quiver plot

stream

to make a stream plot

class psy_maps.plotters.XGrid(*args, **kwargs)

Bases: GridBase

Draw vertical grid lines (meridians)

This formatoption specifies at which longitudes to draw the meridians.

Possible types

None

Don’t draw gridlines (same as False)

bool

True: draw gridlines and determine position automatically False: don’t draw gridlines

numeric array

specifies the ticks manually

str or list [str, …]

A list of the below mentioned values of the mapping like [method, N, percmin, percmax, vmin, vmax], where only the first one is absolutely necessary

dict

Automatically determine the ticks corresponding to the data. The mapping can have the following keys, but only method is not optional.

N

An integer describing the number of boundaries (or ticks per power of ten, see log and symlog above)

percmin

The percentile to use for the minimum (by default, 0, i.e. the minimum of the array)

percmax

The percentile to use for the maximum (by default, 100, i.e. the maximum of the array)

vmin

The minimum to use (in which case it is not calculated from the specified method)

vmax

The maximum to use (in which case it is not calculated from the specified method)

method

A string that defines how minimum and maximum shall be set. This argument is not optional and can be one of the following:

data

plot the ticks exactly where the data is.

mid

plot the ticks in the middle of the data.

rounded

Sets the minimum and maximum of the ticks to the rounded data minimum or maximum. Ticks are rounded to the next 0.5 value with to the difference between data max- and minimum. The minimal tick will always be lower or equal than the data minimum, the maximal tick will always be higher or equal than the data maximum.

roundedsym

Same as rounded above but the ticks are chose such that they are symmetric around zero

minmax

Uses the minimum as minimal tick and maximum as maximal tick

sym

Same as minmax but symmetric around zero

log

Use logarithmic bounds. In this case, the given number N determines the number of bounds per power of tenth (i.e. N == 2 results in something like 1.0, 5.0, 10.0, 50.0, etc., If this second number is None, then it will be chosen such that we have around 11 boundaries but at least one per power of ten.

symlog

The same as log but symmetric around 0. If the number N is None, then we have around 12 boundaries but at least one per power of ten

int

Specifies how many ticks to use with the 'rounded' option. I.e. if integer i, then this is the same as ['rounded', i].

See also

ygrid, grid_color, grid_labels

Attributes:

array

The numpy array of the data

axis

clon

clon Formatoption instance in the plotter

dependencies

list of str.

grid_color

grid_color Formatoption instance in the plotter

grid_labels

grid_labels Formatoption instance in the plotter

grid_settings

grid_settings Formatoption instance in the plotter

lonlatbox

lonlatbox Formatoption instance in the plotter

map_extent

map_extent Formatoption instance in the plotter

name

str.

plot

plot Formatoption instance in the plotter

projection

projection Formatoption instance in the plotter

transform

transform Formatoption instance in the plotter

property array

The numpy array of the data

axis = 'x'
property clon

clon Formatoption instance in the plotter

dependencies = ['transform', 'grid_labels', 'grid_color', 'grid_settings', 'projection', 'lonlatbox', 'map_extent', 'clon']

list of str. List of formatoptions that force an update of this formatoption if they are updated.

property grid_color

grid_color Formatoption instance in the plotter

property grid_labels

grid_labels Formatoption instance in the plotter

property grid_settings

grid_settings Formatoption instance in the plotter

property lonlatbox

lonlatbox Formatoption instance in the plotter

property map_extent

map_extent Formatoption instance in the plotter

name = 'Meridians'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

property plot

plot Formatoption instance in the plotter

property projection

projection Formatoption instance in the plotter

property transform

transform Formatoption instance in the plotter

class psy_maps.plotters.YGrid(*args, **kwargs)

Bases: GridBase

Draw horizontal grid lines (parallels)

This formatoption specifies at which latitudes to draw the parallels.

Possible types

None

Don’t draw gridlines (same as False)

bool

True: draw gridlines and determine position automatically False: don’t draw gridlines

numeric array

specifies the ticks manually

str or list [str, …]

A list of the below mentioned values of the mapping like [method, N, percmin, percmax, vmin, vmax], where only the first one is absolutely necessary

dict

Automatically determine the ticks corresponding to the data. The mapping can have the following keys, but only method is not optional.

N

An integer describing the number of boundaries (or ticks per power of ten, see log and symlog above)

percmin

The percentile to use for the minimum (by default, 0, i.e. the minimum of the array)

percmax

The percentile to use for the maximum (by default, 100, i.e. the maximum of the array)

vmin

The minimum to use (in which case it is not calculated from the specified method)

vmax

The maximum to use (in which case it is not calculated from the specified method)

method

A string that defines how minimum and maximum shall be set. This argument is not optional and can be one of the following:

data

plot the ticks exactly where the data is.

mid

plot the ticks in the middle of the data.

rounded

Sets the minimum and maximum of the ticks to the rounded data minimum or maximum. Ticks are rounded to the next 0.5 value with to the difference between data max- and minimum. The minimal tick will always be lower or equal than the data minimum, the maximal tick will always be higher or equal than the data maximum.

roundedsym

Same as rounded above but the ticks are chose such that they are symmetric around zero

minmax

Uses the minimum as minimal tick and maximum as maximal tick

sym

Same as minmax but symmetric around zero

log

Use logarithmic bounds. In this case, the given number N determines the number of bounds per power of tenth (i.e. N == 2 results in something like 1.0, 5.0, 10.0, 50.0, etc., If this second number is None, then it will be chosen such that we have around 11 boundaries but at least one per power of ten.

symlog

The same as log but symmetric around 0. If the number N is None, then we have around 12 boundaries but at least one per power of ten

int

Specifies how many ticks to use with the 'rounded' option. I.e. if integer i, then this is the same as ['rounded', i].

See also

xgrid, grid_color, grid_labels

Attributes:

array

The numpy array of the data

axis

grid_color

grid_color Formatoption instance in the plotter

grid_labels

grid_labels Formatoption instance in the plotter

grid_settings

grid_settings Formatoption instance in the plotter

lonlatbox

lonlatbox Formatoption instance in the plotter

map_extent

map_extent Formatoption instance in the plotter

name

str.

plot

plot Formatoption instance in the plotter

projection

projection Formatoption instance in the plotter

transform

transform Formatoption instance in the plotter

property array

The numpy array of the data

axis = 'y'
property grid_color

grid_color Formatoption instance in the plotter

property grid_labels

grid_labels Formatoption instance in the plotter

property grid_settings

grid_settings Formatoption instance in the plotter

property lonlatbox

lonlatbox Formatoption instance in the plotter

property map_extent

map_extent Formatoption instance in the plotter

name = 'Parallels'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

property plot

plot Formatoption instance in the plotter

property projection

projection Formatoption instance in the plotter

property transform

transform Formatoption instance in the plotter

psy_maps.plotters.degree_format()
psy_maps.plotters.format_lats(x, pos)
psy_maps.plotters.format_lons(x, pos)
psy_maps.plotters.shiftdata(lonsin, datain, lon_0)

Shift longitudes (and optionally data) so that they match map projection region. Only valid for cylindrical/pseudo-cylindrical global projections and data on regular lat/lon grids. longitudes and data can be 1-d or 2-d, if 2-d it is assumed longitudes are 2nd (rightmost) dimension.

Parameters:
  • lonsin – original 1-d or 2-d longitudes.

  • datain – original 1-d or 2-d data

  • lon_0 – center of map projection region

References

This function is copied and taken from the mpl_toolkits.basemap.Basemap class. The only difference is that we do not mask values outside the map projection region