icenet.plotting package¶
Submodules¶
icenet.plotting.plot_set module¶
icenet.plotting.utils module¶
- icenet.plotting.utils.broadcast_forecast(start_date: object, end_date: object, datafiles: object = None, dataset: object = None, target: object = None) object [source]¶
- Parameters:
start_date
end_date
datafiles
dataset
target
- Returns:
- icenet.plotting.utils.calculate_extents(x1: int, x2: int, y1: int, y2: int)[source]¶
- Parameters:
x1
x2
y1
y2
- Returns:
- icenet.plotting.utils.filter_ds_by_obs(ds: object, obs_da: object, forecast_date: str) object [source]¶
- Parameters:
ds
obs_da
forecast_date – initialisation date of the forecast
- Returns:
- icenet.plotting.utils.get_forecast_ds(forecast_file: object, forecast_date: str, stddev: bool = False) object [source]¶
- Parameters:
forecast_file – a path to a .nc file
forecast_date – initialisation date of the forecast
stddev
- Returns tuple(fc_ds, obs_ds, land_mask):
- icenet.plotting.utils.get_obs_da(hemisphere: str, start_date: str, end_date: str, obs_source: object = './data/osisaf') object [source]¶
- Parameters:
hemisphere – string, typically either ‘north’ or ‘south’
start_date
end_date
obs_source
- Returns:
- icenet.plotting.utils.get_plot_axes(x1: int = 0, x2: int = 432, y1: int = 0, y2: int = 432, do_coastlines: bool = True, north: bool = True, south: bool = False)[source]¶
- Parameters:
x1
x2
y1
y2
do_coastlines
north
south
- Returns:
- icenet.plotting.utils.get_seas_forecast_da(hemisphere: str, date: str, bias_correct: bool = True, source_path: object = './data/mars.seas') tuple [source]¶
Atmospheric model Ensemble 15-day forecast (Set III - ENS)
- Coordinates:
time (time) datetime64[ns] 2022-04-01 … 2022-0…
yc (yc) float64 5.388e+06 … -5.388e+06
xc (xc) float64 -5.388e+06 … 5.388e+06
- param hemisphere:
string, typically either ‘north’ or ‘south’
- param date:
- param bias_correct:
- param source_path:
- icenet.plotting.utils.get_seas_forecast_init_dates(hemisphere: str, source_path: object = './data/mars.seas') object [source]¶
Obtains list of dates for which we have SEAS forecasts we have.
- Parameters:
hemisphere – string, typically either ‘north’ or ‘south’
source_path – path where north and south SEAS forecasts are stored
- Returns:
list of dates
- icenet.plotting.utils.process_probes(probes, data) tuple [source]¶
- Parameters:
probes – A sequence of locations (pairs)
data – A sequence of xr.DataArray
icenet.plotting.video module¶
- icenet.plotting.video.get_dataarray_from_files(files: object, numpy: bool = False) object [source]¶
- Parameters:
files
numpy
- Returns:
- icenet.plotting.video.recurse_data_folders(base_path: object, lookups: object, children: object, filetype: str = 'nc') object [source]¶
- Parameters:
base_path
lookups
children
filetype
- Returns:
- icenet.plotting.video.video_process(files: object, numpy: object, output_dir: object, fps: int) object [source]¶
- Parameters:
files
numpy
output_dir
fps
- Returns:
- icenet.plotting.video.xarray_to_video(da: object, fps: int, video_path: object = None, mask: object = None, mask_type: str = 'contour', clim: object = None, crop: object = None, data_type: str = 'abs', video_dates: object = None, cmap: object = 'viridis', figsize: int = 12, dpi: int = 150, imshow_kwargs: dict = None, ax_init: object = None, ax_extra: callable = None) object [source]¶
Generate video of an xarray.DataArray. Optionally input a list of video_dates to show, otherwise the full set of time coordiantes of the dataset is used.
- Parameters:
da – Dataset to create video of.
video_path – Path to save the video to.
fps – Frames per second of the video.
mask – Boolean mask with True over masked elements to overlay
as a contour or filled contour. Defaults to None (no mask plotting). :param mask_type: ‘contour’ or ‘contourf’ dictating whether the mask is overlaid as a contour line or a filled contour. :param data_type: ‘abs’ or ‘anom’ describing whether the data is in absolute or anomaly format. If anomaly, the colorbar is centred on 0. :param video_dates: List of Pandas Timestamps or datetime.datetime objects to plot video from the dataset. :param crop: [(a, b), (c, d)] to crop the video from a:b and c:d :param clim: Colormap limits. Default is None, in which case the min and max values of the array are used. :param cmap: Matplotlib colormap object. :param figsize: Figure size in inches. :param dpi: Figure DPI. :param imshow_kwargs: Extra arguments for displaying array :param ax_init: pre-initialised axes object for display :param ax_extra: Extra method called with axes for additional plotting