act.plotting.XSectionDisplay¶
- class act.plotting.XSectionDisplay(ds, 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()
andxarray.Dataset.isel()
commands.This is inherited from the
act.plotting.Display()
class and has therefore has the same attributes as that class. Seeact.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()
andxarray.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 frommy_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 bymatplotlib.pyplot.pcolormesh()
.
|
Adds a colorbar to the plot. |
|
Adds subplots to the Display object. |
|
This assigns the Display to a specific figure and axis. |
|
Group the Display by specific units of time. |
|
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. |
|
Plots a cross section of 2D data on a geographical map. |
|
This will place a Display object into a specific subplot. |
|
|
|
Sets the x range of the plot. |
|
Sets the y range of the plot. |