Skip to content
Back to skills

Docs

ASecurity

Parse the raw simulation CSV from `tools/run_hec_hms.py` into the standardized daily discharge CSV expected by validation, then compare simulated discharge against observed gauge flow. This stage is implemented by `tools/parse_hms_output.py` and `tools/validate_hms.py`.

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

Security analysis

A100/100

Pro scans all 11 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-1b2b4741/badge)](https://www.skillsdirectory.com/skills/lzwei196-docs-1b2b4741)

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
# S7: Output Parsing and Validation Skill

## Purpose

Parse the raw simulation CSV from `tools/run_hec_hms.py` into the standardized
daily discharge CSV expected by validation, then compare simulated discharge
against observed gauge flow. This stage is implemented by `tools/parse_hms_output.py`
and `tools/validate_hms.py`.

## Inputs

| Input | Format | Required by |
|-------|--------|-------------|
| Raw simulation output | CSV with `q_total_m3s` | `parse_hms_output.py --input_csv` |
| Observed discharge | Bengbu station text file | `validate_hms.py --obs_file` |
| Validation period | `YYYY-MM-DD` | `--start_date`, `--end_date` |

## Outputs

| Output | Format | Produced by |
|--------|--------|-------------|
| Parsed discharge | CSV with `sim_discharge_m3s` | `parse_hms_output.py --output_csv` |
| Validation figure | PNG | `validate_hms.py --output_figure` |
| Metrics JSON | JSON with NSE, KGE, PBIAS, r, RMSE | `validate_hms.py --output_json` |

## Procedure

1. Parse the model output and trim away the spinup year:

   ```bash
   cd KISSPATH_KI_ROOT/HEC_HMS/knowledge_infrastructure
   python3 tools/parse_hms_output.py \
     --input_csv ./output/sim_discharge.csv \
     --output_csv ./output/discharge_daily.csv \
     --start_date 1981-01-01 \
     --end_date 1990-12-31
   ```

2. Validate the parsed discharge against the Bengbu observed-flow file:

   ```bash
   python3 tools/validate_hms.py \
     --sim_csv ./output/discharge_daily.csv \
     --obs_file KISSPATH_OBS/BB/51080_bengbu.txt \
     --start_date 1981-01-01 \
     --end_date 1990-12-31 \
     --output_figure ./validation/validation.png \
     --output_json ./validation/metrics.json
   ```

3. Interpret the headline metrics using `docs/validation_convention.yaml`: discharge
   is satisfactory when NSE >= 0.50 and absolute PBIAS <= 15 percent.

## Verification

- Confirm `./output/discharge_daily.csv` contains the column `sim_discharge_m3s`.
- Confirm the parsed period starts no earlier than the validation start date.
- Confirm `./validation/metrics.json` contains NSE, KGE, PBIAS, r, RMSE, and `n_days`.
- Confirm `./validation/validation.png` is produced when `--output_figure` is supplied.

## Traps

- **dt_108**: If parsed discharge is orders of magnitude too large, check basin
  area units passed to `tools/run_hec_hms.py`.
- **dt_114**: A wrong mm-to-m3/s conversion can preserve hydrograph shape while
  corrupting magnitude.
- **dt_109**: Native DSS midnight conventions can shift time series by one day;
  this Python CSV path avoids DSS, but the trap applies if `--dss_file` is used.
- **dt_115**: Empty or short validation windows usually trace back to simulation
  dates outside forcing coverage.

## Example

```bash
cd KISSPATH_KI_ROOT/HEC_HMS/knowledge_infrastructure
mkdir -p output validation
python3 tools/parse_hms_output.py \
  --input_csv ./output/sim_discharge.csv \
  --output_csv ./output/discharge_daily.csv \
  --start_date 1981-01-01 \
  --end_date 1990-12-31
python3 tools/validate_hms.py \
  --sim_csv ./output/discharge_daily.csv \
  --obs_file KISSPATH_OBS/BB/51080_bengbu.txt \
  --start_date 1981-01-01 \
  --end_date 1990-12-31 \
  --output_figure ./validation/validation.png \
  --output_json ./validation/metrics.json
```

Files in this skill

  • format_spec.yaml22.3 KB
  • papers.json6 KB
  • s0_configuration_skill.md3.1 KB
  • s1_domain_setup_skill.md2.9 KB
  • s2_soil_parameters_skill.md3 KB
  • s4_forcing_conversion_skill.md3.1 KB
  • s5_model_execution_skill.md3.9 KB
  • s6_output_analysis_skill.md3.2 KB
  • s7_calibration_skill.md3.3 KB
  • validation_convention.yaml10.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…