SuperflexPy

Run, calibrate, and validate SuperflexPy conceptual rainfall-runoff models from Caravan forcing data.

155|6|Updated Mar 31, 2026
One-click install
npx skills add https://github.com/lzwei196/KISS-Knowledge-Infrastructure-for-Scientific-Simulation --skill superflexpy-lzwei196
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: SuperflexPy
Source: https://github.com/lzwei196/KISS-Knowledge-Infrastructure-for-Scientific-Simulation/tree/main/models/SuperflexPy
Command: npx skills add https://github.com/lzwei196/KISS-Knowledge-Infrastructure-for-Scientific-Simulation --skill superflexpy-lzwei196

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires superflexpy, numpy, numba, scipy, pandas, xarray, netCDF4, and includes scripts (resource) and references (resource) components.

What problem does it solve? Running the SuperflexPy conceptual hydrological modelling framework correctly requires operational knowledge scattered across docs and source code: element-specific input ordering, unit conventions, parameter naming, state resets between calibration trials, and silent failure modes. This Skill packages that expertise so an agent can prepare forcing, execute GR4J/HBV/HYMOD models, calibrate parameters, and validate streamflow without silent scientific errors. ## Core Features & Use Cases - End-to-end pipeline tools: convert forcing (CSV or Caravan/GRDC netCDF) to mm/d arrays, generate model parameters with calibration ranges, run simulations with Numba acceleration, and parse outputs with NSE/KGE/PBIAS metrics. - Diagnostic recovery: 21 symptom-to-remedy triplets plus documented unit traps (e.g., Caravan streamflow is basin-averaged mm/d, not m3/s; GR4J x2 positive means export/loss) prevent silent wrong answers. - Use Case: Given a GRDC-Caravan gauge file, calibrate a GR4J model on 1981-1985 and validate on 1986-1990, producing streamflow series and cited validation metrics judged against published NSE/PBIAS bands. ## Quick Start Run python preflight_check.py in this directory, then ask the agent to calibrate a GR4J model on a Caravan gauge netCDF file and report validation NSE.

Frequently Asked Questions about SuperflexPy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run a GR4J model with SuperflexPy?

Convert forcing with convert_forcing.py, generate parameters with convert_parameters.py, then run run_superflexpy.py --model gr4j with the forcing and params JSON files. GR4J expects input arrays ordered [PET, P] in mm/d and returns streamflow Q in mm/d.

How do I calibrate SuperflexPy parameters on a catchment?

Use run_superflexpy.py --calibrate with --cal-start/--cal-end and --free-params (e.g., x1 x3 x4 x2 cpet for GR4J). The tool runs differential evolution and calls reset_states() between trials; hand-written loops that omit the reset silently fit evaluation order.

Is Caravan streamflow in m3/s or mm/d?

Caravan per-gauge netCDF streamflow is basin-averaged mm/d, not m3/s, matching SuperflexPy's Q_sim unit directly. Applying an area conversion is a silent area-squared error; this was verified against GRDC gauge 1159100.

Why does my SuperflexPy calibration give different scores for the same parameters?

SuperflexPy carries reservoir and lag state forward across get_output() calls, so repeated runs without model.reset_states() continue from prior storage. Measured differences reach 5.45 mm/d; always reset states between evaluations.

What is the GR4J x2 sign convention in SuperflexPy?

In SuperflexPy, positive x2 means export (loss) from the catchment and negative means import (gain), per the gr4j.py docstring 'Exchange flux (F), positive if loss'. Using the inverted sign silently breaks the water balance.

What are the limitations of SuperflexPy for hydrological modelling?

It is a conceptual bucket-style framework, not a physically-based distributed grid model; elements solve sequentially with no feedback loops, and snow processes require an explicit Snow Reservoir. Forcing generation, calibration data prep, and GIS delineation are external.