geodata.plot.heatmap_animation

geodata.plot.heatmap_animation#

geodata.plot.heatmap_animation(ds: xarray.DataArray, time_factor: float = 1, agg_method: ReductionType = 'mean', shape: geopandas.GeoSeries | None = None, shape_width: float = 0.5, shape_color: str = 'black', cmap: str = 'bone_r', v_max: float | None = None, ds_name: str | None = None, figsize: tuple[float, float] = (10, 5), title: str | None = None, title_size: float = 12, grid: bool = True, **kwargs)#

Created animated version of colormesh so users can see the value change over time at default, each frame is the average or sum of value per time_unit * time_factor.

Parameters:
  • ds (xarray.DataArray) – The target DataArray object.

  • time_factor (float) – Tthe factor to aggregate the value of DataArray on Example: for daily mean on hourly data, time_factor = 24. Defaults to 1.

  • agg_method (str) – Aggregation method. Can be either mean or sum.

  • shape (geopandas.GeoSeries) – Shapes to be plotted over the raster.

  • shape_width (float) – The line width for plotting shapes. 0.5 by default.

  • shape_color (str) – Color of the shape line. Black by default.

  • cmap (str) – The color of the heat map, select one from matplotlib.pyplot.colormaps.

  • v_max (float) – The maximum value in the heatmap.

  • ds_name (str) – Name of the DataArray to be shown on title.

  • figsize (tuple) – The size of the plot. (10, 5) by default.

  • title (str) – The title of the result plot. Optional. If not provided, the title will be automatically generated.

  • title_size (float) – The size of the title of the result plot.

  • coastlines (bool) – Whether to add coast lines to the plot, True by default.

  • grid (bool) – Whether to add grid lines to the plot, True by default.

  • **kwargs (dict) – Additional arguments for xarray.DataArray.plot.imshow.

Returns:

The animation object.

Return type:

matplotlib.animation.FuncAnimation

Raises: