xcdat.create_grid#

xcdat.create_grid(lat, lon, lat_bnds=None, lon_bnds=None)[source]#

Creates a grid for a give latitude and longitude array.

Parameters
  • lat (Union[np.ndarray, xr.DataArray]) – Array of latitude values.

  • lon (Union[np.ndarray, xr.DataArray]) – Array of longitude values.

  • lat_bnds (Optional[Union[np.ndarray, xr.DataArray]]) – Array of bounds for latitude values.

  • lon_bnds (Optional[Union[np.ndarray, xr.DataArray]]) – Array of bounds for longitude values.

Returns

xr.Dataset – Dataset with lat/lon grid.

Examples

Create uniform 2.5 x 2.5 degree grid:

>>> import xcdat
>>> import numpy as np
>>> lat = np.arange(-90, 90, 2.5)
>>> lon = np.arange(1.25, 360, 2.5)
>>> xcdat.create_grid(lat, lon)