Skip to content
Back to skills

Docs

ASecurity

Calibrate this KI's SCS-CN, abstraction, baseflow, recharge, and timing parameters against observed discharge using the GLUE-style random sampler implemented in `tools/calibrate_hms.py`. The calibration stage uses the same core functions as `tools/run_hec_hms.py`; it is not a separate model.

  • 231 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 11, 2026
testingpythongobash

Works with

  • cli

Security analysis

A100/100

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

Scanned November 9, 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-816833d5/badge)](https://www.skillsdirectory.com/skills/lzwei196-docs-816833d5)

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: Calibration Skill

## Purpose

Calibrate this KI's SCS-CN, abstraction, baseflow, recharge, and timing parameters
against observed discharge using the GLUE-style random sampler implemented in
`tools/calibrate_hms.py`. The calibration stage uses the same core functions as
`tools/run_hec_hms.py`; it is not a separate model.

## Inputs

| Input | Format | Required by |
|-------|--------|-------------|
| Converted forcing | CSV with `precip_mm` | `--forcing_csv` |
| Observed discharge | Bengbu station text file | `--obs_file` |
| Basin area | km2 | `--basin_area_km2` |
| Calibration dates | `YYYY-MM-DD` | `--start_date`, `--end_date` |
| Sample count | integer >= 10 | `--n_samples` |

## Outputs

| Output | Format | Produced by |
|--------|--------|-------------|
| Calibrated parameters | JSON | `--output_params` |
| `best_kge` | dimensionless | `tools/calibrate_hms.py` |
| `best_params` | JSON object | `tools/calibrate_hms.py` |
| `param_ranges_tested` | JSON object | `tools/calibrate_hms.py` |

## Procedure

1. Generate the forcing CSV first:

   ```bash
   cd KISSPATH_KI_ROOT/HEC_HMS/knowledge_infrastructure
   python3 tools/convert_forcing_to_hms.py \
     --forcing_dir KISSPATH_FORCING/huai/Data_forcing_01dy_025deg/ \
     --basin_shp KISSPATH_DATA/shp/bengbu_shp/bengbu_clip.shp \
     --start_date 1980-01-01 \
     --end_date 1990-12-31 \
     --pet_csv /path/to/pet_daily.csv \
     --output_dir ./forcing_out
   # --pet_csv is required: columns date,pet_mm (mm/day) from an identified
   # source or derivation; the converter never computes PET itself.
   ```

2. Run GLUE-style calibration on the post-spinup validation window:

   ```bash
   python3 tools/calibrate_hms.py \
     --forcing_csv ./forcing_out/basin_avg_forcing.csv \
     --obs_file KISSPATH_OBS/BB/51080_bengbu.txt \
     --basin_area_km2 121330 \
     --start_date 1981-01-01 \
     --end_date 1990-12-31 \
     --n_samples 500 \
     --output_params ./params/calibrated_params.json
   ```

3. Re-run `tools/run_hec_hms.py` with the values in `best_params`: `cn`,
   `ia_ratio`, `k_recession`, `q_base_init`, `recharge_fraction`, and the
   time-to-peak multiplier converted to an explicit `--tp_hr` if needed.

## Verification

- Confirm `./params/calibrated_params.json` contains `status: success`,
  `best_kge`, `best_params`, and `param_ranges_tested`.
- Confirm `n_samples` in the JSON matches the command line.
- Confirm `best_params.cn` remains inside the calibrated range in
  `tools/calibrate_hms.py`.
- After applying parameters, validate with `tools/validate_hms.py` and
  `docs/validation_convention.yaml`.

## Traps

- **dt_104**: Calibrating Ia ratio matters because 0.20 can understate runoff
  volume in humid/semi-humid basins.
- **dt_107**: `k_recession` is dimensionless. Parameter samples are ratios, not
  hydraulic conductivity values.
- **dt_116**: Peak timing errors are controlled by the time-to-peak scale; an
  implausible Tp for Bengbu basin area can give a good volume but wrong timing.
- **dt_105**: The execution timestep must still resolve the calibrated Tp.
- **dt_115**: Calibration silently loses information if forcing and observation
  periods do not overlap for the requested dates.

## Example

```bash
cd KISSPATH_KI_ROOT/HEC_HMS/knowledge_infrastructure
mkdir -p params
python3 tools/calibrate_hms.py \
  --forcing_csv ./forcing_out/basin_avg_forcing.csv \
  --obs_file KISSPATH_OBS/BB/51080_bengbu.txt \
  --basin_area_km2 121330 \
  --start_date 1981-01-01 \
  --end_date 1990-12-31 \
  --n_samples 500 \
  --output_params ./params/calibrated_params.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.

View all in testing →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.