pangeo_fish.helpers.regrid_dataset

Contents

pangeo_fish.helpers.regrid_dataset#

pangeo_fish.helpers.regrid_dataset(*, ds: Dataset, nside: int, min_vertices=1, rot={'lat': 0, 'lon': 0}, dims: list[str] = ['cells'], plot=False, save=False, target_root='.', storage_options: dict = None, **kwargs)#

Regrid a dataset as a HEALPix grid, whose primary advantage is that all its cells/pixels cover the same surface area.

Parameters:
  • ds (xarray.Dataset) – The DST data

  • nside (int) – Tesolution of the HEALPix grid

  • min_vertices (int, default: 1) – Minimum number of vertices for a valid transcription

  • rot (mapping of str to tuple of float, default: {"lat": 0, "lon": 0}) – Mapping of angles to rotate the HEALPix grid. It must contain the keys “lon” and “lat”

  • dims (list of str, default: [``”cells”:class:`]`) -- The list of the dimensions. Either ``["x", "y"] or ["cells"].

  • plot (bool, default: False) – Whether to return a plot of the dataset

  • save (bool, default: False) – Whether to save the dataset

  • target_root (str, default: ".") – Root of the folder to save the .zarr array (under {target_root}/diff-regridded.zarr). Only used if save=True

  • storage_options (mapping, optional) – Dictionary containing storage options for connecting to the S3 bucket. Only used if save=True

Returns:

  • reshaped (xarray.Dataset) – HEALPix version of ds

  • figure (plt.Figure or None) – The plot of reshaped, or None if plot=False