rainfallqc.utils.spatial_utils

All spatial operations.

Classes and functions ordered alphabetically.

rainfallqc.utils.spatial_utils.compute_spatial_mean_xr(data, var_name)[source]

Get the value at the nearest ETCCDI grid cell to the gauge coordinates.

Parameters:
  • data (Dataset) – Data with variable to compute mean from. Should have lat/lon and time (as axis 0)

  • var_name (str) – Variable to make mean value of

Return type:

Dataset

Returns:

:
data

Data with spatial mean

rainfallqc.utils.spatial_utils.haversine(lon1, lat1, lon2, lat2)[source]

Great circle distance (km) between two points on Earth.

Parameters:
  • lon1 (DataArray) – Longitude of point 1

  • lat1 (DataArray) – Latitude of point 1

  • lon2 (ndarray | float) – Longitude of point 2

  • lat2 (ndarray | float) – Latitude of point 2

Return type:

float

Returns:

:
distancefloat

Distance between the two points in km

Functions

compute_spatial_mean_xr(data, var_name)

Get the value at the nearest ETCCDI grid cell to the gauge coordinates.

haversine(lon1, lat1, lon2, lat2)

Great circle distance (km) between two points on Earth.