Geographic Datasets (dataset)

dataset.geonames

class GeoName(geonameid, name, asciiname, alt_names, lat, lon, feature_class, feature_code, country_code, alt_country_code, admin1_code, admin2_code, admin3_code, admin4_code, population, elevation, dem, timezone, modification_date)
property admin1_code

Alias for field number 10

property admin2_code

Alias for field number 11

property admin3_code

Alias for field number 12

property admin4_code

Alias for field number 13

property alt_country_code

Alias for field number 9

property alt_names

Alias for field number 3

property asciiname

Alias for field number 2

property country_code

Alias for field number 8

property dem

Alias for field number 16

property elevation

Alias for field number 15

property feature_class

Alias for field number 6

property feature_code

Alias for field number 7

property geonameid

Alias for field number 0

property lat

Alias for field number 4

property lon

Alias for field number 5

property modification_date

Alias for field number 18

property name

Alias for field number 1

property population

Alias for field number 14

property timezone

Alias for field number 17

class GeoName2(name, asciiname, lat, lon, population, feature_code)
property asciiname

Alias for field number 1

property feature_code

Alias for field number 5

property lat

Alias for field number 2

property lon

Alias for field number 3

property name

Alias for field number 0

property population

Alias for field number 4

download_file(fn, dirpath)[source]
positive_region(region)[source]
ascii_str(u)[source]
load(zfn, fn, minpop=1000000, region=None)[source]
load_all_keep(zfn, fn, minpop=1000000, region=None, exclude=())[source]
get_cities_region(region=None, minpop=0)[source]
get_cities_by_name(name)[source]
get_cities(lat, lon, radius, minpop=0)[source]

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/.

Note

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.

class Polygon(gshhg_file, offset, *attr)[source]

Representation of a GSHHG polygon.

property points

Points of the polygon.

Array of (lat, lon) pairs, shape (N, 2).

Return type

numpy.ndarray

is_land()[source]

Check if the polygon is land.

Return type

bool

is_lake()[source]

Check if the polygon is a lake.

Return type

bool

is_island_in_lake()[source]

Check if the polygon is an island in a lake.

Return type

bool

is_pond_in_island_in_lake()[source]

Check if the polygon is pond on an island in a lake.

Return type

bool

is_antarctic_icefront()[source]

Check if the polygon is antarctic icefront.

Return type

bool

is_antarctic_grounding_line()[source]

Check if the polygon is antarctic grounding line.

Return type

bool

contains_point(point)[source]

Check if point lies in polygon.

Parameters

point (tuple) – (lat, lon) [deg]

Return type

bool

See pyrocko.orthodrome.contains_points().

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]

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_at(lat, lon)[source]

Get all polygons whose bounding boxes contain point.

Parameters
  • lat (float) – Latitude in [deg]

  • lon (float) – Longitude in [deg]

Returns

List of Polygon

Return type

list

get_polygons_within(west, east, south, north)[source]

Get all polygons whose bounding boxes intersect with a bounding box.

Parameters
  • west (float) – Western boundary in decimal degree

  • east (float) – Eastern boundary in decimal degree

  • north (float) – Northern boundary in decimal degree

  • south (float) – Southern boundary in decimal degree

Returns

List of Polygon

Return type

list

is_point_on_land(lat, lon)[source]

Check whether a point is on land.

Lakes are considered not land.

Parameters
  • lat (float) – Latitude in [deg]

  • lon (float) – Longitude in [deg]

Return type

bool

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,)

classmethod full()[source]

Return the full-resolution GSHHG database.

classmethod high()[source]

Return the high-resolution GSHHG database.

classmethod intermediate()[source]

Return the intermediate-resolution GSHHG database.

classmethod low()[source]

Return the low-resolution GSHHG database.

classmethod crude()[source]

Return the crude-resolution GSHHG database.