windwhisper.elevation_grid

Utilities for retrieving and interpolating elevation grids.

Attributes

GOOGLE_API_KEY

ELEVATION_API

MAX_SAMPLING_POINTS

Functions

get_elevation_grid(longitudes, latitudes[, ...])

Return a terrain elevation grid for the target domain.

clip_array_around_turbines(da, wind_turbines[, buffer_km])

Clip an elevation grid around the wind turbines.

distances_with_elevation(distances, relative_elevations)

Compute 3D distances using surface distance and elevation deltas.

Module Contents

windwhisper.elevation_grid.GOOGLE_API_KEY
windwhisper.elevation_grid.ELEVATION_API
windwhisper.elevation_grid.MAX_SAMPLING_POINTS
windwhisper.elevation_grid.get_elevation_grid(longitudes, latitudes, elevation_data=None, wind_turbines=None)

Return a terrain elevation grid for the target domain.

Parameters:
  • longitudes (numpy.ndarray) – Longitudes defining the interpolation grid.

  • latitudes (numpy.ndarray) – Latitudes defining the interpolation grid.

  • elevation_data (xarray.DataArray | None) – Optional local dataset used instead of remote APIs.

  • wind_turbines (dict | None) – Turbine specifications including position tuples.

Returns:

Elevation grid interpolated to the provided coordinates or None when the remote request fails.

Return type:

xarray.DataArray | None

windwhisper.elevation_grid.clip_array_around_turbines(da, wind_turbines, buffer_km=5.0)

Clip an elevation grid around the wind turbines.

Parameters:
  • da (xarray.DataArray | xarray.Dataset) – Elevation array with latitude and longitude coordinates.

  • wind_turbines (dict) – Turbine specifications including position tuples expressed as (lat, lon).

  • buffer_km (float) – Distance around each turbine to retain, in kilometres.

Returns:

Elevation subset covering all turbines and their buffers.

Return type:

xarray.DataArray

Raises:

ValueError – If the dataset does not contain an 'elevation' variable when a dataset is provided instead of a data array.

windwhisper.elevation_grid.distances_with_elevation(distances, relative_elevations)

Compute 3D distances using surface distance and elevation deltas.

Parameters:
  • distances (xarray.DataArray) – Surface distances between points (typically from haversine calculations).

  • relative_elevations (xarray.DataArray) – Elevation differences between the same point pairs.

Returns:

Distances adjusted for the elevation component.

Return type:

xarray.DataArray

Raises:

AssertionError – If the provided arrays do not share the same shape.