windkit.spatial.grid_convergence#
- windkit.spatial.grid_convergence(ds, source=None)[source]#
Return grid convergence for a WindKit spatial object.
- Parameters:
ds (xarray.Dataset or xarray.DataArray) – WindKit xarray object containing spatial coordinates and a CRS.
source (xarray.Dataset, xarray.DataArray, geopandas.GeoDataFrame,) – geopandas.GeoSeries, BBox, int, dict, str or pyproj.crs.CRS, optional Reference CRS to rotate from. When provided, returns the effective grid convergence needed to rotate directions from the
sourceframe into the frame ofdsat the locations ofds.
- Returns:
Grid convergence in degrees, in the range (-180, 180]. A positive value means grid north of
dsis rotated clockwise from the reference north: subtract it from a wind direction expressed in the reference frame to express that direction in the grid frame ofds.Without
source, the reference is true (geographic) north: the returned angle is the classic geodetic grid convergence of the projection ofds.With
source, the reference is the grid-north ofsource: the returned angle is the rotation needed to convert a direction expressed in thesourceCRS frame into thedsCRS frame.- Return type:
- Raises:
ValueError – If no CRS is found on
ds.