Skip to main content

Create stac objects and metadata from HEC modeling software.

Project description

hecstac

CI Dev CI Documentation Status PyPI version

Utilities for creating STAC items from HEC models

hecstac is an open-source Python library designed to mine metadata from HEC model simulations for use in the development of catalogs documenting probabilistic flood studies. This project automates the generation of STAC Items and Assets from HEC-HMS and HEC-RAS model files, enabling improved data and metadata management.

Installation

This package may be installed using pip with the following command

$ pip install hecstac

Developer Setup

Create a virtual environment in the project directory:

$ python -m venv venv

Activate the virtual environment:

# For macOS/Linux
$ source ./venv/bin/activate
(venv) $

# For Windows
> ./venv/Scripts/activate

Install dev dependencies:

(venv) $ pip install ".[dev]"

Testing HEC-RAS model item creation

  • Download the HEC-RAS example project data from USACE. The data can be downloaded here.

  • Per the examples, set the ras_project_file to the path of the 2D Muncie project file (ex. ras_project_file = Example_Projects_6_6/2D Unsteady Flow Hydraulics/Muncie/Muncie.prj).

  • For projects that have projection information within the geometry .hdf files, the CRS info can automatically be detected. The Muncie data lacks that projection info so it must be set by extracting the WKT projection string and setting the CRS in 'new_ras_item.py' to the projection string. The projection can be found in the Muncie/GIS_Data folder in Muncie_IA_Clip.prj.

  • Once the CRS and project file location have been set, a new item can be created with 'python -m new_ras_item' in the command line. The new item will be added inside the model directory at the same level as the project file.

FFRD

While hecstac was created principally in support of FFRD pilot projects, the ability to create STAC based metadata items for HEC models (RAS and HMS in particular) has guided some design and implementation decisions that make it flexible enough to support more generalized use cases.

There will be modules and workflows that are very specifically designed for FFRD, and those will be generally distinguishable via ffrd in the name of the file / class function / etc. The Dockerfiles that are included in the repo are designed specifically in support of these pilots, and as such are not meant for general “out-of-the-box” use cases. For specifics on FFRD use cases please see the documentation.

CI/CD Pipeline

The CI/CD pipeline is managed with GitHub Actions and automates the build, test, and release processes.

Push to main CI/CD Process Diagram

graph LR
    A[Push to main] --> B{Run Tests};
    B --> C{Get Version};
    C --> D{Check Version};
    D -->|Version Exists| E[Fail];
    D -->|New Version| F{Docker Build & Push};
    D -->|New Version| G{Publish to PyPI};
    D -->|New Version| H{Create GitHub Release};
    A --> I{Build and Publish Docs};
    F --> J[GitHub Container Registry];
    G --> K[PyPI];
    H --> L[GitHub Release];
    subgraph Main Branch
        A[Push to main];
        I[Build and Publish Docs];
    end
    style E fill:#f94144,color:#fff
    style J fill:#90be6d,color:#fff
    style K fill:#90be6d,color:#fff
    style L fill:#90be6d,color:#fff
    style B fill:#43aa8b,color:#fff
    style C fill:#43aa8b,color:#fff
    style D fill:#43aa8b,color:#fff
    style F fill:#43aa8b,color:#fff
    style G fill:#43aa8b,color:#fff
    style H fill:#43aa8b,color:#fff
    style I fill:#43aa8b,color:#fff

Push to dev CI/CD Process Diagram

graph LR
    A[Push to dev] --> B{Run Tests};
    B --> C{Get Version};
    C --> D{Check Version};
    D -->|Version Exists| E[Warn];
    D --> F{Docker Build & Push};
    F --> G[GitHub Container Registry];
    subgraph Dev Branch
        A[Push to dev];
    end
    style E fill:#f94144,color:#fff
    style G fill:#90be6d,color:#fff
    style B fill:#43aa8b,color:#fff
    style C fill:#43aa8b,color:#fff
    style D fill:#43aa8b,color:#fff
    style F fill:#43aa8b,color:#fff

Open PR to dev/main CI/CD Process Diagram

graph LR
    A[Open PR to dev/main] --> B{Run Tests};
    B --> C{Get Version};
    C --> D{Test Docker Build};
    style B fill:#43aa8b,color:#fff
    style C fill:#43aa8b,color:#fff
    style D fill:#43aa8b,color:#fff

Docs

The Read the Docs build and publish step is triggered on push to the main branch and handled externally by Read the Docs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hecstac-0.3.0.tar.gz (69.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hecstac-0.3.0-py3-none-any.whl (75.0 kB view details)

Uploaded Python 3

File details

Details for the file hecstac-0.3.0.tar.gz.

File metadata

  • Download URL: hecstac-0.3.0.tar.gz
  • Upload date:
  • Size: 69.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for hecstac-0.3.0.tar.gz
Algorithm Hash digest
SHA256 0338756971bb858f5d7192348e0cf6f04f10d0df7278c9202a8de9587cf50e81
MD5 fd9dc8a7a9c12f7f35c6eb8a72470fc3
BLAKE2b-256 018c6f8b18dd2087652e0521bbb991548133c16cd1b6bc8fe5830bd8d93cb9c2

See more details on using hashes here.

File details

Details for the file hecstac-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: hecstac-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 75.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for hecstac-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be81632c05db6f9f19fd16f8e69d4d3fdbcc713025e057566208e9b22514587d
MD5 171c87f09b837e4c0835f240dabc284d
BLAKE2b-256 9fcb7e68c38c4898b68992041d01c52418a4009f189f612ae071a9bc6891f7f1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page