Skip to content
Back to skills

Docs

ASecurity

Convert observed discharge to the text format mHM reads for gauge evaluation.

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

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-a9b33dfd/badge)](https://www.skillsdirectory.com/skills/lzwei196-docs-a9b33dfd)

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
# s5_gauge Skill

## Purpose

Convert observed discharge to the text format mHM reads for gauge evaluation.

## Inputs

- Observed discharge file from HydroCraft, GRDC, HYDAT, or another source supported by `tools/s5_gauge/prepare_mhm_gauge.py`.
- Gauge id matching `idgauges.asc` from s2 and `evaluation_gauges` in s6.
- Gauge name.
- Start and end years for the output file.

## Outputs

- `<run_dir>/input/gauge/<gauge_id>.txt` or a zero-padded equivalent created by the tool.
- A five-line mHM header followed by daily rows with `YYYY MM DD HH MM Q`.

## Procedure

Convert observed discharge:

```bash
python tools/s5_gauge/prepare_mhm_gauge.py \
  --obs_file data/gauge/wangjiaba_q.csv \
  --gauge_id 51030 \
  --gauge_name Wangjiaba \
  --output_dir runs/wangjiaba/input/gauge \
  --start_year 1980 \
  --end_year 1990
```

Use the same gauge id in `tools/s2_morphology/generate_gauge_grid.py` and in `tools/s6_namelist/generate_mhm_namelists.py`.

## Verification

Check for the five header lines and six data columns:

```bash
ls runs/wangjiaba/input/gauge
sed -n '1,8p' runs/wangjiaba/input/gauge/51030.txt
awk 'NR>5 { if (NF != 6) { print "bad line", NR, NF; exit 1 } } END { print "gauge columns OK" }' \
  runs/wangjiaba/input/gauge/51030.txt
```

If the tool zero-pads the filename, pass that filename to s6 with `--gauge_filename`.

## Traps

- `dt_s13` in `../diagnostics/triplets.yaml`: four-column `YYYY MM DD Q` files make mHM parse day-of-month values as discharge.
- `dt_r04`: gauge id in `mhm.nml` must match a valid cell in `idgauges.asc`.
- `dt_v002`: a gauge can land on an L11 cell with no upstream drainage; if gauge discharge is zero but routed fields are nonzero, relocate using routed-output evidence.

## Example

For a Wangjiaba run using gauge id `51030`, create `idgauges.asc` in s2 with `--gauge_id 51030`, prepare the text file here, and pass `--gauge_id 51030 --gauge_filename 51030.txt` to s6.

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…