act.plotting.XSectionDisplay

class act.plotting.XSectionDisplay(obj, subplot_shape=(1,), ds_name=None, **kwargs)[source]

Plots cross sections of multidimensional datasets. The data must be able to be sliced into a 2 dimensional slice using the xarray xarray.Dataset.sel() and xarray.Dataset.isel() commands.

This is inherited from the act.plotting.Display() class and has therefore has the same attributes as that class. See act.plotting.Display() for more information. There are no additional attributes or parameters to this class.

In order to create geographic plots, ACT needs the Cartopy package to be installed on your system. More information about Cartopy go here:https://scitools.org.uk/cartopy/docs/latest/.

Examples

For example, if you only want to do a cross section through the first time period of a 3D dataset called ir_temperature, you would do the following in xarray:

time_slice = my_ds["ir_temperature"].isel(time=0)

The methods of this class support passing in keyword arguments into xarray xarray.Dataset.sel() and xarray.Dataset.isel() commands so that new datasets do not need to be created when slicing by specific time periods or spatial slices. For example, to plot the first time period from my_ds, simply do:

xsection = XSectionDisplay(my_ds, figsize=(15, 8))
xsection.plot_xsection_map(
    None,
    "ir_temperature",
    vmin=220,
    vmax=300,
    cmap="Greys",
    x="longitude",
    y="latitude",
    isel_kwargs={"time": 0},
)

Here, the array is sliced by the first time period as specified in isel_kwargs. The other keyword arguments are standard keyword arguments taken by matplotlib.pyplot.pcolormesh().

add_colorbar(mappable[, title, ...])

Adds a colorbar to the plot.

add_subplots([subplot_shape, subplot_kw])

Adds subplots to the Display object.

assign_to_figure_axis(fig, ax)

This assigns the Display to a specific figure and axis.

plot_xsection(dsname, varname[, x, y, ...])

This function plots a cross section whose x and y coordinates are specified by the variable names either provided by the user or automatically detected by xarray.

plot_xsection_map(dsname, varname[, ...])

Plots a cross section of 2D data on a geographical map.

put_display_in_subplot(display, subplot_index)

This will place a Display object into a specific subplot.

set_subplot_to_map(subplot_index)

set_xrng(xrng[, subplot_index])

Sets the x range of the plot.

set_yrng(yrng[, subplot_index])

Sets the y range of the plot.