ripple1d.hecstac.common package#

Submodules#

ripple1d.hecstac.common.asset_factory module#

Create instances of assets.

class ripple1d.hecstac.common.asset_factory.AssetFactory(extension_to_asset)#

Bases: object

Factory for creating HEC asset instances based on file extensions.

asset_from_dict(asset)#

Create HEC asset given a base Asset and a map of file extensions dict.

class ripple1d.hecstac.common.asset_factory.GenericAsset(*args, **kwargs)#

Bases: Asset, Generic[T]

Provides a base structure for assets.

property crs: CRS#

Get the authority code for the model CRS.

property extra_fields#

Return extra fields.

property file: T#

Return cached file or instantiate new.

name_from_suffix(suffix)#

Generate a name by appending a suffix to the file stem.

Return type:

str

regex_parse_str: str = ''#
property roles: list[str]#

Return roles with enforced values.

ripple1d.hecstac.common.base_io module#

ripple1d.hecstac.common.consts module#

Common constants for HECSTAC.

ripple1d.hecstac.common.geometry module#

Geometry utils.

ripple1d.hecstac.common.geometry.reproject_to_wgs84(geom, crs)#

Convert geometry CRS to EPSG:4326 for stac item geometry.

Return type:

Geometry

ripple1d.hecstac.common.path_manager module#

Path manager.

class ripple1d.hecstac.common.path_manager.LocalPathManager(model_root_dir)#

Bases: object

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

derived_item_asset(filename)#

Derive item asset path.

Return type:

str

property item_dir: str#

Duplicate of model_root, added for clarity in the calling code.

item_path(item_id)#

Item path.

Return type:

str

property model_parent_dir: str#

Model parent directory.

property model_root_dir: str#

Model root directory.

ripple1d.hecstac.common.s3_utils module#

Utilities for S3.

ripple1d.hecstac.common.s3_utils.make_uri_public(uri)#

Convert from an AWS S3 URI to an https url.

Return type:

str

ripple1d.hecstac.common.s3_utils.parse_s3_url(s3_url)#

Extract the bucket name and path from an S3 URL.

Parameters:

s3_url (str) – The S3 URL (e.g., ‘s3://my-bucket/path/to/object.txt’).

Returns:

tuple: (bucket_name, path)

ripple1d.hecstac.common.s3_utils.save_bytes_s3(data, s3_path, content_type='')#

Upload BytesIO to S3.

ripple1d.hecstac.common.s3_utils.save_file_s3(local_path, s3_path)#

Upload BytesIO to S3.

Module contents#

Common scripts.