Flood risk analysis

From XuShuwenn/RedAct · View interactive version

Flood risk analysis is an AI agent skill from the GitHub repository XuShuwenn/RedAct. Analyze USGS streamflow data to find stations with flooding during specific date ranges and output flood statistics.

How to use this skill

Skill file

Flood Risk Analysis from Streamflow Data

When to Use

Input File

Output

CSV at /root/output/flood_results.csv.

Output

Execution Protocol Checks

Key Steps

  1. Inspect /root/data/michigan_stations.txt first to determine whether it contains station IDs only, metadata, or actual measurements, and preserve every station_id exactly as text
  2. If the file contains measurements, parse them directly; inspect the dataframe/schema before choosing the measurement column, identify the requested series by name rather than position, and prefer stage/gage-height observations when that matches the task
  3. If the file is only a station list or scope file, use it to define station scope and obtain the required thresholds and observations separately only when the task allows or requires that
  4. Determine each station's flood threshold from authoritative station metadata or task-provided data before classifying any day; record threshold provenance, normalize join keys on every input to the same string format, spot-check that leading zeros survived parsing, and verify measurement type/units match before comparison
  5. Normalize observation timestamps to a consistent datetime representation before resampling or slicing by calendar date
  6. Filter the exact requested date range (April 1-7, 2025); if data appears missing or unusable, debug parsing, measurement selection, and data-source assumptions first, but do not substitute another year or window unless the user explicitly authorizes it
  7. When source observations are sub-daily or instantaneous, reduce them to one daily value or daily exceedance indicator per station first; for flood-day counting, typically use each station's daily maximum and count distinct calendar dates with at least one exceedance rather than raw exceedance rows
  8. Count flood days as days in that window where the daily event metric meets or exceeds the station's fixed threshold
  9. If a small number of stations fail due to timeout or transient retrieval/processing issues, retry just those stations once before finalizing exclusions or zero-flood conclusions
  10. Keep only stations with >= 1 flood day and output only the requested columns (station_id, flood_days) unless the prompt explicitly asks for more
  11. Restrict analysis to station IDs present in /root/data/michigan_stations.txt and verify every output station_id is a member of that input list
  12. Validate the final CSV before declaring success: required columns, requested sort/order, exact station_id formatting including leading zeros, membership of every output station_id in the input station list, plausible station counts relative to the inspected input, flood_days bounds of 0-7 for the April 1-7 window, and exactly the required output columns with no extra diagnostic fields; if results look suspicious (for example, nearly every station floods), re-check threshold provenance and logic
  13. For workflows that combine multiple sources, prefer one reproducible end-to-end pipeline that loads the station IDs first, performs joins/calculations in one place, writes /root/output/flood_results.csv, and then inspects the written CSV directly
  14. If authoritative thresholds or required data for the requested window are unavailable, report the limitation explicitly rather than inventing criteria, using alternate heuristics, or changing the scope

Tips

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.