Skip to content
Back to skills

Docs

ASecurity

Convert basin-overlapping CMFD/MSWX-style NetCDF forcing into the daily CSV format used by this KI's Python HEC-HMS engine. The implemented converter, `tools/convert_forcing_to_hms.py`, extracts basin-average precipitation, temperature, and radiation, applies unit conversions, computes PET, and writes `basin_avg_forcing.csv` plus `basin_info.json`.

  • 200 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 11, 2026
datapythonbash

Works with

  • cli

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

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
# S4: Forcing Conversion Skill

## Purpose

Convert basin-overlapping CMFD/MSWX-style NetCDF forcing into the daily CSV format
used by this KI's Python HEC-HMS engine. The implemented converter,
`tools/convert_forcing_to_hms.py`, extracts basin-average precipitation,
temperature, and radiation, applies unit conversions, computes PET, and writes
`basin_avg_forcing.csv` plus `basin_info.json`.

## Inputs

| Input | Format | Required by |
|-------|--------|-------------|
| Forcing directory | NetCDF files by year/variable | `--forcing_dir` |
| Basin shapefile | `.shp`, readable by geopandas | `--basin_shp` |
| Start and end dates | `YYYY-MM-DD` | `--start_date`, `--end_date` |

## Outputs

| Output | Format | Produced by |
|--------|--------|-------------|
| `basin_avg_forcing.csv` | daily CSV | `tools/convert_forcing_to_hms.py` |
| `basin_info.json` | JSON area and bounds | `tools/convert_forcing_to_hms.py` |
| `precip_mm` | mm/day | model forcing column |
| `temp_c` | degC | model forcing column |
| `pet_mm` | mm/day | model forcing column |

## Procedure

1. Run preflight from the KI directory:

   ```bash
   cd KISSPATH_KI_ROOT/HEC_HMS/knowledge_infrastructure
   python3 preflight_check.py
   ```

2. Convert the Bengbu CMFD forcing to the CSV expected by `tools/run_hec_hms.py`:

   ```bash
   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 \
     --output_dir ./forcing_out
   ```

3. Use `./forcing_out/basin_avg_forcing.csv` as `--forcing_csv` for
   `tools/run_hec_hms.py` and `tools/calibrate_hms.py`.

## Verification

- Confirm `./forcing_out/basin_avg_forcing.csv` has a daily date index and the
  columns `precip_mm`, `temp_c`, and usually `pet_mm`.
- Confirm `./forcing_out/basin_info.json` reports area in km2, not m2.
- Check converter output statistics: annual precipitation should not be near zero
  or above several thousand mm/yr for the Huai/Bengbu run.
- Check mean temperature is in Celsius-scale values, not Kelvin-scale values.

## Traps

- **dt_101**: CMFD precipitation rate/depth handling must match the model timestep.
  `convert_forcing_to_hms.py` detects small rate-like precipitation and multiplies
  by 86400 to produce mm/day.
- **dt_102**: CMFD temperature must be Celsius before PET calculations. The converter
  checks for Kelvin-scale values and subtracts 273.15.
- **dt_110**: Radiation must be converted from W/m2 to MJ/m2/day before PET.
- **dt_117**: Missing precipitation days filled as zero create artificial dry spells;
  inspect gap warnings before accepting the forcing CSV.
- **dt_115**: The requested simulation period must be covered by available forcing files.

## Example

```bash
cd KISSPATH_KI_ROOT/HEC_HMS/knowledge_infrastructure
mkdir -p forcing_out
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 \
  --output_dir ./forcing_out
```

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…