tracktable.info.shorelines module
Module contents
- class tracktable.info.shorelines.Shoreline(resolution='low', level='L1')[source]
Bases:
objectInformation about a single shoreline
- level
Hierarchical level that contains specific information, see the build_shoreline_dict() docstring for more information
- Type:
- polygon
Shapely polygon generated from the points of the given shape
- Type:
Shapely Polygon
- global_bbox
Lower left and upper right coordinates for the bounding box that encompasses all shapes from the loaded shapefile
- Type:
- shape_bbox
Lower left and upper right coordinates for the bounding box of the given shape in [lon,lat,lon,lat] format
- Type:
- geojson
GeoJSON formated point information for the given shape
- Type:
dicts
- tracktable.info.shorelines.all_shorelines(resolution='low', level='L1')[source]
Return all the shoreline records at the given level and resolution.
- Keyword Arguments:
resolution (string) – Resolution of the shapes to pull from the shapefile. (Default: “low”)
level (string) – See the docstring for build_shoreline_dict() for more information about levels. (Default: “L1”)
- Returns:
List of shoreline objects.
- Raises:
ValueError – Unknown resolution or level
- tracktable.info.shorelines.all_shorelines_within_bounding_box(bounding_box, resolution='low', level='L1')[source]
Return all the shoreline records that exist in the given given bounding box.
- Parameters:
bounding_box (Bounding Box) – Bounding box to return all shoreline from.
- Keyword Arguments:
resolution (string) – Resolution of the shapes to pull from the shapefile. (Default: “low”)
level (string) – See the docstring for build_shoreline_dict() for more information about levels. (Default: “L1”)
- Returns:
Dictionary of shorelines from the given bounding box.
- Raises:
ValueError – Unknown resolution or level
- tracktable.info.shorelines.buffer(points, buffer=10)[source]
Return a buffered shapely polygon for the given set of points.
- Parameters:
points (Shapely Points) – Bounding box to return all shoreline from.
- Keyword Arguments:
buffer (int) – Distance to buffer in km. (Default: 10)
- Returns:
Buffered polygon.
- tracktable.info.shorelines.build_shoreline_dict(resolution='low', level='L1')[source]
Assemble the shoreline dictionary on first access
This function is called whenever the user tries to look up a shoreline. It checks to make sure the table has been populated and, if not, loads it from disk.
The geography data come in five resolutions: - full resolution: Original (full) data resolution. - high resolution: About 80 % reduction in size and quality. - intermediate resolution: Another ~80 % reduction. - low resolution: Another ~80 % reduction. - crude resolution: Another ~80 % reduction.
Unlike the shoreline polygons at all resolutions, the lower resolution rivers are not guaranteed to be free of intersections. Shorelines are furthermore organized into 6 hierarchical levels:
L1: Continental land masses and ocean islands, except Antarctica.
L2: Lakes
L3: Islands in lakes
L4: Ponds in islands within lakes
L5: Antarctica based on ice front boundary.
L6: Antarctica based on grounding line boundary.
The top 13 polygons (indices 0-12) in the L1 data are:
Index | Landmass 0 | Eurasia 1 | Africa 2 | North America 3 | South America 4 | Antarctica (AC grounding line) 5 | Antarctica (AC ice line) 6 | Australia 7 | Greenland 8 | New Guinea 9 | Borneo 10 | Madagascar 11 | Baffin Island 12 | Indonesia
- Returns:
None
- Side Effects:
Shapefile data will be loaded if not already in memory
- tracktable.info.shorelines.shoreline_information(index, resolution='low', level='L1')[source]
Retrieve a specific shoreline shape’s information. Shapes are sorted from largest to smallest.
- Parameters:
index (int) – Index of the desired shoreline to retrieve information for.
- Keyword Arguments:
resolution (string) – Resolution of the shapes to pull from the shapefile. (Default: “low”)
level (string) – See the docstring for build_shoreline_dict() for more information about levels. (Default: “L1”)
- Returns:
Shoreline object at the specified index, resolution and level.
- Raises:
KeyError – No such shoreline
ValueError – Unknown resolution or level