pyrocko.dataset.gshhg¶
Interface to the GSHHG (coastlines, rivers and borders) database.
The Global Self-consistent Hierarchical High-resolution Geography Database (GSHHG) is a collection of polygons representing land, lakes, rivers and political borders.
If the database is not already available, it will be downloaded automatically on first use.
For more information about GSHHG, see http://www.soest.hawaii.edu/pwessel/gshhg/.
Citation
If you use this dataset, please cite
Wessel, P., and W. H. F. Smith, A Global Self-consistent, Hierarchical, High-resolution Shoreline Database, J. Geophys. Res., 101, #B4, pp. 8741-8743, 1996.
Functions
|
Check whether two bounding boxes intersect. |
|
Check if a given bounding box meets the GSHHG conventions. |
|
Check if polygon points meet the GSHHG conventions. |
|
Check whether point is contained in a given bounding box. |
|
Check which points are contained in a given bounding box. |
Classes
|
GSHHG database access. |
|
Representation of a GSHHG polygon. |
- is_valid_bounding_box(wesn)[source]¶
Check if a given bounding box meets the GSHHG conventions.
- Parameters:
wesn – bounding box as (west, east, south, north) in [deg]
- is_valid_polygon(points)[source]¶
Check if polygon points meet the GSHHG conventions.
- Parameters:
points – Array of (lat, lon) pairs, shape (N, 2).
- points_in_bounding_box(points, wesn, tolerance=0.1)[source]¶
Check which points are contained in a given bounding box.
- Parameters:
points – Array of (lat lon) pairs, shape (N, 2) [deg].
wesn – Region tuple (west, east, south, north) [deg]
tolerance – increase the size of the test bounding box by tolerance [deg] on every side (Some GSHHG polygons have a too tight bounding box).
- Returns:
Bool array of shape (N,).
- point_in_bounding_box(point, wesn, tolerance=0.1)[source]¶
Check whether point is contained in a given bounding box.
- Parameters:
points – Array of (lat lon) pairs, shape (N, 2) [deg].
wesn – Region tuple (west, east, south, north) [deg]
tolerance – increase the size of the test bounding box by tolerance [deg] on every side (Some GSHHG polygons have a too tight bounding box).
- Return type:
- class Polygon(gshhg_file, offset, *attr)[source]¶
Bases:
object
Representation of a GSHHG polygon.
- property points¶
Points of the polygon.
Array of (lat, lon) pairs, shape (N, 2).
- Return type:
- is_pond_in_island_in_lake()[source]¶
Check if the polygon is pond on an island in a lake.
- Return type:
- is_antarctic_grounding_line()[source]¶
Check if the polygon is antarctic grounding line.
- Return type:
- contains_points(points)[source]¶
Check if points lie in polygon.
- Parameters:
points (
numpy.ndarray
) – Array of (lat lon) pairs, shape (N, 2) [deg].
See
pyrocko.orthodrome.contains_points()
.- Returns:
Bool array of shape (N,)
- class GSHHG(gshhg_file)[source]¶
Bases:
object
GSHHG database access.
This class provides methods to select relevant polygons (land, lakes, etc.) for given locations or regions. It also provides robust high-level functions to test if the Earth is dry or wet at given coordinates.
- get_polygons_within(west, east, south, north)[source]¶
Get all polygons whose bounding boxes intersect with a bounding box.
- is_point_on_land(lat, lon)[source]¶
Check whether a point is on land.
Lakes are considered not land.
- get_land_mask(points)[source]¶
Check whether given points are on land.
Lakes are considered not land.
- Parameters:
points (
numpy.ndarray
) – Array of (lat, lon) pairs, shape (N, 2).- Returns:
Boolean land mask
- Return type:
numpy.ndarray
of shape (N,)