xoa.grid.ds2grid_dict

Contents

xoa.grid.ds2grid_dict#

xoa.grid.ds2grid_dict(obj, mask=None, lon_name=None, lat_name=None, time_name=None, bounds=False)[source]#

Convert a data array or dataset to a horizontal grid dictionary

The dictionary is suitable for the core interpolation and regridding classes xoa.core.interp.XYInterpolator and xoa.core.regrid.XYRegridder.

Parameters:
  • obj (xarray.DataArray, xarray.Dataset) – Object with longitude and latitude coordinates, that may be 1D or 2D

  • mask (str, xarray.DataArray, array_like, None) – Name of a variable or array of valid points (True)

  • lon_name (str, None) – Names of the longitude, latitude and time coordinates. They are searched with xoa.coords when not provided.

  • lat_name (str, None) – Names of the longitude, latitude and time coordinates. They are searched with xoa.coords when not provided.

  • time_name (str, None) – Names of the longitude, latitude and time coordinates. They are searched with xoa.coords when not provided.

  • bounds (bool) – Compute the edges and bounds of the cells, which are large arrays and that the core classes compute by themselves when they need them.

Returns:

dict – With the following keys: lon, lat, shape, dims, sizes, lon_name, lat_name, coords, type, lon_edges, lat_edges, lon_bounds, lat_bounds, and optionally mask and time_name. Edges and bounds are only present if bounds is True.