huracanpy.calc.distance#
- huracanpy.calc.distance(lon, lat, *args, track_id=None, method='geod', ellps='WGS84', centering='forward')[source]#
Compute distance between longitude/latitude coordinates using geodesic or haversine calculation
>>> distance(lon, lat, track_id) Computes the distance between successive lon, lat points, without including differences between the end and start points of different tracks
>>> distance(lon1, lat1, lon2, lat2) Computes the distance between each point in (lon1, lat1) and each point in (lon2, lat2)
- Parameters:
lon (xarray.DataArray) – Longitude and latitude points
lat (xarray.DataArray) – Longitude and latitude points
*args (xarray.DataArray) –
0 arguments. Leave empty to calculate distance between successive points
1 argument, track_id. Same as 0 arguments but inserts NaNs where successive points are from different tracks
2 arguments, lon and lat arrays. Calculate distances between two tracks, e.g. radius of maximum wind speed, using storm centre locations and maximum wind speed locations
track_id (array_like, optional) – Track ID at each point
method (str, optional) – The method of computing distances, either geodesic (“geod”/”geodesic”) or haversine (“haversine”)
ellps (str, optional) – The definition of the globe to use for the geodesic calculation (see pyproj.Geod). Default is “WGS84”.
centering (str, optional) –
“forward” gives the distance based on the track point and the following track point. The last point of each track will be NaN
”backward” gives the distance based on the track point and the previous track point. The first point of each track will be NaN
”centre” gives the distance based on the centred difference of track points. The first and last points of each track will be NaN
”adaptive” gives the same as centred, but fills in the first point of each track with the forward difference, and the last point of each track with the backward difference
- Return type: