stormhub package#

Subpackages#

Submodules#

stormhub.hydro_domain module#

Hydrodomain Item class.

class stormhub.hydro_domain.HydroDomain(item_id, geometry, hydro_domain_type, relevant_datetime=None, relevant_datetime_description=None, **kwargs)#

Bases: Item

Initialize a hydrological domain Item.

Parameters:
  • item_id (str) – The ID of the Item.

  • geometry (str | Polygon) – The Item geometry.

  • hydro_domain_type (str) – Hydrological domain type. Options include ‘watershed’, ‘transposition_region’, and ‘valid_transposition_region’.

  • relevant_datetime (str | datetime, optional) – Datetime used for the item. If one is not provided then the item creation time is used.

  • relevant_datetime_description (str) – Description of the datetime.

  • **kwargs (Any) – Additional keyword arguments.

classmethod from_item(item)#

Create a HydroDomain instance from a STAC item.

Return type:

HydroDomain

load_geometry(geometry_source)#

Load geometry from str or Polygon object.

Return type:

Polygon

stormhub.logger module#

Logging utility and setup.

stormhub.logger.initialize_logger(json_logging=False, level=20)#

Initialize the logger.

stormhub.utils module#

Utility functions for stormhub.

class stormhub.utils.StacPathManager(local_catalog_dir)#

Bases: object

Build consistent paths for STAC items and collections assuming a top-level local catalog.

catalog_asset(item_id, asset_dir='hydro_domains')#

Build Catalog asset path.

Return type:

str

property catalog_dir#

Build Catalog directory path.

property catalog_file#

Build Catalog file path.

catalog_item(item_id)#

Build Catalog item path.

Return type:

str

collection_asset(collection_id, filename)#

Build Collection asset path.

Return type:

str

collection_dir(collection_id)#

Build Collection directory path.

Return type:

str

collection_file(collection_id)#

Build Collection file path.

Return type:

str

collection_item(collection_id, item_id)#

Build Collection item path.

Return type:

str

collection_item_asset(collection_id, item_id, filename)#

Build Collection item asset path.

Return type:

str

collection_item_dir(collection_id, item_id)#

Build Collection item directory path.

Return type:

str

storm_collection_id(duration)#

Build storm collection id.

Return type:

str

stormhub.utils.create_feature_collection_from_items(collection, output_geojson, select_properties='aorc:statistics')#

Generate a geojson feature collection from a collection of STAC items.

stormhub.utils.file_table(data, col1, col2)#

Convert a dictionary into a list of dictionaries, suitable for creating a table.

stormhub.utils.generate_date_range(start_date, end_date, every_n_hours=6, date_format='%Y-%m-%d', months=None)#

Generate a list of datetime objects at a given interval between start and end dates.

Return type:

List[datetime]

stormhub.utils.is_port_in_use(port=8080, host='http://localhost')#

Check if a given port is already in use.

Return type:

bool

stormhub.utils.load_config(config_file)#

Load a json config file.

Return type:

dict

stormhub.utils.validate_config(config)#

Validate a config dictionary against required keys.

Return type:

dict

stormhub.version module#

stormhub version.

Module contents#

stormhub Package.

This package provides tools and utilities to create catalogs, data, and metadata for hydrologic modeling in the cloud.