get_projection_correction_factors#

rojak.core.derivatives.get_projection_correction_factors(latitude, longitude, use_dask, is_radians=False, crs=None)[source]#

Compute the map projection scale factors at each point of a latitude/longitude grid

These factors (see ProjectionCorrectionFactors) are used to correct derivatives computed on the raw latitude/longitude grid (see GradientMode.GEOSPATIAL in spatial_gradient(), and vector_derivatives()) for the distortion introduced by the map projection.

Parameters:
  • latitude (DataArray) – 1D array of latitude coordinates

  • longitude (DataArray) – 1D array of longitude coordinates

  • use_dask (bool) – If True, compute the factors lazily with dask

  • is_radians (bool) – Whether latitude/longitude are in radians. Defaults to False (degrees).

  • crs (CRS | None) – Coordinate reference system to compute the scale factors for. Defaults to plain latitude/longitude ("+proj=latlon").

Returns:

Scale factors, with dimensions matching latitude and longitude

Raises:

ValueError – If latitude and longitude do not both have exactly 1 dimension

Return type:

ProjectionCorrectionFactors