Skip to content

Septima/dhm-hydro-qc

Repository files navigation

DHM Hydro QC

QC of Danish DHM hydro adjustment objects (DHMTilpasninger). This tool processes DHM linje and hestesko (horseshoe) features by calculating consequences of sea level changes with integrated progress tracking.

The specification of the DHMTilpasninger is found in the GeoDK spec here.

Installation

Using Conda/Miniconda/Micromamba/Mamba (Recommended)

This recipe works for conda, miniconda, mamba or micromamba. Just replace the executable conda below with whatever you are using.

  1. Install package manager (if not already installed):

    See installation instructions for conda/miniconda or mamba/micromamba

  2. Create the environment:

    conda env create -f environment.yml
  3. Activate the environment:

    conda activate dhm-hydro-qc

Usage

After installation and environment activation, the dhm-hydro-qc command-line tool is available.

Commands

The tool provides two main commands for processing different DHMTilpasning feature types:

Process DHMLinje Features

dhm-hydro-qc dhmlinje <dhmlinje-file> <dtm-file> <simsearise-file> <output> [output-flooded-areas]

Arguments:

  • dhmlinje-file: Path to input DHMLinje vector file
  • dtm-file: Path to DTM raster file
  • simsearise-file: Path to sim-searise raster file
  • output: Path to output vector file for processed features
  • output-flooded-areas: (Optional) Path to output vector file for flooded area geometries

Examples:

# Without flooded areas output
dhm-hydro-qc dhmlinje \
    input_linje.fgb \
    dtm.tif \
    searise.tif \
    output_linje.fgb

# With flooded areas output
dhm-hydro-qc dhmlinje \
    input_linje.fgb \
    dtm.tif \
    searise.tif \
    output_linje.fgb \
    flooded_areas_linje.fgb

Process DHMHestesko (Horseshoe) Features

dhm-hydro-qc dhmhestesko <dhmhestesko-file> <dtm-file> <simsearise-file> <output> [output-flooded-areas] [OPTIONS]

Arguments:

  • dhmhestesko-file: Path to input DHMHestesko vector file
  • dtm-file: Path to DTM raster file
  • simsearise-file: Path to sim-searise raster file
  • output: Path to output vector file for processed features
  • output-flooded-areas: (Optional) Path to output vector file for flooded area geometries

Options:

  • --max-profile-sample-dist FLOAT: Maximum distance between samples along the horseshoe profile (default: 0.2)

Examples:

# Without flooded areas output
dhm-hydro-qc dhmhestesko \
    input_hestesko.fgb \
    dtm.tif \
    searise.tif \
    output_hestesko.fgb

# With flooded areas output
dhm-hydro-qc dhmhestesko \
    input_hestesko.fgb \
    dtm.tif \
    searise.tif \
    output_hestesko.fgb \
    flooded_areas_hestesko.fgb

# With custom sampling distance
dhm-hydro-qc dhmhestesko \
    input_hestesko.fgb \
    dtm.tif \
    searise.tif \
    output_hestesko.fgb \
    flooded_areas_hestesko.fgb \
    --max-profile-sample-dist 1.0

Arguments

  • dhmlinje-file / dhmhestesko-file: Input vector file (e.g., FlatGeobuf)
  • dtm-file: Digital Terrain Model (DTM) raster file. Must have at least same bbox as input vector.
  • simsearise-file: Simulated sea level rise raster file. Must have at least same bbox as input vector.
  • output: Output file for processed features. For now always FlatGeobuf
  • output-flooded-areas: Output file for flooded area geometries. For now always FlatGeobuf

Options

  • --max-profile-sample-dist FLOAT: Maximum distance between samples along the horseshoe profile (default: 0.2) - dhmhestesko only
  • --version: Show the version and exit
  • --help: Show help message and exit

Getting Help

# General help
dhm-hydro-qc --help

# Help for specific commands
dhm-hydro-qc dhmlinje --help
dhm-hydro-qc dhmhestesko --help

Development

Installation

  1. Install package manager (if not already installed):

    See installation instructions for conda/miniconda or mamba/micromamba

  2. Create the environment:

    conda env create -f environment-dev.yml
  3. Activate the environment:

    conda activate dhm-hydro-qc-dev
  4. Install pre-commit hooks:

    pre-commit install

Install using Make (Convenience)

# For users
make install

# For developers
make install-dev

Running Tests

pytest
# or
make test

Code Formatting

black src tests
ruff check --fix src tests
# or
make format

Linting

ruff check src tests
mypy src
# or
make lint

Building Documentation

cd docs && make html
# or
make docs

Project Structure

dhm-hydro-qc/
├── src/
│   └── dhm_hydro_qc/         # Main package code
│       ├── __init__.py
│       ├── cli.py            # Command-line interface
│       ├── geometry.py       # Geometry processing functions
│       ├── io.py             # Input/output operations
│       ├── pipeline.py       # Pipeline orchestration
│       ├── processing.py     # Core processing logic
│       └── py.typed          # PEP 561 marker for type hints
├── tests/                     # Test files
│   ├── conftest.py
│   ├── test_geometry.py
│   ├── test_io.py
│   ├── test_pipeline.py
│   └── test_processing.py
├── docs/                      # Documentation
├── notebooks/                 # Jupyter notebooks for analysis
├── scripts/                   # Utility scripts
│   └── example_script.py
├── .gitignore                # Git ignore rules
├── .pre-commit-config.yaml   # Pre-commit hooks
├── environment.yml            # Conda environment (production)
├── environment-dev.yml        # Conda environment (development)
├── pyproject.toml            # Project configuration
├── Makefile                  # Convenience commands
└── LICENSE                   # License file

License

See LICENSE file for details.

About

QC of Danish DHM hydro adjustment objects (DHMTilpasninger)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published