hecstac.common package#

Submodules#

hecstac.common.asset_factory module#

Create instances of assets.

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

create_hms_asset(fpath, item_type='model')#

Create an asset instance based on the file extension.

item_type: str

The type of item to create. This is used to determine the asset class. Options are event or model.

Return type:

Asset

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

hecstac.common.logger module#

Logging utility and setup.

class hecstac.common.logger.JsonFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)#

Bases: Formatter

Custom JSON formatter.

format(record)#

Add name and format structure.

hecstac.common.logger.get_logger(name=None)#

Get hecstac logger or a child logger.

Return type:

Logger

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

Initialize and return the hecstac logger.

Return type:

Logger

hecstac.common.path_manager module#

Path manager.

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

hecstac.common.schemas module#

Schema parsing.

Module contents#

Common scripts.