# SWMM Stormwater Analyzer: Flooding, Capacity, Design Storms (`jumblemog/swmm-stormwater-analyzer`) Actor

Run EPA SWMM 5.2 stormwater and sewer models (.inp) under their own rain or NOAA Atlas 14 design storms (NRCS nested). Get flooded nodes, surcharge, undersized pipes, level of service across storms, flood maps, HGL profiles, CSV, Excel, GeoJSON.

- **URL**: https://apify.com/jumblemog/swmm-stormwater-analyzer.md
- **Developed by:** [Jumble Mog](https://apify.com/jumblemog) (community)
- **Categories:** Developer tools, AI, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## SWMM Stormwater Analyzer: Flooding, Capacity, Design Storms

**Run an EPA SWMM stormwater or sewer model in one API call.** Give a SWMM input file (an `.inp` file from EPA SWMM 5, or saved in SWMM 5's format by PCSWMM, InfoSWMM, XPSWMM or a QGIS plugin) as a link, a ZIP or GitHub folder with the rainfall files it reads, an upload or pasted text, or name one of EPA's example models. List the storms to run it under: the model's own rainfall, a design storm such as `100-year 24-hour` with its depth from NOAA Atlas 14 at your site, laid out as an NRCS nested storm, or a depth such as `3.5 in over 24 hours`. The tool runs every model under every storm in EPA SWMM 5.2.4 and checks the results the way a drainage engineer would. For each model and storm you get back:

- **Flooding**: every node where water leaves the system, how much and for how long, worst first. Nodes that surcharge (water above the top of the highest pipe) or come within your freeboard of the rim. Nodes the model lets run under pressure, such as bolted covers and force mains, are told apart from surcharging.
- **Pipe capacity**: conduits that limit the flow (full at the upstream end with the water surface steeper than the pipe, SWMM's sign of an undersized pipe), conduits over their full-flow capacity, and velocities above the scour limit or below the self-cleansing velocity.
- **Ponds, pumps and outfalls**: how full each storage unit gets and when, each pump's running time, start-ups and time off its curve, and the peak flow and volume at each outfall.
- **Rain and runoff**: the rain that fell, the runoff depth and coefficient, infiltration, the largest peaks from the subcatchments, LID controls (green infrastructure) and pollutant loads when the model has them, and SWMM's continuity errors.
- **Level of service**: with two or more storms, which storm floods each node first.
- **Findings and a verdict**: each problem in a sentence that names the place and the number, worst first, plus checks of the model itself: uphill conduits, continuity errors and SWMM's own warnings.
- **Files**: a flood map, the highest water level along a line of the system (the hydraulic grade line profile), the storm and the system's flows over time, the level-of-service map, CSV tables of every node, link and subcatchment, an Excel workbook, GeoJSON, SWMM's own report and the `.inp` file that ran.

![Map of EPA SWMM Example 8 after the 100-year 24-hour storm: flooded nodes J13, J2a, J1, J12, JI3 and the wet well as red circles sized by volume, surcharged nodes in orange, conduits P2 and I6 in red where they limit the flow, and the other conduits in blues by how full they run](https://api.apify.com/v2/key-value-stores/Km5b4PG3kYHdZSb1E/records/swmm-stormwater-analyzer-flood-map.png?signature=1OaTnTAc42Qp764Rjtb1s)

*EPA's Example 8, a combined sewer with a pumped wet well, under the 100-year 24-hour storm at Columbus, Ohio (5.64 in from NOAA Atlas 14): six nodes flood 0.472 million gallons in all, J13 the most, and conduits P2 and I6 limit the flow.*

![Profile from node J13 to outfall O1: ground level, the pipes, and the highest water level, which reaches the rim at J13 and stays above the crown of pipe P5 along its whole length](https://api.apify.com/v2/key-value-stores/Km5b4PG3kYHdZSb1E/records/swmm-stormwater-analyzer-profile.png?signature=1cr4TRDXv52xI7tuWGMmU)

*The highest water level from J13 down to the outfall in the same storm: it reaches the ground at J13, where 0.154 million gallons flood out, and the pipe below it, P5, runs full along its whole length.*

![Map of the same system with each node coloured by the first storm that floods it: J1, J2a, J12, J13 and the wet well in dark blue for the 10-year 2-hour storm, JI3 in light blue for the 100-year 24-hour storm, the rest grey](https://api.apify.com/v2/key-value-stores/Km5b4PG3kYHdZSb1E/records/swmm-stormwater-analyzer-level-of-service.png?signature=1OpY2pshkfRHDrNm9KONa)

*Level of service over three storms: five nodes already flood in the 10-year 2-hour storm (2.24 in), JI3 joins them in the 100-year 24-hour storm, and the model's own 0.23-inch storm floods nothing.*

The hydrology and hydraulics are those of [EPA SWMM 5.2.4](https://www.epa.gov/water-research/storm-water-management-model-swmm), the US Environmental Protection Agency's open-source Storm Water Management Model, in the [swmm-toolkit](https://pypi.org/project/swmm-toolkit/) build that [pyswmm](https://github.com/pyswmm/pyswmm) uses. Every build of this tool runs EPA's Example 8 and checks SWMM's pipe capacities against Manning's equation and its design storms against the NRCS handbook's worked example. You install nothing: no Windows, no SWMM, no licence.

It's made for:

- Drainage and sewer engineers who want their model checked under the storms their design criteria name (the 10-year storm for pipes, the 100-year for overland flow) without opening the desktop software, or many models and storms in one go.
- Reviewers at cities and consultancies who receive SWMM models with plans and want a quick second opinion: flooding, undersized pipes, freeboard, continuity.
- Developers of stormwater apps, digital twins and dashboards who need SWMM results by API, as JSON, CSV and GeoJSON.
- Students and teachers: what a design storm does to a textbook system, in seconds.
- AI agents asked "does this storm sewer handle the 25-year storm?". A language model can't run SWMM; this tool hands it the numbers, findings and pictures as JSON and PNG.

### How to use it

1. Give **Models**: a link to an `.inp` file (or a ZIP or GitHub folder with it and the rainfall files it reads), or an EPA example's name. Uploads and pasted files work too.
2. List the **Storms**: `model` for the model's own rainfall, return periods such as `25-year 24-hour` (set the site's **location**), depths such as `3.5 in 24 h`, or the names of the model's own rainfall time series. If you like, set a **rainfall multiplier** or the **design criteria** (velocities and freeboard).
3. Click **Start**. The dataset has a row per model and storm with the verdict, a headline, every number and the findings, plus a level-of-service row per model. The pictures and files are in the run's key-value store, and `OUTPUT` sums up the run.

### How-to examples

The result lines come from runs of these inputs. The EPA examples come with the tool: they're the models of EPA's SWMM 5 Applications Manual. The linked file is a test model kept in the [pyswmm](https://github.com/pyswmm/pyswmm) repository on GitHub; the tool downloads it from its link. Design storms are for Columbus, Ohio (`39.96, -83.00`).

#### How to run an EPA SWMM .inp file online

Put the link to the `.inp` file in `models`. A GitHub or GitLab file page works, and so do raw links, Google Drive and Dropbox. When the model reads a rainfall file, put both in a ZIP or a GitHub folder, or keep them in the same folder as the linked file. To run a file from your computer, use `upload`; to paste one, `inpText`. With no `storms`, the model runs under its own rainfall.

```json
{
  "models": ["https://github.com/pyswmm/pyswmm/blob/master/pyswmm/tests/data/model_lids.inp"]
}
```

Result: pyswmm's copy of EPA's Example 1 with two LID controls and two pollutants (14 nodes, 8 subcatchments) under its own 2.65-inch storm. Node 10 floods 0.036 million gallons over 1.05 hours, conduit 6 limits the flow, and conduit 10 runs at 10.75 ft/s. Of the rain, 0.94 in runs off (a coefficient of 0.35) and 1.56 in soaks in. The three LID units in subcatchment 2 take what reaches them without overflowing, and 388 lbs of suspended solids reach the outfall. 3 seconds with the download, 1 event.

#### How to test a storm sewer against NOAA Atlas 14 design storms

Write each storm as a return period and a duration, and give the site's latitude and longitude. The depths come from NOAA Atlas 14 and each storm is laid out as an NRCS nested storm built from the site's own depths. `profile` picks the line the water level profile follows.

```json
{
  "models": ["Example8"],
  "storms": ["model", "10-year 2-hour", "100-year 24-hour"],
  "location": "39.96, -83.00",
  "profile": "J13 to O1"
}
```

Result: EPA's Example 8, a combined sewer of 31 nodes and 35 links with a pumped wet well and a force main. Atlas 14 gives 2.24 in for the 10-year 2-hour storm and 5.64 in for the 100-year 24-hour. The model's own 0.23-inch storm floods nothing. The 10-year 2-hour storm floods 5 nodes with 0.128 million gallons, and the 100-year 24-hour storm floods 6 with 0.472 million gallons, most at J13 (0.154 million gallons over 0.45 hours). Conduits P2 and I6 limit the flow, the wet well fills to the top at hour 11.8, and its pump runs 44.5% of the time with 8 start-ups. The force main's nodes, JI10 to JI12, run under pressure as the model allows (31 of the 265 ft it allows) and are reported apart from the 10 nodes that surcharge. These are the pictures at the top. About 15 seconds with the Atlas 14 lookup, 3 events.

#### How to find which storm floods each node first

Give two or more storms, smallest first. `all series` runs each of the model's own rainfall time series in turn.

```json
{
  "models": ["Example2"],
  "storms": ["all series", "100-year 6-hour", "500-year 6-hour"],
  "location": "39.96, -83.00"
}
```

Result: EPA's Example 2, the swales and culverts of a developed 29-acre site, with 12 nodes. Its own 2-, 10- and 100-year storms (0.98, 1.71 and 3.67 in) flood nothing. Atlas 14's 100-year 6-hour storm (4.32 in) floods J11, and the 500-year 6-hour storm (5.63 in) floods J2, J3 and J6 as well. The level-of-service row lists the storm that floods each node first, and its map colours them. 5 events.

#### How to check a detention pond

Run the pond under the storm it must hold. How full each storage unit gets, when, and its largest outflow are in `storageResults`.

```json
{
  "models": ["Example3"],
  "storms": ["model", "100-year 24-hour"],
  "location": "39.96, -83.00"
}
```

Result: Example 3's detention pond, SU1, holds the model's own 1.71-inch storm at 36% full and lets out up to 7.35 cfs. The 100-year 24-hour storm (5.64 in) fills it to the top at hour 12.3: 0.158 million gallons overflow there, its outlet pipe C_out carries 4.3 times its full-flow capacity, and 4 nodes come within 1 ft of the rim. 2 events.

#### How to add a climate change allowance

`rainfallMultiplier` scales all the rain, the model's own and the design storms alike: 1.2 for 20% more.

```json
{
  "models": ["Example2"],
  "storms": ["model", "100-year 6-hour"],
  "location": "39.96, -83.00",
  "rainfallMultiplier": 1.2
}
```

Result: with 20% more rain, Example 2's own 100-year storm grows from 3.67 to 4.40 in and floods 4 of the 12 nodes (0.087 million gallons, most at J11) where before it flooded none, and 4 conduits now limit the flow. The Atlas 14 100-year 6-hour storm grows from 4.32 to 5.18 in and floods 5 nodes instead of 1. Each reading of the rain is multiplied, so SWMM rains exactly 1.2 times as much. 6 seconds with the Atlas 14 lookup, 2 events.

#### How to run a long continuous simulation

A model that reads years of rainfall from a file runs as it is. Put the `.inp` and the rain file together in a ZIP or a GitHub folder. Long runs keep their results at a coarser step when they need to, and the run's status message shows how far SWMM has got.

```json
{
  "models": ["Example9"]
}
```

Result: Example 9 runs ten years, 1968 to 1977, of hourly rainfall from its rain file (110 in in all) over a site with a pond: 87,672 hours. No node floods. The pond, SU1, peaks at 41% full on 13 August 1975, and conduits C11, C3 and C10 run faster than 10 ft/s at times. The report step was raised from 15 minutes to 1 hour to keep the results file under 150 MB; SWMM's summary tables still use every routing step. 113 seconds, 99 of them SWMM's simulation, 4 events.

#### How to let an AI agent check a stormwater model

Add the tool to the agent through Apify's MCP server at `https://mcp.apify.com/?tools=jumblemog/swmm-stormwater-analyzer`. Asked whether a storm sewer handles the 100-year storm, the agent sends `{"models": ["https://.../site.inp"], "storms": ["100-year 24-hour"], "location": "39.96, -83.00"}` and reads `verdict`, `headline` and `findings`. The headline is a sentence it can pass on as it is: "100-year 24-hour (5.64 in): 6 of 31 nodes flood, 0.472 million gallons in all (most at J13: 0.154 million gallons); 10 nodes surcharge; 2 conduits limit the flow; peak outflow 91.38 cfs (all outfalls)." `floodMapPngUrl` is a picture it can show.

### FAQ

**Which files can it read?**

- **EPA SWMM 5 input files** (`.inp`) as SWMM 5.0 to 5.2 save them: US or metric units, any routing method and infiltration model, storage units, pumps, orifices, weirs, outlets, dividers, control rules, LID controls, pollutants, snowmelt and groundwater.
- **SWMM 5 files saved by other programs**: PCSWMM, InfoSWMM, XPSWMM's SWMM export and the QGIS plugins write them. Files are told apart from others by their content, so ZIPs and folders with other files in them work.
- **The files a model reads**: rainfall files (NWS formats or user-prepared), time series files and climate files, from the same ZIP or GitHub folder, or from the same folder as a linked `.inp` file. Files a model would write (`SAVE` interface files) are left out.
- **EPANET files**, which are `.inp` files too, are recognised and turned away with a clear message: they're water distribution models.
- Not read: SWMM 4 files and the native project files of other programs (InfoWorks ICM, MIKE+, HEC-RAS). Export them to SWMM 5 first.

**How accurate is it?**
It's EPA SWMM 5.2.4 itself: the flows, depths and volumes are SWMM's, read from its own report. Every build of the tool runs EPA's Example 8 under its own rain and a 3-inch design storm and checks that SWMM rains exactly the 3 inches asked for, that flow continuity holds, that every node and link has its row, and that SWMM's full-flow capacity of each of its 19 circular pipes matches Manning's equation worked out independently from their diameter, slope and roughness (the worst difference is 0.16%). The NRCS nested storm is checked against the worked example in chapter 4 of NEH 630, the NRCS National Engineering Handbook (Columbus, Ohio): the cumulative rainfall matches the handbook's figures to within 0.0001 of the total.

**How are the design storms built?**
A return period and a duration (`25-year 24-hour`) take their depth from [NOAA Atlas 14](https://hdsc.nws.noaa.gov/pfds/) at the site: the partial-duration series of NOAA's Precipitation Frequency Data Server, interpolated between its return periods and durations when needed. With the default storm shape, the depth is laid out as the NRCS nested storm built from the site's own Atlas 14 depths for 5, 10, 15 and 30 minutes and 1, 2, 3, 6, 12 and 24 hours, as WinTR-20 and NEH 630 chapter 4 build it. Each shorter duration's depth sits in the middle of the longer ones, so a 24-hour storm holds the 1-hour and 6-hour depths of the same return period. A shorter storm is the middle part of that curve; a longer one has the 24-hour storm in the middle and the rest spread evenly. Without a location, the shape is NRCS Type II. The rain falls in 6-minute steps (5, 3, 2 or 1 minute for short storms) from the model's start time, and the run goes on for `afterStormHours` (24) after it stops.

**What's the difference between flooding, surcharge and a pipe that limits the flow?**
A node floods when water leaves the system there: it spills out of a manhole or inlet onto the ground (or ponds there, when the model allows ponding). A node surcharges when the water rises above the top of the highest pipe connected to it, but stays below the rim. A conduit limits the flow when it's full at its upstream end and the water surface is steeper than the pipe, which is SWMM's sign of an undersized pipe, and a conduit is over capacity when its peak flow is above what it carries flowing just full. Nodes with a surcharge depth set in the model (bolted covers, force mains) are meant to run under pressure, so they're reported apart.

**Can it size pipes or design a system?**
No, it analyses the model you give as it is. To compare options, give each variant as its own file, or try storms and the `rainfallMultiplier`.

**Is my model kept?**
Each model is read and simulated by a separate process with no access to your Apify token, as an unprivileged user, in a temporary folder that's deleted when the run ends. The results and files stay in your own Apify storage.

### Input

| Field | What it does |
|---|---|
| `models` | One per line: a link to an `.inp` file (a GitHub or GitLab file page, a raw link, Google Drive or Dropbox), a ZIP archive or GitHub folder with `.inp` files and the rainfall files they read, or an EPA example by name: `Example1` to `Example9` (also `Example1-Pre`, `Example5-EXP`, `Example6-Initial` and `Example7-Initial`). `#text` after a ZIP or folder link takes only the files whose path holds the text. Up to 50 models. |
| `upload` | An `.inp` file, or a ZIP of models with the files they read, from your computer. |
| `inpText` | An `.inp` file pasted in. |
| `storms` | Up to 20, each run on every model: `model` (the model's own rainfall), a return period and duration (`25-year 24-hour`, `100 yr 6 hr`, `2-year 30-minute`), a depth and duration (`3.5 in 24 h`, `90 mm 6 hours`), the name of one of the model's rainfall time series, or `all series`. Empty: the model's own rainfall. |
| `location` | The site's latitude and longitude in decimal degrees, like `39.96, -83.00`, for the Atlas 14 depths. With depth storms it gives the site's own storm shape and the return period closest to each depth. |
| `stormDistribution` | `auto` (the site's NRCS nested storm with a location, NRCS Type II without), `nrcs-site`, `nrcs-type-ii` or `uniform` (the same intensity throughout). |
| `afterStormHours` | Hours the run goes on after a design storm stops (24). |
| `rainfallMultiplier` | Scales all the rain: 1.2 for a 20% climate change allowance. |
| `maxVelocity` | Conduits faster than this are flagged for scour (10 ft/s, or 3 m/s for metric models). |
| `minVelocity` | Conduits that carry flow but never reach this are flagged as places sediment can settle (2 ft/s, or 0.6 m/s). |
| `minFreeboard` | Nodes whose highest water comes within this of the rim without flooding are flagged (1 ft, or 0.3 m). |
| `profile` | The nodes the water level profile follows: two IDs (`J1 to O1`, the path between them) or a list in order. Empty: the main line, up from the outfall with the most flow along the biggest flows. |
| `outputs` | `pictures`, `tables`, `excel`, `geojson`, `report`, `inp` (all six). |
| `timeLimitSeconds` | The whole run stops by then (600 s, up to 3,300). A simulation still running at the limit stops where it is, and its tables cover the part that ran. |

### Output

- **Dataset**: a row per model and storm, with `model`, `source`, `kind`, `storm`, `stormKind`, `status`, `error`, `verdict`, `headline`, `description`, the model (`title`, `flowUnits`, `flowRouting`, `infiltration`, `elementCounts`, `nodes`, `links`, `conduits`, `subcatchmentCount`, `outfalls`), flooding and capacity (`nodesFlooded`, `floodVolume`, `worstFloodedNode`, `nodesSurcharged`, `nodesLowFreeboard`, `conduitsLimitingFlow`, `conduitsOverCapacity`, `conduitsFull`, `conduitsFast`, `conduitsSlow`, `maxVelocity`), rain and runoff (`rainfallDepth`, `runoffDepth`, `runoffCoefficient`, `peakRunoff`, `peakOutfallFlow`, `outfallVolume`), `runoffContinuityErrorPct`, `routingContinuityErrorPct`, `storageMaxPctFull`, `swmmWarnings`, `units`, `findings`, `floodedNodes`, `conduitsThatLimitFlow`, `outfallResults`, `storageResults`, `pumpResults`, `pollutantLoads`, `lidResults`, `stormDetails` (the design storm's depth, source, shape, step and peak intensity), `simulation`, `notes`, `profileNodes`, the file links and `events`.
- Each finding has a `severity` (`critical`, `warning` or `info`), a `topic` and a `text`. The `verdict` is `critical` when any finding is critical, `warning` when any is a warning, and `ok` otherwise.
- **Level of service**: with two or more storms, each model also gets a row with `rowType` `levelOfService`: `storms`, `byStorm` (the depth, nodes flooded, conduits full and flood volume of each), `nodeFirstFlooded`, `nodesThatFlood`, `conduitsThatFill`, `serviceMapPngUrl` and `levelOfServiceCsvUrl`.
- **Key-value store**: per model and storm, files named after the storm, such as `100-year-24-hour-flood-map.png`, `-hgl-profile.png`, `-hydrographs.png`, `-nodes.csv`, `-links.csv`, `-subcatchments.csv`, `-results.xlsx` (summary, findings, every table, the design storm and the system over time), `-system.geojson`, `-swmm-report.txt` and `-model.inp`, plus `level-of-service-map.png` and `level-of-service.csv`. With several models, the second one's files start with `model2-`, the third's with `model3-`, and so on.
- **OUTPUT**: the run as one JSON object, with the simulations run and failed, the Atlas 14 details and the first run's file links.

### How it works

1. Links are downloaded and uploads fetched; ZIPs and GitHub folders are unpacked, SWMM files are told apart from other files (EPANET's among them) by their content, and the rainfall and other files each model reads are found beside it.
2. The Atlas 14 depths are fetched once for the location, and each design storm is built in the model's own rain units and written into a copy of the model, which every rain gage then reads. Gages whose rain is all zeros, the model's way of giving some areas no rain of their own, are left as they are.
3. Each model and storm is run by a separate process, as an unprivileged user, in a throwaway folder. SWMM 5.2.4 simulates the copy with the report settings the analysis needs. A very long run gets a coarser report step so its results file stays under 150 MB; SWMM's summary tables still use every routing step.
4. The findings compare SWMM's report with the design criteria. The maps use the model's coordinates, vertices and subcatchment outlines, or a drawn layout when it has none.

### Pricing

You pay per simulation, a model run under one storm, at the price shown on this page. One event covers a simulation within 30 seconds at the default 2 GB memory (15 seconds at 4 GB, since the platform's cost follows memory) and 20 MB downloaded per model; each further started 30 seconds or 20 MB is one more event.

Each row's `events` says what it counted for. In the runs above, every simulation counted 1 event except Example 9's ten years of rain, which took 113 seconds and counted 4. Models and storms that can't be downloaded, read or simulated are never charged.

### Speed

Times at the default 2 GB memory, which has half a CPU core, from the runs above:

| Run | Simulations | Time |
|---|---|---|
| Example 8 (31 nodes) under 3 storms, with the Atlas 14 lookup | 3 | 15 s |
| pyswmm's LID model from its GitHub link | 1 | 3 s |
| Example 2 (12 nodes) under 2 storms, with the Atlas 14 lookup | 2 | 6 s |
| Example 9: ten years of hourly rain | 1 | 113 s |
| Example 8 and a second model from GitHub, each under 3 storms | 6 | 45 s |

Small models run a storm in a few seconds, and the pictures, workbook and files take a few seconds more. Large models with dynamic wave routing, long storms and continuous runs take longer: give them more memory (a CPU core per 4 GB) or a higher `timeLimitSeconds`. The run's status message shows how far each simulation has got.

### Tips and limits

- Up to 50 models and 20 storms a run. An `.inp` file can be up to 100 MB, a link up to 500 MB, and a run downloads up to 1 GB.
- NOAA Atlas 14 covers most of the United States and its territories, but not the Pacific Northwest. Elsewhere, give storms as depths, like `90 mm 6 hours`; they take the NRCS Type II shape.
- A design storm replaces the rain of every gage and starts at the model's start time. The model's other inflows, such as dry weather flow, stay as they are.
- `all series` runs the model's rainfall time series, not the ones that hold inflows, tides or other data.
- The rainfall multiplier multiplies each reading of the model's rain time series. Rain read from a file goes through SWMM's own rainfall adjustment instead, which SWMM 5.2 doesn't apply to each gage's first two readings; a note says so.
- SWMM files carry no coordinate system: the GeoJSON uses the model's coordinates as they are, so set the right system in QGIS or your map.
- A model with flow routing switched off gets runoff results only: no flooding or capacity checks.

### For AI agents and developers

- **Input**: `models` (links or example names), `storms`, `location`, and optionally `rainfallMultiplier` and the design criteria.
- **Output**: in the dataset, each model and storm's `verdict`, `headline`, `findings` and the numbers behind them; the level-of-service row per model; `OUTPUT` has the run's summary.
- **Errors**: a model that can't be read or simulated gets `status: "failed"` and an `error` that says why, with SWMM's own message and the line of the original file it refers to, such as `SWMM couldn't run the model: ERROR 209: undefined object * at line 56 of the [SUBCATCHMENT] section: S1 * J1 1 100 500 0.5 0`. Failed models cost nothing.

Add the tool to an agent through Apify's MCP server at `https://mcp.apify.com/?tools=jumblemog/swmm-stormwater-analyzer`. Or get the results from one HTTP call:

```bash
curl -X POST "https://api.apify.com/v2/acts/jumblemog~swmm-stormwater-analyzer/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"models": ["Example8"], "storms": ["10-year 2-hour", "100-year 24-hour"], "location": "39.96, -83.00"}'
```

### Credits

- [EPA SWMM 5.2.4](https://www.epa.gov/water-research/storm-water-management-model-swmm), the US Environmental Protection Agency's Storm Water Management Model, and the example models of its SWMM 5 Applications Manual.
- [swmm-toolkit](https://pypi.org/project/swmm-toolkit/) and [pyswmm](https://github.com/pyswmm/pyswmm), which build SWMM's engine for Python; pyswmm's test models appear in the examples above.
- [NOAA Atlas 14](https://hdsc.nws.noaa.gov/pfds/), the precipitation frequency estimates of NOAA's National Weather Service, Hydrometeorological Design Studies Center.
- The NRCS National Engineering Handbook, Part 630, Chapter 4 (Storm Rainfall Depth and Distribution), for the nested storm.
- NumPy, pandas, NetworkX, Matplotlib and openpyxl.

# Actor input Schema

## `models` (type: `array`):

One model per line. A link to an EPA SWMM 5 .inp file (as SWMM, PCSWMM, InfoSWMM, XPSWMM's SWMM export and the QGIS plugins save them), a ZIP archive or a GitHub folder holding .inp files with the rainfall files they read (add #ex3 to take only the files whose path holds ex3), a GitHub or GitLab file page, Google Drive or Dropbox. Or an example from EPA's SWMM Applications Manual by name: Example1 to Example9 (Example2 surface drainage, Example3 a detention pond, Example4 low impact development, Example7 dual drainage, Example8 a combined sewer with a pump station, Example9 a 10-year continuous simulation).

## `upload` (type: `string`):

A SWMM .inp file, or a ZIP of models with the rainfall and other files they read, from your computer; analysed together with the models above.

## `inpText` (type: `string`):

The text of a SWMM input file: \[OPTIONS], \[RAINGAGES], \[SUBCATCHMENTS], \[JUNCTIONS], \[OUTFALLS], \[CONDUITS], \[XSECTIONS] and the other sections.

## `storms` (type: `array`):

Each model runs once per storm (up to 20). "model": the model's own rainfall as it stands. A return period and duration, like "25-year 24-hour", "100 yr 6 hr" or "2-year 30-minute": the depth from NOAA Atlas 14 at the location below, laid out as an NRCS nested storm. A depth and duration, like "3.5 in 24 h" or "90 mm 6 hours". The name of one of the model's own rainfall time series, or "all series" for each of them. Empty: the model's own rainfall. With two or more storms you also get which storm floods each node first (level of service).

## `location` (type: `string`):

Decimal degrees, like "39.96, -83.00", for NOAA Atlas 14 rainfall depths (most of the United States and its territories). Needed for storms given as a return period; with depth storms, it also gives the site's own storm shape and the closest return period of the depth.

## `stormDistribution` (type: `string`):

How a design storm's depth is spread over its duration, in 6-minute steps (5, 3, 2 or 1 minute when the duration needs it). The nested storms put each shorter duration's depth in its centre, so a 24-hour storm holds the 1-hour and 6-hour depths of the same return period. Longer than 24 hours: the 24-hour storm sits in the middle with the rest spread evenly.

## `afterStormHours` (type: `number`):

Design storms start at the model's start time and the run goes on this long after the rain ends, so ponds drain and peaks pass the outfalls.

## `rainfallMultiplier` (type: `number`):

Scales all rainfall (SWMM's rainfall adjustment), such as 1.2 for a climate change allowance of 20%. Empty: as given.

## `maxVelocity` (type: `string`):

Conduits faster than this are flagged for scour: 10 ft/s or 3 m/s. A bare number is in ft/s for US models, m/s for metric ones. Empty: 10 ft/s or 3 m/s.

## `minVelocity` (type: `string`):

Conduits that carry flow but never reach this are flagged (sediment can settle): 2 ft/s or 0.6 m/s. Empty: 2 ft/s or 0.6 m/s.

## `minFreeboard` (type: `string`):

Manholes whose highest water level comes within this of the rim without flooding are flagged: 1 ft or 0.3 m. Empty: 1 ft or 0.3 m.

## `profile` (type: `string`):

The nodes the water level profile follows: two node IDs, like "J1 to O1" (the path between them), or a list of IDs in order. Empty: the main line, from the outfall with the most flow up along the biggest flows.

## `outputs` (type: `array`):

Files saved per model and storm in the run's key-value store, linked from each dataset row.

## `timeLimitSeconds` (type: `integer`):

The whole run stops by then. A simulation still running at the limit stops where it is, and its tables cover the part that ran. Large models and long continuous runs may need more.

## Actor input object example

```json
{
  "models": [
    "Example8"
  ],
  "storms": [
    "model",
    "10-year 2-hour",
    "100-year 24-hour"
  ],
  "location": "39.96, -83.00",
  "stormDistribution": "auto",
  "afterStormHours": 24,
  "outputs": [
    "pictures",
    "tables",
    "excel",
    "geojson",
    "report",
    "inp"
  ],
  "timeLimitSeconds": 600
}
```

# Actor output Schema

## `runs` (type: `string`):

A row per model and storm: verdict, headline and the main numbers.

## `capacity` (type: `string`):

Flooding, surcharge, conduits that limit the flow, velocities.

## `runoff` (type: `string`):

The storm, the runoff from the land and the outflow.

## `findings` (type: `string`):

Every finding, SWMM's warnings and the notes.

## `levelOfService` (type: `string`):

Which storm floods each node first, per model.

## `files` (type: `string`):

Links to the pictures and files of every run.

## `summary` (type: `string`):

Simulations run and failed, the message, NOAA Atlas 14 details and the first run's file links.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "models": [
        "Example8"
    ],
    "storms": [
        "model",
        "10-year 2-hour",
        "100-year 24-hour"
    ],
    "location": "39.96, -83.00"
};

// Run the Actor and wait for it to finish
const run = await client.actor("jumblemog/swmm-stormwater-analyzer").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "models": ["Example8"],
    "storms": [
        "model",
        "10-year 2-hour",
        "100-year 24-hour",
    ],
    "location": "39.96, -83.00",
}

# Run the Actor and wait for it to finish
run = client.actor("jumblemog/swmm-stormwater-analyzer").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "models": [
    "Example8"
  ],
  "storms": [
    "model",
    "10-year 2-hour",
    "100-year 24-hour"
  ],
  "location": "39.96, -83.00"
}' |
apify call jumblemog/swmm-stormwater-analyzer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,jumblemog/swmm-stormwater-analyzer"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/8XUTBfzdWIn8CdgCc/builds/zUEcijbYVKDvdda8S/openapi.json
