cordex.transform_bounds

cordex.transform_bounds#

transform_bounds(ds, src_crs=None, trg_crs=None, trg_dims=None, bnds_dim=None)[source]#

Transform linear X and Y bounds of a Dataset.

Transformation of of the bounds of linear X and Y coordinates into the target crs according to https://cfconventions.org/cf-conventions/cf-conventions.html#cell-boundaries If the linear X and Y coordinate bounds are not available, they will be created and transformed.

Parameters:
  • ds (xr.Dataset) – Dataset containing linear X and Y coordinates, e.g., rlon and rlat

  • src_crs (pyproj.CRS) – Source coordinate reference system in which X and Y are defined. If not supplied, a grid_mapping variable should be available to define the source CRS.

  • trg_crs (pyproj.CRS) – Target coordinate reference system into which bounds should be transformed. If not supplied, EPSG:4326 is the default.

  • trg_dims (list or set) – Names of the bounds coordinates.

  • bnds_dim (str) – Names of the bounds dimension.

Returns:

bounds (xr.Dataset) – Dataset with X and Y bounds in target crs. Probably some 2D coordinates.

References

Please refer to the CF conventions document : https://cfconventions.org/cf-conventions/cf-conventions.html#cell-boundaries