cordex.transform_coords

cordex.transform_coords#

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

Transform X and Y coordinates of a Dataset.

The transformed coordinates will be added to the Dataset. This function is usefull to add, e.g., global lon/lat coordinates to a rotated pole grid.

Parameters:
  • ds (Dataset or DataArray) – Dataset with input grid.

  • 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 x and y should be transformed. If not supplied, EPSG:4326 is the default.

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

Returns:

ds (Dataset or DataArray) – Dataset with transformed coordinates.