pcmdi_metrics.utils.create_target_grid

pcmdi_metrics.utils.create_target_grid(lat1=-90.0, lat2=90.0, lon1=0.0, lon2=360.0, target_grid_resolution='2.5x2.5', grid_type='uniform')[source]

Generate a uniform grid for given latitude/longitude ranges and resolution

Parameters:
  • lat1 (float, optional) – Starting latitude, by default -90.

  • lat2 (float, optional) – Starting latitude, by default 90.

  • lon1 (float, optional) – Starting latitude, by default 0.

  • lon2 (float, optional) – Starting latitude, by default 360.

  • target_grid_resolution (str, optional) – grid resolution in degree for lat and lon, by default “2.5x2.5”

  • grid_type (str, optional) – type of the grid (‘uniform’ or ‘gaussian’), by default “uniform”

Returns:

xr.Dataset – generated grid

Examples

Import:

>>> from pcmdi_metrics.utils import create_target_grid

Global uniform grid:

>>> grid = create_target_grid(-90, 90, 0, 360, target_grid_resolution="5x5")

Regional uniform grid:

>>> grid = create_target_grid(30, 50, 100, 150, target_grid_resolution="0.5x0.5")