grid_spacing#
- rojak.core.derivatives.grid_spacing(latitude, longitude, units, geod=None)[source]#
Compute the geodesic distance between adjacent points of a 2D latitude/longitude grid
Unlike
nominal_grid_spacing(), the distance is computed at every grid point (rather than approximated from a single row/column), so this accounts for the grid spacing varying with latitude.- Parameters:
latitude (NDArray | DataArray) – 1D array of latitude coordinates
longitude (NDArray | DataArray) – 1D array of longitude coordinates
units (LatLonUnits) – Units
latitude/longitudeare expressed ingeod (Geod | None) – Geodesic to compute distances with. Defaults to a WGS84 ellipsoid.
- Returns:
Grid spacing (in meters) between adjacent grid points along each Cartesian direction
- Raises:
ValueError – If
latitudeandlongitudedo not have the same number of dimensionsNotImplementedError – If
latitude/longitudeare 2D (not yet supported)ValueError – If
latitude/longitudehave more than 2 dimensions
- Return type: