pysmo.tools.azdist
Common distance and azimuth calculations using pyproj.Geod.
Functions:
| Name | Description |
|---|---|
azimuth |
Calculate azimuth between two points. |
backazimuth |
Calculate backazimuth (in DEG) between two points. |
distance |
Calculate the great circle distance (in metres) between two locations. |
DEFAULT_ELLPS
module-attribute
Default model for distance and azimuth calculations.
azimuth
azimuth(
location_1: Location,
location_2: Location,
ellps: str = DEFAULT_ELLPS,
) -> float
Calculate azimuth between two points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location_1
|
Location
|
Name of the event object providing coordinates of the origin location. |
required |
location_2
|
Location
|
Name of the station object providing coordinates of the target location. |
required |
ellps
|
str
|
Ellipsoid to use for azimuth calculation |
DEFAULT_ELLPS
|
Returns:
| Type | Description |
|---|---|
float
|
Azimuth in degrees from location 1 to location 2. |
Examples:
>>> from pysmo.classes import SAC
>>> from pysmo.tools.azdist import azimuth
>>> sac = SAC.from_file("example.sac")
>>> # the SAC class provides both event and station
>>> azimuth(sac.event, sac.station)
181.91993
>>> # Use Clarke 1966 instead of default
>>> azimuth(sac.event, sac.station, ellps='clrk66')
181.92002
>>>
Source code in src/pysmo/tools/azdist.py
backazimuth
backazimuth(
location_1: Location,
location_2: Location,
ellps: str = DEFAULT_ELLPS,
) -> float
Calculate backazimuth (in DEG) between two points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location_1
|
Location
|
Name of the event object providing coordinates of the origin location. |
required |
location_2
|
Location
|
Name of the station object providing coordinates of the target location. |
required |
ellps
|
str
|
Ellipsoid to use for azimuth calculation |
DEFAULT_ELLPS
|
Returns:
| Type | Description |
|---|---|
float
|
Backzimuth in degrees from point 2 to point 1 |
Examples:
>>> from pysmo.classes import SAC
>>> from pysmo.tools.azdist import backazimuth
>>> sac = SAC.from_file("example.sac")
>>> # the SAC class provides both event and station
>>> backazimuth(sac.event, sac.station)
2.467753
>>> # Use Clarke 1966 instead of default
>>> backazimuth(sac.event, sac.station, ellps='clrk66')
2.467847
>>>
Source code in src/pysmo/tools/azdist.py
distance
distance(
location_1: Location,
location_2: Location,
ellps: str = DEFAULT_ELLPS,
) -> float
Calculate the great circle distance (in metres) between two locations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location_1
|
Location
|
Name of the event object providing coordinates of the origin location. |
required |
location_2
|
Location
|
Name of the station object providing coordinates of the target location. |
required |
ellps
|
str
|
Ellipsoid to use for distance calculation |
DEFAULT_ELLPS
|
Returns:
| Type | Description |
|---|---|
float
|
Great Circle Distance in metres. |
Examples:
>>> from pysmo.classes import SAC
>>> from pysmo.tools.azdist import distance
>>> sac = SAC.from_file("example.sac")
>>> # the SAC class provides both event and station
>>> distance(sac.event, sac.station)
1889154.994
>>> # Use Clarke 1966 instead of default
>>> distance(sac.event, sac.station, ellps='clrk66')
1889121.778
>>>