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 source frame into the frame of ds at the locations of ds.

Returns:

Grid convergence in degrees, in the range (-180, 180]. A positive value means grid north of ds is 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 of ds.

Without source, the reference is true (geographic) north: the returned angle is the classic geodetic grid convergence of the projection of ds.

With source, the reference is the grid-north of source: the returned angle is the rotation needed to convert a direction expressed in the source CRS frame into the ds CRS frame.

Return type:

xarray.DataArray

Raises:

ValueError – If no CRS is found on ds.