SWMMLoader
Read EPA SWMM input files (.inp) into Apache Arrow tables.
EPA SWMM is the US EPA Storm Water Management Model. It is public domain software.
| SWMMLoader | |
|---|---|
| File extension | .inp |
| File type | Text |
| Output | Named Arrow tables (shape: 'tables') |
| Content check | [TITLE], [OPTIONS] or [JUNCTIONS] in the first 4 kB |
Usage
import { load } from "@loaders.gl/core";
import { getSWMMTable, SWMMLoader } from "@loaders.gl/graphs/swmm";
const model = await load("Example1.inp", SWMMLoader, {
swmm: { crs: "EPSG:32164" },
});
const nodes = getSWMMTable(model, "nodes");
For synchronous parsing, import SWMMLoaderWithParser from @loaders.gl/graphs/swmm/bundled
and pass it to parseSync from @loaders.gl/core.
The @loaders.gl/graphs/swmm subpath exports metadata only. Asynchronous core APIs load the parser.
Options
| Option | Type | Default | Description |
|---|---|---|---|
swmm.crs | string | undefined | Coordinate reference system of the model. The loader stores it as swmm:crs in the Arrow schema metadata of the nodes, edges and subcatchments tables. |
SWMM files do not store a coordinate reference system.
Set swmm.crs to record the system that the model coordinates use.
const crs = nodes.schema.metadata.get("swmm:crs"); // 'EPSG:32164'
API
| Export | Kind |
|---|---|
SWMMLoader | Loader |
SWMMLoaderOptions | Type |
SWMMLoaderWithParser | Loader |
getSWMMTable | Function |
SWMMTables | Type |
SWMMTableName | Type |
getSWMMTable(tables, name) returns the named table, for example nodes or edges.
It throws an error when the table is absent. Import it from @loaders.gl/graphs/swmm.
The nodes and edges tables start with the columns of the other graph loaders:
id, label and attributes for nodes, and id, sourceId, targetId, directed, label and attributes for edges.
directed is always true. attributes is a typed Struct with one child Struct per object kind.
See SWMM input format for the output tables.
To read the binary results of a SWMM run (.out), use SWMMOutputLoader.