Skip to content
Back to skills

Docs

ASecurity

Create the mHM run directory tree and `config.json` for one basin. This stage fixes the basin name, period, three-grid resolutions, forcing source, PET mode, and mHM binary path used by all later tools.

  • 200 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 11, 2026
developmentpythonbash

Security analysis

A100/100

Pro scans all 16 files and shows the line behind each finding

Scanned September 11, 2026

npx -y skills add lzwei196/KISS---Knowledge-Infrastructure-for-Scientific-Simulation --skill docs --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Docs?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Docs
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/lzwei196-docs-65d4e3bc/badge)](https://www.skillsdirectory.com/skills/lzwei196-docs-65d4e3bc)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# s0_config Skill

## Purpose

Create the mHM run directory tree and `config.json` for one basin. This stage fixes the basin name, period, three-grid resolutions, forcing source, PET mode, and mHM binary path used by all later tools.

## Inputs

- Basin shapefile, preferably from `tools/s1_domain/delineate_basin_merit.py` when MERIT-Hydro drainage area is needed.
- Simulation start and end years.
- L0, L1, and optional L11 resolutions in meters; L1 and L11 must be integer multiples of L0.
- Forcing dataset name: `CMFD` or `MSWX`.
- PET method code compatible with later `tools/s4_forcing/convert_forcing_to_mhm.py`.
- mHM binary, normally `KISSPATH_BINARIES/mhm/mhm`.

## Outputs

- `<output_dir>/<basin_name>/config.json`
- mHM input/output directories including `input/morph`, `input/meteo/pre`, `input/meteo/tavg`, `input/meteo/pet`, `input/gauge`, `input/latlon`, `output_b1`, and `restart`.

## Procedure

Run the preflight first from the KI root:

```bash
python preflight_check.py
```

Create the run scaffold with the validated s0 tool:

```bash
python tools/s0_config/configure_mhm_basin.py \
  --basin_name wangjiaba \
  --output_dir runs \
  --shp_path runs/basin/wangjiaba_merit.shp \
  --start_year 1980 \
  --end_year 1990 \
  --resolution_l0 1000 \
  --resolution_l1 24000 \
  --resolution_l11 24000 \
  --forcing CMFD \
  --pet_method 0 \
  --mhm_binary KISSPATH_BINARIES/mhm/mhm
```

Use `--pet_method 0` when daily temperature-only forcing will be converted to input PET by `tools/s4_forcing/convert_forcing_to_mhm.py`.

## Verification

Check that `config.json` exists and that the directories referenced in it were created:

```bash
test -f runs/wangjiaba/config.json
test -d runs/wangjiaba/input/morph
test -d runs/wangjiaba/input/meteo/pre
test -d runs/wangjiaba/output_b1
python -m json.tool runs/wangjiaba/config.json >/dev/null
```

Confirm the resolution ratios before moving to s1:

```bash
python - <<'PY'
import json
c=json.load(open("runs/wangjiaba/config.json"))
for k in ("resolution_L1_m","resolution_L11_m"):
    r=c[k]/c["resolution_L0_m"]
    assert abs(r-round(r)) < 0.01, (k, r)
print("resolution ratios OK")
PY
```

## Traps

- `dt_r10` in `../diagnostics/triplets.yaml`: very fine L0 on a large basin makes mHM run about 10x slower because MPR processes every L0 cell.
- `dt_s02` and `dt_s11`: PET method and forcing variables must agree; daily CMFD with only mean temperature should use PET method 0 and Oudin PET from s4.
- `dt_r02`: L1 and L11 must be integer multiples of L0 or mHM fails with a resolution mismatch.

## Example

For the Wangjiaba setup described in `SKILL.md`, use a MERIT-derived catchment shapefile, L0 about 0.01 degrees and L1/L11 about 0.25 degrees via `1000/24000` meter settings, CMFD forcing, and `--pet_method 0`.

Files in this skill

  • REFERENCES.md1.1 KB
  • format_spec.yaml37.1 KB
  • papers.json5.2 KB
  • s0_config_skill.md2.7 KB
  • s10_regionalize_skill.md2.5 KB
  • s1_domain_skill.md2.6 KB
  • s2_morphology_skill.md3.5 KB
  • s3_mpr_skill.md2.2 KB
  • s4_forcing_skill.md2.2 KB
  • s5_gauge_skill.md1.9 KB
  • s6_namelist_skill.md2.9 KB
  • s7_execute_skill.md2 KB
  • s8_postprocess_skill.md2.4 KB
  • s9_calibration_skill.md2.6 KB
  • validation_convention.yaml12.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…