lat_lon_grid_deltas#

metpy.calc.lat_lon_grid_deltas(longitude, latitude, x_dim=-1, y_dim=-2, geod=None)[source]#

Calculate the actual delta between grid points that are in latitude/longitude format.

Parameters:
  • longitude (array-like) – Array of longitudes defining the grid. If not a pint.Quantity, assumed to be in degrees.

  • latitude (array-like) – Array of latitudes defining the grid. If not a pint.Quantity, assumed to be in degrees.

  • x_dim (int) – axis number for the x dimension, defaults to -1.

  • y_dim (int) – axis number for the y dimension, defaults to -2.

  • geod (pyproj.Geod or None) – PyProj Geod to use for forward azimuth and distance calculations. If None, use a default spherical ellipsoid.

Returns:

dx, dy – At least two dimensional arrays of signed deltas between grid points in the x and y direction

Notes

Accepts 1D, 2D, or higher arrays for latitude and longitude Assumes […, Y, X] dimension order for input and output, unless keyword arguments y_dim and x_dim are otherwise specified.

This function will only return pint.Quantity arrays (not xarray.DataArray or another array-like type). It will also “densify” your data if using Dask or lazy-loading.

Changed in version 1.0: Changed signature from (longitude, latitude, **kwargs)