bathyreq.sources.factory
Module provides factory function to build Source
instances.
bathyreq.sources.factory.DataSource
Bases: Enum
Data sources for bathymetry data.
Attributes:
-
BLUE_TOPO
–Blue Topo data source.
-
GEBCO
–GEBCO data source.
-
NCEI
–NCEI data source.
bathyreq.sources.factory.DataSourceNotImplemented
Bases: Exception
Raised when a data source is not implemented.
bathyreq.sources.factory.Source
Bases: Protocol
Interface used within BathyRequest
to construct URL request.
build_url()
Build the URL request.
bathyreq.sources.factory.factory(bbox, source='ncei', **kwargs)
Factory function to return a source object.
Examples:
>>> from bathyreq.sources import factory
>>> inst = factory(bbox=[-117, 32, -116, 33], source="ncei")
>>> inst.build_url()
>>> url = inst.url
Parameters:
-
bbox
(list[float, float, float, float]
) –Bounding box in the form [lon_min, lat_min, lon_max, lat_max].
-
source
(str
, default:'ncei'
) –Source of the data, by default "ncei".
Returns:
-
Source
–Source object.
Raises:
-
DataSourceNotImplemented
–Raised if the data source is not implemented.