avni.mapping.ellipsoidal module#

avni.mapping.ellipsoidal.get_distaz(eplat: Union[float, list, tuple, numpy.ndarray], eplon: Union[float, list, tuple, numpy.ndarray], stlat: Union[float, list, tuple, numpy.ndarray], stlon: Union[float, list, tuple, numpy.ndarray], num_cores: int = 1)[source]#

Get the distance and azimuths between pairs of positions in geographic coordinates

This function first converts the queried station and source locations to geocentric coordinates. In practice, we projects all points from an ellipsoid of flatness (f) to a sphere of equatorial radius (a_e) though the geocentric conversion factor (W or geoco below). This is also called the parametric or reduced latitude conversion, introduced by Legendre and Bessel who solved problems for geodesics on the ellipsoid by transforming them to an equivalent problem for spherical geodesics by using this smaller geocentric latitude.

The spherical law of cosines formula is then used to calculate distances on this spherical geodesic of radius a_e. This procedure stretches the angular distances between adjacent geographic latitudes nearer to the poles and equator, which imitates the behavior in an ellipsoid where adjacent latitudes become finely spaced. The equatorial radius is used instead of mean radius (R) for conversion of distances to km since this conversion is strictly valid for a sphere of radius a_e and in order to obtain accurate distances near the equator.

Parameters
eplattp.Union[float,list,tuple,np.ndarray]

Latitudes of source location(s) in Geographic Coordinates

eplontp.Union[float,list,tuple,np.ndarray]

Longitudes of source location(s) in Geographic Coordinates

stlattp.Union[float,list,tuple,np.ndarray]

Latitudes of station location(s) in Geographic Coordinates

stlontp.Union[float,list,tuple,np.ndarray]

Longitudes of station location(s) in Geographic Coordinates

num_coresint, optional

Number of cores to use in the calculation, by default 1

Returns
delta,azep,azst

A tuple with elements as distance in degrees, azimuth from source(s), and backazimuth from station(s).

Authors

Raj Moulik (moulik@caa.columbia.edu)

Last Modified

2023.02.16 5.00

avni.mapping.ellipsoidal.delazgc_helper(args)[source]#

A helper function to parallelize ddelazgc

avni.mapping.ellipsoidal.geographic_to_geocentric(latin: float) float[source]#

Convert a geographic latitude to geocentric latitude

Parameters
latinfloat

Input latitude in geographic coordinate

Returns
float

Output geocentric latitude

Authors

Raj Moulik (moulik@caa.columbia.edu)

Last Modified

2023.02.16 5.00

avni.mapping.ellipsoidal.geocentric_to_geographic(latin: float) float[source]#

Convert a geocentric coordinate to geographic coordinate

Parameters
latinfloat

Input latitude in geocentric coordinate

Returns
float

Output geographic latitude

Authors

Raj Moulik (moulik@caa.columbia.edu)

Last Modified

2023.02.16 5.00

avni.mapping.ellipsoidal.inpolygon(latitude: Union[float, list, tuple, numpy.ndarray], longitude: Union[float, list, tuple, numpy.ndarray], polygon_latitude: Union[list, tuple, numpy.ndarray], polygon_longitude: Union[list, tuple, numpy.ndarray], num_cores: int = 1, orientation: str = 'anti-clockwise', threshold: float = 1e-06) Union[numpy.ndarray, bool][source]#

Finds whether a (set of) point(s) is(are) within a closed polygon

Parameters
latitude,longitudetp.Union[float,list,tuple,np.ndarray]

Set of queried locations in Geographic Coordinates

polygon_latitude,polygon_longitudetp.Union[list,tuple,np.ndarray]

Closed points that define the polygon. First and last points need to be the same.

num_coresint, optional

Number of cores to use for the calculations, by default 1

orientationstr, optional

clockwise or anti-clockwise orientation of points specified above, by default ‘anti-clockwise’

thresholdfloat, optional

Limit to which the sum of azimuth check to (-)360 degrees is permitted to be defined as within the polygon, by default 1E-6

Returns
tp.Union[np.ndarray,bool]

Logical array of bool(s) containing the same number of elements as latitude/longitude

Authors

Raj Moulik (moulik@caa.columbia.edu)

Last Modified

2023.02.16 5.00