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MM project first."
|
| 10 |
+
]
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"cell_type": "markdown",
|
| 14 |
+
"metadata": {},
|
| 15 |
+
"source": [
|
| 16 |
+
"## 1. Load SDK"
|
| 17 |
+
]
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"cell_type": "code",
|
| 21 |
+
"execution_count": null,
|
| 22 |
+
"metadata": {},
|
| 23 |
+
"outputs": [],
|
| 24 |
+
"source": [
|
| 25 |
+
"import sys\n",
|
| 26 |
+
"import importlib\n",
|
| 27 |
+
"from pathlib import Path\n",
|
| 28 |
+
"\n",
|
| 29 |
+
"REQUIRED_SDK_VERSION = \"0.2.1\"\n",
|
| 30 |
+
"NOTEBOOK_ROOT = Path.cwd()\n",
|
| 31 |
+
"\n",
|
| 32 |
+
"# PCSWMM JupyterLab starts in the main Notebooks directory, not in the\n",
|
| 33 |
+
"# notebook's own folder. Select v0.2.1 explicitly instead of taking the\n",
|
| 34 |
+
"# first pcswmm_ai directory found by rglob().\n",
|
| 35 |
+
"preferred_roots = [\n",
|
| 36 |
+
" NOTEBOOK_ROOT / \"PCSWMM_AI_SDK_v0_2_1\",\n",
|
| 37 |
+
" NOTEBOOK_ROOT / \"PCSWMM_AI_SDK_v0_2_1\" / \"PCSWMM_AI_SDK_v0_2_1\",\n",
|
| 38 |
+
" NOTEBOOK_ROOT / \"PCSWMM_AI_SDK_v0_2\",\n",
|
| 39 |
+
" NOTEBOOK_ROOT / \"PCSWMM_AI_SDK_v0_2\" / \"PCSWMM_AI_SDK_v0_2\",\n",
|
| 40 |
+
"]\n",
|
| 41 |
+
"\n",
|
| 42 |
+
"SDK_ROOT = next(\n",
|
| 43 |
+
" (path for path in preferred_roots if (path / \"pcswmm_ai\").is_dir()),\n",
|
| 44 |
+
" None,\n",
|
| 45 |
+
")\n",
|
| 46 |
+
"\n",
|
| 47 |
+
"if SDK_ROOT is None:\n",
|
| 48 |
+
" candidates = sorted(\n",
|
| 49 |
+
" {\n",
|
| 50 |
+
" package_dir.parent\n",
|
| 51 |
+
" for package_dir in NOTEBOOK_ROOT.rglob(\"pcswmm_ai\")\n",
|
| 52 |
+
" if package_dir.is_dir()\n",
|
| 53 |
+
" and \"v0_2\" in str(package_dir.parent).lower()\n",
|
| 54 |
+
" },\n",
|
| 55 |
+
" reverse=True,\n",
|
| 56 |
+
" )\n",
|
| 57 |
+
" SDK_ROOT = candidates[0] if candidates else None\n",
|
| 58 |
+
"\n",
|
| 59 |
+
"if SDK_ROOT is None:\n",
|
| 60 |
+
" raise FileNotFoundError(\n",
|
| 61 |
+
" \"Could not locate PCSWMM AI SDK v0.2.x below:\\n\"\n",
|
| 62 |
+
" f\"{NOTEBOOK_ROOT}\"\n",
|
| 63 |
+
" )\n",
|
| 64 |
+
"\n",
|
| 65 |
+
"# Remove an earlier SDK version already cached by this kernel.\n",
|
| 66 |
+
"for module_name in list(sys.modules):\n",
|
| 67 |
+
" if module_name == \"pcswmm_ai\" or module_name.startswith(\"pcswmm_ai.\"):\n",
|
| 68 |
+
" del sys.modules[module_name]\n",
|
| 69 |
+
"\n",
|
| 70 |
+
"# Put the selected SDK ahead of v0.1 and all other paths.\n",
|
| 71 |
+
"sys.path = [\n",
|
| 72 |
+
" path for path in sys.path\n",
|
| 73 |
+
" if \"PCSWMM_AI_SDK_v0_1\" not in str(path)\n",
|
| 74 |
+
" and \"PCSWMM_AI_SDK_v0_2\" not in str(path)\n",
|
| 75 |
+
"]\n",
|
| 76 |
+
"sys.path.insert(0, str(SDK_ROOT))\n",
|
| 77 |
+
"importlib.invalidate_caches()\n",
|
| 78 |
+
"\n",
|
| 79 |
+
"from pcswmm_ai import PCSWMMClient, __version__ as SDK_VERSION\n",
|
| 80 |
+
"import pcswmm_ai\n",
|
| 81 |
+
"\n",
|
| 82 |
+
"print(\"SDK root:\", SDK_ROOT)\n",
|
| 83 |
+
"print(\"SDK package:\", Path(pcswmm_ai.__file__).resolve())\n",
|
| 84 |
+
"print(\"SDK version:\", SDK_VERSION)\n",
|
| 85 |
+
"\n",
|
| 86 |
+
"if SDK_VERSION not in {\"0.2.0\", REQUIRED_SDK_VERSION}:\n",
|
| 87 |
+
" raise RuntimeError(\n",
|
| 88 |
+
" f\"Wrong SDK version loaded: {SDK_VERSION}. \"\n",
|
| 89 |
+
" f\"Expected {REQUIRED_SDK_VERSION}.\"\n",
|
| 90 |
+
" )\n",
|
| 91 |
+
"\n",
|
| 92 |
+
"client = PCSWMMClient(pcpy)\n",
|
| 93 |
+
"\n",
|
| 94 |
+
"# Verify that the v0.2 services are present before proceeding.\n",
|
| 95 |
+
"required_services = [\n",
|
| 96 |
+
" \"objects\",\n",
|
| 97 |
+
" \"topology\",\n",
|
| 98 |
+
" \"engineering\",\n",
|
| 99 |
+
" \"result_queries\",\n",
|
| 100 |
+
"]\n",
|
| 101 |
+
"missing_services = [\n",
|
| 102 |
+
" name for name in required_services if not hasattr(client, name)\n",
|
| 103 |
+
"]\n",
|
| 104 |
+
"\n",
|
| 105 |
+
"if missing_services:\n",
|
| 106 |
+
" raise RuntimeError(\n",
|
| 107 |
+
" \"The selected SDK does not contain the v0.2 services: \"\n",
|
| 108 |
+
" + \", \".join(missing_services)\n",
|
| 109 |
+
" )\n",
|
| 110 |
+
"\n",
|
| 111 |
+
"client.health()"
|
| 112 |
+
]
|
| 113 |
+
},
|
| 114 |
+
{
|
| 115 |
+
"cell_type": "markdown",
|
| 116 |
+
"metadata": {},
|
| 117 |
+
"source": [
|
| 118 |
+
"## 2. Project and collection inventory"
|
| 119 |
+
]
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"cell_type": "code",
|
| 123 |
+
"execution_count": null,
|
| 124 |
+
"metadata": {},
|
| 125 |
+
"outputs": [],
|
| 126 |
+
"source": [
|
| 127 |
+
"import pandas as pd\n",
|
| 128 |
+
"from IPython.display import display, Markdown\n",
|
| 129 |
+
"display(pd.DataFrame(list(client.project.summary().items()),columns=[\"Property\",\"Value\"]))\n",
|
| 130 |
+
"display(pd.DataFrame(client.collections.summary()))"
|
| 131 |
+
]
|
| 132 |
+
},
|
| 133 |
+
{
|
| 134 |
+
"cell_type": "markdown",
|
| 135 |
+
"metadata": {},
|
| 136 |
+
"source": [
|
| 137 |
+
"## 3. Object tables"
|
| 138 |
+
]
|
| 139 |
+
},
|
| 140 |
+
{
|
| 141 |
+
"cell_type": "code",
|
| 142 |
+
"execution_count": null,
|
| 143 |
+
"metadata": {},
|
| 144 |
+
"outputs": [],
|
| 145 |
+
"source": [
|
| 146 |
+
"for name in [\"Nodes\",\"Links\",\"Subcatchments\",\"Storages\",\"Outfalls\",\"Conduits\"]:\n",
|
| 147 |
+
" display(Markdown(\"### \"+name))\n",
|
| 148 |
+
" display(pd.DataFrame(client.objects.collection_records(name)))"
|
| 149 |
+
]
|
| 150 |
+
},
|
| 151 |
+
{
|
| 152 |
+
"cell_type": "markdown",
|
| 153 |
+
"metadata": {},
|
| 154 |
+
"source": [
|
| 155 |
+
"## 4. GIS layers"
|
| 156 |
+
]
|
| 157 |
+
},
|
| 158 |
+
{
|
| 159 |
+
"cell_type": "code",
|
| 160 |
+
"execution_count": null,
|
| 161 |
+
"metadata": {},
|
| 162 |
+
"outputs": [],
|
| 163 |
+
"source": [
|
| 164 |
+
"layer_names=client.layers.names()\n",
|
| 165 |
+
"display(pd.DataFrame({\"Layer\":layer_names}))\n",
|
| 166 |
+
"if \"Subcatchments\" in layer_names:\n",
|
| 167 |
+
" display(pd.DataFrame(client.layers.records(\"Subcatchments\")))"
|
| 168 |
+
]
|
| 169 |
+
},
|
| 170 |
+
{
|
| 171 |
+
"cell_type": "markdown",
|
| 172 |
+
"metadata": {},
|
| 173 |
+
"source": [
|
| 174 |
+
"## 5. Topology screening"
|
| 175 |
+
]
|
| 176 |
+
},
|
| 177 |
+
{
|
| 178 |
+
"cell_type": "code",
|
| 179 |
+
"execution_count": null,
|
| 180 |
+
"metadata": {},
|
| 181 |
+
"outputs": [],
|
| 182 |
+
"source": [
|
| 183 |
+
"display(Markdown(\"### Link endpoints\"))\n",
|
| 184 |
+
"display(pd.DataFrame(client.topology.link_endpoints()))\n",
|
| 185 |
+
"display(Markdown(\"### Orphan links\"))\n",
|
| 186 |
+
"display(pd.DataFrame(client.topology.orphan_links()))\n",
|
| 187 |
+
"display(Markdown(\"### Isolated nodes\"))\n",
|
| 188 |
+
"display(pd.DataFrame(client.topology.isolated_nodes()))\n",
|
| 189 |
+
"display(Markdown(\"### Duplicate directed link pairs\"))\n",
|
| 190 |
+
"display(pd.DataFrame(client.topology.duplicate_link_pairs()))"
|
| 191 |
+
]
|
| 192 |
+
},
|
| 193 |
+
{
|
| 194 |
+
"cell_type": "markdown",
|
| 195 |
+
"metadata": {},
|
| 196 |
+
"source": [
|
| 197 |
+
"## 6. Engineering screening"
|
| 198 |
+
]
|
| 199 |
+
},
|
| 200 |
+
{
|
| 201 |
+
"cell_type": "code",
|
| 202 |
+
"execution_count": null,
|
| 203 |
+
"metadata": {},
|
| 204 |
+
"outputs": [],
|
| 205 |
+
"source": [
|
| 206 |
+
"display(pd.DataFrame(list(client.engineering.model_screening_summary().items()),columns=[\"Check\",\"Finding count\"]))\n",
|
| 207 |
+
"display(Markdown(\"### Conduit findings\"))\n",
|
| 208 |
+
"display(pd.DataFrame(client.engineering.conduit_screening()))\n",
|
| 209 |
+
"display(Markdown(\"### Subcatchment findings\"))\n",
|
| 210 |
+
"display(pd.DataFrame(client.engineering.subcatchment_screening()))"
|
| 211 |
+
]
|
| 212 |
+
},
|
| 213 |
+
{
|
| 214 |
+
"cell_type": "markdown",
|
| 215 |
+
"metadata": {},
|
| 216 |
+
"source": [
|
| 217 |
+
"## 7. Run simulation (explicit)"
|
| 218 |
+
]
|
| 219 |
+
},
|
| 220 |
+
{
|
| 221 |
+
"cell_type": "code",
|
| 222 |
+
"execution_count": null,
|
| 223 |
+
"metadata": {},
|
| 224 |
+
"outputs": [],
|
| 225 |
+
"source": [
|
| 226 |
+
"# Uncomment to run:\n",
|
| 227 |
+
"# display(pd.DataFrame([client.simulation.run()]))"
|
| 228 |
+
]
|
| 229 |
+
},
|
| 230 |
+
{
|
| 231 |
+
"cell_type": "markdown",
|
| 232 |
+
"metadata": {},
|
| 233 |
+
"source": [
|
| 234 |
+
"## 8. Peak flow query"
|
| 235 |
+
]
|
| 236 |
+
},
|
| 237 |
+
{
|
| 238 |
+
"cell_type": "code",
|
| 239 |
+
"execution_count": null,
|
| 240 |
+
"metadata": {},
|
| 241 |
+
"outputs": [],
|
| 242 |
+
"source": [
|
| 243 |
+
"# Uncomment after confirming units and result availability:\n",
|
| 244 |
+
"# peaks=pd.DataFrame(client.result_queries.peak_for_objects(\"Links\",\"Flow\",\"CMS\",client.collections.keys(\"Links\")))\n",
|
| 245 |
+
"# display(peaks.sort_values(\"maximum\",ascending=False))"
|
| 246 |
+
]
|
| 247 |
+
},
|
| 248 |
+
{
|
| 249 |
+
"cell_type": "markdown",
|
| 250 |
+
"metadata": {},
|
| 251 |
+
"source": [
|
| 252 |
+
"## 9. Controlled commands"
|
| 253 |
+
]
|
| 254 |
+
},
|
| 255 |
+
{
|
| 256 |
+
"cell_type": "code",
|
| 257 |
+
"execution_count": null,
|
| 258 |
+
"metadata": {},
|
| 259 |
+
"outputs": [],
|
| 260 |
+
"source": [
|
| 261 |
+
"def execute_command(command):\n",
|
| 262 |
+
" c=command.strip().lower()\n",
|
| 263 |
+
" if c==\"project summary\": return pd.DataFrame(list(client.project.summary().items()),columns=[\"Property\",\"Value\"])\n",
|
| 264 |
+
" if c==\"model inventory\": return pd.DataFrame(client.collections.summary())\n",
|
| 265 |
+
" if c==\"list nodes\": return pd.DataFrame({\"Node\":client.collections.keys(\"Nodes\")})\n",
|
| 266 |
+
" if c==\"list links\": return pd.DataFrame({\"Link\":client.collections.keys(\"Links\")})\n",
|
| 267 |
+
" if c==\"topology review\": return {\"orphan_links\":client.topology.orphan_links(),\"isolated_nodes\":client.topology.isolated_nodes(),\"duplicate_link_pairs\":client.topology.duplicate_link_pairs()}\n",
|
| 268 |
+
" if c==\"engineering review\": return client.engineering.model_screening_summary()\n",
|
| 269 |
+
" mapping={\"show nodes\":\"Nodes\",\"show links\":\"Links\",\"show subcatchments\":\"Subcatchments\",\"show storages\":\"Storages\",\"show outfalls\":\"Outfalls\"}\n",
|
| 270 |
+
" if c in mapping: return pd.DataFrame(client.objects.collection_records(mapping[c]))\n",
|
| 271 |
+
" return {\"error\":\"Unsupported command\",\"supported\":[\"project summary\",\"model inventory\",\"list nodes\",\"list links\",\"show nodes\",\"show links\",\"show subcatchments\",\"show storages\",\"show outfalls\",\"topology review\",\"engineering review\"]}\n",
|
| 272 |
+
"# execute_command(\"engineering review\")"
|
| 273 |
+
]
|
| 274 |
+
},
|
| 275 |
+
{
|
| 276 |
+
"cell_type": "markdown",
|
| 277 |
+
"metadata": {},
|
| 278 |
+
"source": [
|
| 279 |
+
"Screening results identify conditions for engineering review; they do not independently establish municipal non-compliance."
|
| 280 |
+
]
|
| 281 |
+
}
|
| 282 |
+
],
|
| 283 |
+
"metadata": {
|
| 284 |
+
"kernelspec": {
|
| 285 |
+
"display_name": "Python 3 (ipykernel)",
|
| 286 |
+
"language": "python",
|
| 287 |
+
"name": "python3"
|
| 288 |
+
},
|
| 289 |
+
"language_info": {
|
| 290 |
+
"name": "python",
|
| 291 |
+
"version": "3.10"
|
| 292 |
+
}
|
| 293 |
+
},
|
| 294 |
+
"nbformat": 4,
|
| 295 |
+
"nbformat_minor": 5
|
| 296 |
+
}
|
examples/PCSWMM_AI_SDK_Quickstart.ipynb
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"# PCSWMM AI SDK \u2014 Quickstart v0.1\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"This notebook uses PCSWMM's injected `pcpy` object through a reusable,\n",
|
| 10 |
+
"read-only SDK.\n",
|
| 11 |
+
"\n",
|
| 12 |
+
"**Open a PCSWMM project before running the cells below.**"
|
| 13 |
+
]
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"cell_type": "markdown",
|
| 17 |
+
"metadata": {},
|
| 18 |
+
"source": [
|
| 19 |
+
"## 1. Load the SDK"
|
| 20 |
+
]
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"cell_type": "code",
|
| 24 |
+
"execution_count": null,
|
| 25 |
+
"metadata": {},
|
| 26 |
+
"outputs": [],
|
| 27 |
+
"source": [
|
| 28 |
+
"import os\n",
|
| 29 |
+
"import sys\n",
|
| 30 |
+
"from pathlib import Path\n",
|
| 31 |
+
"\n",
|
| 32 |
+
"# This notebook is stored in: <SDK folder>/examples/\n",
|
| 33 |
+
"SDK_ROOT = Path.cwd().parent\n",
|
| 34 |
+
"if str(SDK_ROOT) not in sys.path:\n",
|
| 35 |
+
" sys.path.insert(0, str(SDK_ROOT))\n",
|
| 36 |
+
"\n",
|
| 37 |
+
"from pcswmm_ai import PCSWMMClient\n",
|
| 38 |
+
"\n",
|
| 39 |
+
"client = PCSWMMClient(pcpy)\n",
|
| 40 |
+
"client.health()"
|
| 41 |
+
]
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"cell_type": "markdown",
|
| 45 |
+
"metadata": {},
|
| 46 |
+
"source": [
|
| 47 |
+
"## 2. Active project summary"
|
| 48 |
+
]
|
| 49 |
+
},
|
| 50 |
+
{
|
| 51 |
+
"cell_type": "code",
|
| 52 |
+
"execution_count": null,
|
| 53 |
+
"metadata": {},
|
| 54 |
+
"outputs": [],
|
| 55 |
+
"source": [
|
| 56 |
+
"import pandas as pd\n",
|
| 57 |
+
"\n",
|
| 58 |
+
"project_df = pd.DataFrame(\n",
|
| 59 |
+
" list(client.project.summary().items()),\n",
|
| 60 |
+
" columns=[\"Property\", \"Value\"],\n",
|
| 61 |
+
")\n",
|
| 62 |
+
"display(project_df)"
|
| 63 |
+
]
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"cell_type": "markdown",
|
| 67 |
+
"metadata": {},
|
| 68 |
+
"source": [
|
| 69 |
+
"## 3. SWMM collection inventory"
|
| 70 |
+
]
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"cell_type": "code",
|
| 74 |
+
"execution_count": null,
|
| 75 |
+
"metadata": {},
|
| 76 |
+
"outputs": [],
|
| 77 |
+
"source": [
|
| 78 |
+
"collection_df = pd.DataFrame(client.collections.summary())\n",
|
| 79 |
+
"display(collection_df)"
|
| 80 |
+
]
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"cell_type": "markdown",
|
| 84 |
+
"metadata": {},
|
| 85 |
+
"source": [
|
| 86 |
+
"## 4. List collection keys"
|
| 87 |
+
]
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"cell_type": "code",
|
| 91 |
+
"execution_count": null,
|
| 92 |
+
"metadata": {},
|
| 93 |
+
"outputs": [],
|
| 94 |
+
"source": [
|
| 95 |
+
"for collection_name in [\"Scenarios\", \"Nodes\", \"Links\", \"Subcatchments\"]:\n",
|
| 96 |
+
" print(\"\\n\", collection_name)\n",
|
| 97 |
+
" print(client.collections.keys(collection_name))"
|
| 98 |
+
]
|
| 99 |
+
},
|
| 100 |
+
{
|
| 101 |
+
"cell_type": "markdown",
|
| 102 |
+
"metadata": {},
|
| 103 |
+
"source": [
|
| 104 |
+
"## 5. Map layers"
|
| 105 |
+
]
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"cell_type": "code",
|
| 109 |
+
"execution_count": null,
|
| 110 |
+
"metadata": {},
|
| 111 |
+
"outputs": [],
|
| 112 |
+
"source": [
|
| 113 |
+
"layer_names = client.layers.names()\n",
|
| 114 |
+
"display(pd.DataFrame({\"Layer\": layer_names}))"
|
| 115 |
+
]
|
| 116 |
+
},
|
| 117 |
+
{
|
| 118 |
+
"cell_type": "markdown",
|
| 119 |
+
"metadata": {},
|
| 120 |
+
"source": [
|
| 121 |
+
"## 6. Read a layer as records"
|
| 122 |
+
]
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"cell_type": "code",
|
| 126 |
+
"execution_count": null,
|
| 127 |
+
"metadata": {},
|
| 128 |
+
"outputs": [],
|
| 129 |
+
"source": [
|
| 130 |
+
"layer_name = \"Subcatchments\"\n",
|
| 131 |
+
"\n",
|
| 132 |
+
"if layer_name in layer_names:\n",
|
| 133 |
+
" records = client.layers.records(layer_name)\n",
|
| 134 |
+
" display(pd.DataFrame(records))\n",
|
| 135 |
+
"else:\n",
|
| 136 |
+
" print(f\"{layer_name} is unavailable in the active project.\")"
|
| 137 |
+
]
|
| 138 |
+
},
|
| 139 |
+
{
|
| 140 |
+
"cell_type": "markdown",
|
| 141 |
+
"metadata": {},
|
| 142 |
+
"source": [
|
| 143 |
+
"## 7. Basic deterministic QA/QC"
|
| 144 |
+
]
|
| 145 |
+
},
|
| 146 |
+
{
|
| 147 |
+
"cell_type": "code",
|
| 148 |
+
"execution_count": null,
|
| 149 |
+
"metadata": {},
|
| 150 |
+
"outputs": [],
|
| 151 |
+
"source": [
|
| 152 |
+
"if \"Subcatchments\" in layer_names:\n",
|
| 153 |
+
" duplicates = client.qaqc.duplicate_names(\"Subcatchments\")\n",
|
| 154 |
+
" print(\"Duplicate subcatchment names:\", duplicates)"
|
| 155 |
+
]
|
| 156 |
+
},
|
| 157 |
+
{
|
| 158 |
+
"cell_type": "markdown",
|
| 159 |
+
"metadata": {},
|
| 160 |
+
"source": [
|
| 161 |
+
"## 8. Run the active model"
|
| 162 |
+
]
|
| 163 |
+
},
|
| 164 |
+
{
|
| 165 |
+
"cell_type": "code",
|
| 166 |
+
"execution_count": null,
|
| 167 |
+
"metadata": {},
|
| 168 |
+
"outputs": [],
|
| 169 |
+
"source": [
|
| 170 |
+
"# Uncomment only when ready to run the model.\n",
|
| 171 |
+
"# run_result = client.simulation.run()\n",
|
| 172 |
+
"# display(pd.DataFrame([run_result]))"
|
| 173 |
+
]
|
| 174 |
+
},
|
| 175 |
+
{
|
| 176 |
+
"cell_type": "markdown",
|
| 177 |
+
"metadata": {},
|
| 178 |
+
"source": [
|
| 179 |
+
"## 9. Retrieve a PCSWMM time series"
|
| 180 |
+
]
|
| 181 |
+
},
|
| 182 |
+
{
|
| 183 |
+
"cell_type": "code",
|
| 184 |
+
"execution_count": null,
|
| 185 |
+
"metadata": {},
|
| 186 |
+
"outputs": [],
|
| 187 |
+
"source": [
|
| 188 |
+
"# Modify these four values to match the active model and result file.\n",
|
| 189 |
+
"OBJECT_GROUP = \"Links\"\n",
|
| 190 |
+
"RESULT_VARIABLE = \"Flow\"\n",
|
| 191 |
+
"UNITS = \"CMS\"\n",
|
| 192 |
+
"OBJECT_NAME = \"C_out\"\n",
|
| 193 |
+
"\n",
|
| 194 |
+
"# Uncomment after the model has been run and a graph file is available.\n",
|
| 195 |
+
"# records = client.results.timeseries(\n",
|
| 196 |
+
"# OBJECT_GROUP,\n",
|
| 197 |
+
"# RESULT_VARIABLE,\n",
|
| 198 |
+
"# UNITS,\n",
|
| 199 |
+
"# OBJECT_NAME,\n",
|
| 200 |
+
"# )\n",
|
| 201 |
+
"# display(pd.DataFrame(records).head())\n",
|
| 202 |
+
"# client.results.summarize(records)"
|
| 203 |
+
]
|
| 204 |
+
},
|
| 205 |
+
{
|
| 206 |
+
"cell_type": "markdown",
|
| 207 |
+
"metadata": {},
|
| 208 |
+
"source": [
|
| 209 |
+
"## Verification targets\n",
|
| 210 |
+
"\n",
|
| 211 |
+
"The first test is successful when:\n",
|
| 212 |
+
"\n",
|
| 213 |
+
"- `client.health()` shows the PCSWMM runtime type;\n",
|
| 214 |
+
"- the active project metadata appears;\n",
|
| 215 |
+
"- collection counts match the PCSWMM model;\n",
|
| 216 |
+
"- map layers are listed;\n",
|
| 217 |
+
"- subcatchment records appear as a DataFrame.\n",
|
| 218 |
+
"\n",
|
| 219 |
+
"The simulation and time-series cells are intentionally commented to prevent\n",
|
| 220 |
+
"unintended model execution."
|
| 221 |
+
]
|
| 222 |
+
}
|
| 223 |
+
],
|
| 224 |
+
"metadata": {
|
| 225 |
+
"kernelspec": {
|
| 226 |
+
"display_name": "Python 3 (ipykernel)",
|
| 227 |
+
"language": "python",
|
| 228 |
+
"name": "python3"
|
| 229 |
+
},
|
| 230 |
+
"language_info": {
|
| 231 |
+
"name": "python",
|
| 232 |
+
"version": "3.10"
|
| 233 |
+
}
|
| 234 |
+
},
|
| 235 |
+
"nbformat": 4,
|
| 236 |
+
"nbformat_minor": 5
|
| 237 |
+
}
|
examples/PCSWMM_Engineering_Review_Dashboard_v0_3.ipynb
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"# PCSWMM Engineering Review Dashboard v0.3\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"Deterministic, read-only hydrology, pond, topology, scenario, and model QA/QC.\n",
|
| 10 |
+
"\n",
|
| 11 |
+
"**Open a PCSWMM project before running this notebook.**"
|
| 12 |
+
]
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"cell_type": "markdown",
|
| 16 |
+
"metadata": {},
|
| 17 |
+
"source": [
|
| 18 |
+
"## 1. Load the matching SDK"
|
| 19 |
+
]
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"cell_type": "code",
|
| 23 |
+
"execution_count": null,
|
| 24 |
+
"metadata": {},
|
| 25 |
+
"outputs": [],
|
| 26 |
+
"source": [
|
| 27 |
+
"import sys\n",
|
| 28 |
+
"import importlib\n",
|
| 29 |
+
"from pathlib import Path\n",
|
| 30 |
+
"\n",
|
| 31 |
+
"REQUIRED_VERSION = \"0.3.0\"\n",
|
| 32 |
+
"ROOT = Path.cwd()\n",
|
| 33 |
+
"\n",
|
| 34 |
+
"preferred = [\n",
|
| 35 |
+
" ROOT / \"PCSWMM_Engineering_SDK_v0_3\",\n",
|
| 36 |
+
" ROOT / \"PCSWMM_Engineering_SDK_v0_3\" / \"PCSWMM_Engineering_SDK_v0_3\",\n",
|
| 37 |
+
"]\n",
|
| 38 |
+
"\n",
|
| 39 |
+
"SDK_ROOT = next(\n",
|
| 40 |
+
" (path for path in preferred if (path / \"pcswmm_ai\").is_dir()),\n",
|
| 41 |
+
" None,\n",
|
| 42 |
+
")\n",
|
| 43 |
+
"\n",
|
| 44 |
+
"if SDK_ROOT is None:\n",
|
| 45 |
+
" matches = [\n",
|
| 46 |
+
" p.parent for p in ROOT.rglob(\"pcswmm_ai\")\n",
|
| 47 |
+
" if p.is_dir() and \"Engineering_SDK_v0_3\" in str(p.parent)\n",
|
| 48 |
+
" ]\n",
|
| 49 |
+
" SDK_ROOT = matches[0] if matches else None\n",
|
| 50 |
+
"\n",
|
| 51 |
+
"if SDK_ROOT is None:\n",
|
| 52 |
+
" raise FileNotFoundError(\"PCSWMM Engineering SDK v0.3 was not found.\")\n",
|
| 53 |
+
"\n",
|
| 54 |
+
"for module_name in list(sys.modules):\n",
|
| 55 |
+
" if module_name == \"pcswmm_ai\" or module_name.startswith(\"pcswmm_ai.\"):\n",
|
| 56 |
+
" del sys.modules[module_name]\n",
|
| 57 |
+
"\n",
|
| 58 |
+
"sys.path = [\n",
|
| 59 |
+
" p for p in sys.path\n",
|
| 60 |
+
" if \"PCSWMM_AI_SDK_v0_\" not in str(p)\n",
|
| 61 |
+
" and \"PCSWMM_Engineering_SDK_v0_3\" not in str(p)\n",
|
| 62 |
+
"]\n",
|
| 63 |
+
"sys.path.insert(0, str(SDK_ROOT))\n",
|
| 64 |
+
"importlib.invalidate_caches()\n",
|
| 65 |
+
"\n",
|
| 66 |
+
"from pcswmm_ai import PCSWMMClient, __version__\n",
|
| 67 |
+
"import pcswmm_ai\n",
|
| 68 |
+
"\n",
|
| 69 |
+
"print(\"SDK root:\", SDK_ROOT)\n",
|
| 70 |
+
"print(\"SDK package:\", Path(pcswmm_ai.__file__).resolve())\n",
|
| 71 |
+
"print(\"SDK version:\", __version__)\n",
|
| 72 |
+
"\n",
|
| 73 |
+
"if __version__ != REQUIRED_VERSION:\n",
|
| 74 |
+
" raise RuntimeError(\n",
|
| 75 |
+
" f\"Expected SDK {REQUIRED_VERSION}, loaded {__version__}\"\n",
|
| 76 |
+
" )\n",
|
| 77 |
+
"\n",
|
| 78 |
+
"client = PCSWMMClient(pcpy)\n",
|
| 79 |
+
"client.health()"
|
| 80 |
+
]
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"cell_type": "markdown",
|
| 84 |
+
"metadata": {},
|
| 85 |
+
"source": [
|
| 86 |
+
"## 2. Project and model inventory"
|
| 87 |
+
]
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"cell_type": "code",
|
| 91 |
+
"execution_count": null,
|
| 92 |
+
"metadata": {},
|
| 93 |
+
"outputs": [],
|
| 94 |
+
"source": [
|
| 95 |
+
"import pandas as pd\n",
|
| 96 |
+
"from IPython.display import display, Markdown\n",
|
| 97 |
+
"\n",
|
| 98 |
+
"display(pd.DataFrame(\n",
|
| 99 |
+
" list(client.project.summary().items()),\n",
|
| 100 |
+
" columns=[\"Property\", \"Value\"],\n",
|
| 101 |
+
"))\n",
|
| 102 |
+
"display(pd.DataFrame(client.collections.summary()))"
|
| 103 |
+
]
|
| 104 |
+
},
|
| 105 |
+
{
|
| 106 |
+
"cell_type": "markdown",
|
| 107 |
+
"metadata": {},
|
| 108 |
+
"source": [
|
| 109 |
+
"## 3. Hydrology review"
|
| 110 |
+
]
|
| 111 |
+
},
|
| 112 |
+
{
|
| 113 |
+
"cell_type": "code",
|
| 114 |
+
"execution_count": null,
|
| 115 |
+
"metadata": {},
|
| 116 |
+
"outputs": [],
|
| 117 |
+
"source": [
|
| 118 |
+
"display(Markdown(\"### Hydrology summary\"))\n",
|
| 119 |
+
"display(pd.DataFrame(\n",
|
| 120 |
+
" list(client.hydrology.summary().items()),\n",
|
| 121 |
+
" columns=[\"Metric\", \"Value\"],\n",
|
| 122 |
+
"))\n",
|
| 123 |
+
"\n",
|
| 124 |
+
"display(Markdown(\"### Hydrology findings\"))\n",
|
| 125 |
+
"display(pd.DataFrame(client.hydrology.review()))"
|
| 126 |
+
]
|
| 127 |
+
},
|
| 128 |
+
{
|
| 129 |
+
"cell_type": "markdown",
|
| 130 |
+
"metadata": {},
|
| 131 |
+
"source": [
|
| 132 |
+
"## 4. Pond and outlet review"
|
| 133 |
+
]
|
| 134 |
+
},
|
| 135 |
+
{
|
| 136 |
+
"cell_type": "code",
|
| 137 |
+
"execution_count": null,
|
| 138 |
+
"metadata": {},
|
| 139 |
+
"outputs": [],
|
| 140 |
+
"source": [
|
| 141 |
+
"display(Markdown(\"### Pond summary\"))\n",
|
| 142 |
+
"display(pd.DataFrame(\n",
|
| 143 |
+
" list(client.pond.summary().items()),\n",
|
| 144 |
+
" columns=[\"Metric\", \"Value\"],\n",
|
| 145 |
+
"))\n",
|
| 146 |
+
"\n",
|
| 147 |
+
"display(Markdown(\"### Storage records\"))\n",
|
| 148 |
+
"display(pd.DataFrame(client.pond.storage_records()))\n",
|
| 149 |
+
"\n",
|
| 150 |
+
"display(Markdown(\"### Outlet structures\"))\n",
|
| 151 |
+
"display(pd.DataFrame(client.pond.outlet_records()))\n",
|
| 152 |
+
"\n",
|
| 153 |
+
"display(Markdown(\"### Pond findings\"))\n",
|
| 154 |
+
"display(pd.DataFrame(client.pond.review()))"
|
| 155 |
+
]
|
| 156 |
+
},
|
| 157 |
+
{
|
| 158 |
+
"cell_type": "markdown",
|
| 159 |
+
"metadata": {},
|
| 160 |
+
"source": [
|
| 161 |
+
"## 5. Topology review"
|
| 162 |
+
]
|
| 163 |
+
},
|
| 164 |
+
{
|
| 165 |
+
"cell_type": "code",
|
| 166 |
+
"execution_count": null,
|
| 167 |
+
"metadata": {},
|
| 168 |
+
"outputs": [],
|
| 169 |
+
"source": [
|
| 170 |
+
"display(Markdown(\"### Link endpoints\"))\n",
|
| 171 |
+
"display(pd.DataFrame(client.topology.link_endpoints()))\n",
|
| 172 |
+
"\n",
|
| 173 |
+
"display(Markdown(\"### Orphan links\"))\n",
|
| 174 |
+
"display(pd.DataFrame(client.topology.orphan_links()))\n",
|
| 175 |
+
"\n",
|
| 176 |
+
"display(Markdown(\"### Isolated nodes\"))\n",
|
| 177 |
+
"display(pd.DataFrame(client.topology.isolated_nodes()))\n",
|
| 178 |
+
"\n",
|
| 179 |
+
"display(Markdown(\"### Duplicate directed link pairs\"))\n",
|
| 180 |
+
"display(pd.DataFrame(client.topology.duplicate_link_pairs()))"
|
| 181 |
+
]
|
| 182 |
+
},
|
| 183 |
+
{
|
| 184 |
+
"cell_type": "markdown",
|
| 185 |
+
"metadata": {},
|
| 186 |
+
"source": [
|
| 187 |
+
"## 6. Scenario source-file review"
|
| 188 |
+
]
|
| 189 |
+
},
|
| 190 |
+
{
|
| 191 |
+
"cell_type": "code",
|
| 192 |
+
"execution_count": null,
|
| 193 |
+
"metadata": {},
|
| 194 |
+
"outputs": [],
|
| 195 |
+
"source": [
|
| 196 |
+
"display(pd.DataFrame(\n",
|
| 197 |
+
" list(client.scenarios.summary().items()),\n",
|
| 198 |
+
" columns=[\"Metric\", \"Value\"],\n",
|
| 199 |
+
"))\n",
|
| 200 |
+
"display(pd.DataFrame(client.scenarios.path_status()))"
|
| 201 |
+
]
|
| 202 |
+
},
|
| 203 |
+
{
|
| 204 |
+
"cell_type": "markdown",
|
| 205 |
+
"metadata": {},
|
| 206 |
+
"source": [
|
| 207 |
+
"## 7. Consolidated screening summary"
|
| 208 |
+
]
|
| 209 |
+
},
|
| 210 |
+
{
|
| 211 |
+
"cell_type": "code",
|
| 212 |
+
"execution_count": null,
|
| 213 |
+
"metadata": {},
|
| 214 |
+
"outputs": [],
|
| 215 |
+
"source": [
|
| 216 |
+
"display(pd.DataFrame(\n",
|
| 217 |
+
" list(client.engineering.model_screening_summary().items()),\n",
|
| 218 |
+
" columns=[\"Check\", \"Finding count\"],\n",
|
| 219 |
+
"))"
|
| 220 |
+
]
|
| 221 |
+
},
|
| 222 |
+
{
|
| 223 |
+
"cell_type": "markdown",
|
| 224 |
+
"metadata": {},
|
| 225 |
+
"source": [
|
| 226 |
+
"## 8. Build report-ready review package"
|
| 227 |
+
]
|
| 228 |
+
},
|
| 229 |
+
{
|
| 230 |
+
"cell_type": "code",
|
| 231 |
+
"execution_count": null,
|
| 232 |
+
"metadata": {},
|
| 233 |
+
"outputs": [],
|
| 234 |
+
"source": [
|
| 235 |
+
"review_package = client.review_report.build()\n",
|
| 236 |
+
"\n",
|
| 237 |
+
"print(\"Review classification:\")\n",
|
| 238 |
+
"print(review_package[\"classification\"])\n",
|
| 239 |
+
"\n",
|
| 240 |
+
"print(\"\\nSections:\")\n",
|
| 241 |
+
"print(list(review_package.keys()))"
|
| 242 |
+
]
|
| 243 |
+
},
|
| 244 |
+
{
|
| 245 |
+
"cell_type": "markdown",
|
| 246 |
+
"metadata": {},
|
| 247 |
+
"source": [
|
| 248 |
+
"## 9. Export review package to JSON"
|
| 249 |
+
]
|
| 250 |
+
},
|
| 251 |
+
{
|
| 252 |
+
"cell_type": "code",
|
| 253 |
+
"execution_count": null,
|
| 254 |
+
"metadata": {},
|
| 255 |
+
"outputs": [],
|
| 256 |
+
"source": [
|
| 257 |
+
"import json\n",
|
| 258 |
+
"from pathlib import Path\n",
|
| 259 |
+
"from datetime import datetime\n",
|
| 260 |
+
"\n",
|
| 261 |
+
"# Uncomment to export.\n",
|
| 262 |
+
"# export_dir = Path(client.project.summary()[\"project_folder\"]) / \"PCSWMM_Engineering_Review\"\n",
|
| 263 |
+
"# export_dir.mkdir(parents=True, exist_ok=True)\n",
|
| 264 |
+
"# export_path = export_dir / (\n",
|
| 265 |
+
"# \"engineering_review_\"\n",
|
| 266 |
+
"# + datetime.now().strftime(\"%Y%m%d_%H%M%S\")\n",
|
| 267 |
+
"# + \".json\"\n",
|
| 268 |
+
"# )\n",
|
| 269 |
+
"# export_path.write_text(\n",
|
| 270 |
+
"# json.dumps(review_package, indent=2, default=str),\n",
|
| 271 |
+
"# encoding=\"utf-8\",\n",
|
| 272 |
+
"# )\n",
|
| 273 |
+
"# print(export_path)"
|
| 274 |
+
]
|
| 275 |
+
},
|
| 276 |
+
{
|
| 277 |
+
"cell_type": "markdown",
|
| 278 |
+
"metadata": {},
|
| 279 |
+
"source": [
|
| 280 |
+
"## 10. Run simulation explicitly"
|
| 281 |
+
]
|
| 282 |
+
},
|
| 283 |
+
{
|
| 284 |
+
"cell_type": "code",
|
| 285 |
+
"execution_count": null,
|
| 286 |
+
"metadata": {},
|
| 287 |
+
"outputs": [],
|
| 288 |
+
"source": [
|
| 289 |
+
"# Uncomment only when ready to run the active model.\n",
|
| 290 |
+
"# display(pd.DataFrame([client.simulation.run()]))"
|
| 291 |
+
]
|
| 292 |
+
},
|
| 293 |
+
{
|
| 294 |
+
"cell_type": "markdown",
|
| 295 |
+
"metadata": {},
|
| 296 |
+
"source": [
|
| 297 |
+
"## 11. Hydraulic result examples"
|
| 298 |
+
]
|
| 299 |
+
},
|
| 300 |
+
{
|
| 301 |
+
"cell_type": "code",
|
| 302 |
+
"execution_count": null,
|
| 303 |
+
"metadata": {},
|
| 304 |
+
"outputs": [],
|
| 305 |
+
"source": [
|
| 306 |
+
"# Confirm PCSWMM result labels and units before uncommenting.\n",
|
| 307 |
+
"\n",
|
| 308 |
+
"# Link peak flow:\n",
|
| 309 |
+
"# display(pd.DataFrame(\n",
|
| 310 |
+
"# client.hydraulics.peak_link_results(\"Flow\", \"CMS\")\n",
|
| 311 |
+
"# ))\n",
|
| 312 |
+
"\n",
|
| 313 |
+
"# Pond peak depth:\n",
|
| 314 |
+
"# display(pd.DataFrame(\n",
|
| 315 |
+
"# client.hydraulics.peak_node_results(\n",
|
| 316 |
+
"# \"Depth\",\n",
|
| 317 |
+
"# \"m\",\n",
|
| 318 |
+
"# [\"pond\"],\n",
|
| 319 |
+
"# )\n",
|
| 320 |
+
"# ))"
|
| 321 |
+
]
|
| 322 |
+
},
|
| 323 |
+
{
|
| 324 |
+
"cell_type": "markdown",
|
| 325 |
+
"metadata": {},
|
| 326 |
+
"source": [
|
| 327 |
+
"## Engineering status\n",
|
| 328 |
+
"\n",
|
| 329 |
+
"The findings are automated screening results. They are not a substitute for\n",
|
| 330 |
+
"project-specific design criteria, municipal standards, calibration review,\n",
|
| 331 |
+
"or professional engineering judgment."
|
| 332 |
+
]
|
| 333 |
+
}
|
| 334 |
+
],
|
| 335 |
+
"metadata": {
|
| 336 |
+
"kernelspec": {
|
| 337 |
+
"display_name": "Python 3 (ipykernel)",
|
| 338 |
+
"language": "python",
|
| 339 |
+
"name": "python3"
|
| 340 |
+
},
|
| 341 |
+
"language_info": {
|
| 342 |
+
"name": "python",
|
| 343 |
+
"version": "3.10"
|
| 344 |
+
}
|
| 345 |
+
},
|
| 346 |
+
"nbformat": 4,
|
| 347 |
+
"nbformat_minor": 5
|
| 348 |
+
}
|
examples/PCSWMM_Generic_Engineering_Review_Dashboard_v0_4.ipynb
ADDED
|
@@ -0,0 +1,2123 @@
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"id": "a97e4813",
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"source": [
|
| 8 |
+
"# PCSWMM Generic Engineering Review Dashboard v0.4\n",
|
| 9 |
+
"\n",
|
| 10 |
+
"This dashboard detects the active model's features and runs only the\n",
|
| 11 |
+
"applicable deterministic review modules.\n",
|
| 12 |
+
"\n",
|
| 13 |
+
"It is not specific to a pond model."
|
| 14 |
+
]
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"cell_type": "markdown",
|
| 18 |
+
"id": "fed3f9c3",
|
| 19 |
+
"metadata": {},
|
| 20 |
+
"source": [
|
| 21 |
+
"## 1. Load SDK"
|
| 22 |
+
]
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"cell_type": "code",
|
| 26 |
+
"execution_count": 1,
|
| 27 |
+
"id": "07197572",
|
| 28 |
+
"metadata": {
|
| 29 |
+
"tags": []
|
| 30 |
+
},
|
| 31 |
+
"outputs": [
|
| 32 |
+
{
|
| 33 |
+
"data": {
|
| 34 |
+
"text/plain": [
|
| 35 |
+
"{'pcpy_type': \"<class 'PCSWMM.Scripts.PCSWMMpy'>\",\n",
|
| 36 |
+
" 'project_open': True,\n",
|
| 37 |
+
" 'project': {'captured_at': '2026-08-01T08:00:39',\n",
|
| 38 |
+
" 'project_open': True,\n",
|
| 39 |
+
" 'project_name': 'Valleyfield to-be dual system',\n",
|
| 40 |
+
" 'project_folder': 'D:\\\\Documents\\\\EPA SWMM Projects\\\\',\n",
|
| 41 |
+
" 'model_file': 'D:\\\\Documents\\\\EPA SWMM Projects\\\\Valleyfield to-be dual system.inp',\n",
|
| 42 |
+
" 'swmm_version': 'SWMM5.0.022',\n",
|
| 43 |
+
" 'run_status': 'PCSWMM.Scripts.PySWMMRunStatus',\n",
|
| 44 |
+
" 'scenario_count': 2,\n",
|
| 45 |
+
" 'node_count': 20,\n",
|
| 46 |
+
" 'link_count': 28,\n",
|
| 47 |
+
" 'junction_count': 18,\n",
|
| 48 |
+
" 'conduit_count': 18,\n",
|
| 49 |
+
" 'subcatchment_count': 9,\n",
|
| 50 |
+
" 'storage_count': 1,\n",
|
| 51 |
+
" 'outfall_count': 1,\n",
|
| 52 |
+
" 'graph_file_count': 1},\n",
|
| 53 |
+
" 'capabilities': {'model_archetype': 'collection_system_with_storage',\n",
|
| 54 |
+
" 'has_subcatchments': True,\n",
|
| 55 |
+
" 'has_conveyance': True,\n",
|
| 56 |
+
" 'has_storage': True,\n",
|
| 57 |
+
" 'has_outlet_structures': True,\n",
|
| 58 |
+
" 'has_water_quality': False,\n",
|
| 59 |
+
" 'has_lid': False,\n",
|
| 60 |
+
" 'has_snowmelt': False,\n",
|
| 61 |
+
" 'has_groundwater': False,\n",
|
| 62 |
+
" 'has_controls': False,\n",
|
| 63 |
+
" 'counts': {'Scenarios': 2,\n",
|
| 64 |
+
" 'Nodes': 20,\n",
|
| 65 |
+
" 'Links': 28,\n",
|
| 66 |
+
" 'Subcatchments': 9,\n",
|
| 67 |
+
" 'Junctions': 18,\n",
|
| 68 |
+
" 'Outfalls': 1,\n",
|
| 69 |
+
" 'Dividers': 0,\n",
|
| 70 |
+
" 'Storages': 1,\n",
|
| 71 |
+
" 'Conduits': 18,\n",
|
| 72 |
+
" 'Pumps': 0,\n",
|
| 73 |
+
" 'Orifices': 0,\n",
|
| 74 |
+
" 'Weirs': 0,\n",
|
| 75 |
+
" 'Outlets': 10,\n",
|
| 76 |
+
" 'Raingages': 2,\n",
|
| 77 |
+
" 'Curves': 2,\n",
|
| 78 |
+
" 'TimeSeries': 2,\n",
|
| 79 |
+
" 'Controls': 0,\n",
|
| 80 |
+
" 'Patterns': 0,\n",
|
| 81 |
+
" 'Pollutants': 0}}}"
|
| 82 |
+
]
|
| 83 |
+
},
|
| 84 |
+
"execution_count": 1,
|
| 85 |
+
"metadata": {},
|
| 86 |
+
"output_type": "execute_result"
|
| 87 |
+
}
|
| 88 |
+
],
|
| 89 |
+
"source": [
|
| 90 |
+
"import sys\n",
|
| 91 |
+
"import importlib\n",
|
| 92 |
+
"from pathlib import Path\n",
|
| 93 |
+
"\n",
|
| 94 |
+
"REQUIRED_VERSION = \"0.4.0\"\n",
|
| 95 |
+
"ROOT = Path.cwd()\n",
|
| 96 |
+
"\n",
|
| 97 |
+
"preferred = [\n",
|
| 98 |
+
" ROOT / \"PCSWMM_Engineering_SDK_v0_4\",\n",
|
| 99 |
+
" ROOT / \"PCSWMM_Engineering_SDK_v0_4\" / \"PCSWMM_Engineering_SDK_v0_4\",\n",
|
| 100 |
+
"]\n",
|
| 101 |
+
"\n",
|
| 102 |
+
"SDK_ROOT = next(\n",
|
| 103 |
+
" (path for path in preferred if (path / \"pcswmm_ai\").is_dir()),\n",
|
| 104 |
+
" None,\n",
|
| 105 |
+
")\n",
|
| 106 |
+
"\n",
|
| 107 |
+
"if SDK_ROOT is None:\n",
|
| 108 |
+
" matches = [\n",
|
| 109 |
+
" p.parent for p in ROOT.rglob(\"pcswmm_ai\")\n",
|
| 110 |
+
" if p.is_dir() and \"Engineering_SDK_v0_4\" in str(p.parent)\n",
|
| 111 |
+
" ]\n",
|
| 112 |
+
" SDK_ROOT = matches[0] if matches else None\n",
|
| 113 |
+
"\n",
|
| 114 |
+
"if SDK_ROOT is None:\n",
|
| 115 |
+
" raise FileNotFoundError(\"PCSWMM Engineering SDK v0.4 was not found.\")\n",
|
| 116 |
+
"\n",
|
| 117 |
+
"for module_name in list(sys.modules):\n",
|
| 118 |
+
" if module_name == \"pcswmm_ai\" or module_name.startswith(\"pcswmm_ai.\"):\n",
|
| 119 |
+
" del sys.modules[module_name]\n",
|
| 120 |
+
"\n",
|
| 121 |
+
"sys.path = [\n",
|
| 122 |
+
" p for p in sys.path\n",
|
| 123 |
+
" if \"PCSWMM_AI_SDK_v0_\" not in str(p)\n",
|
| 124 |
+
" and \"PCSWMM_Engineering_SDK_v0_\" not in str(p)\n",
|
| 125 |
+
"]\n",
|
| 126 |
+
"sys.path.insert(0, str(SDK_ROOT))\n",
|
| 127 |
+
"importlib.invalidate_caches()\n",
|
| 128 |
+
"\n",
|
| 129 |
+
"from pcswmm_ai import PCSWMMClient, __version__\n",
|
| 130 |
+
"\n",
|
| 131 |
+
"if __version__ != REQUIRED_VERSION:\n",
|
| 132 |
+
" raise RuntimeError(\n",
|
| 133 |
+
" f\"Expected SDK {REQUIRED_VERSION}; loaded {__version__}\"\n",
|
| 134 |
+
" )\n",
|
| 135 |
+
"\n",
|
| 136 |
+
"client = PCSWMMClient(pcpy)\n",
|
| 137 |
+
"client.health()"
|
| 138 |
+
]
|
| 139 |
+
},
|
| 140 |
+
{
|
| 141 |
+
"cell_type": "markdown",
|
| 142 |
+
"id": "01ca5af0",
|
| 143 |
+
"metadata": {},
|
| 144 |
+
"source": [
|
| 145 |
+
"## 2. Detect model capabilities"
|
| 146 |
+
]
|
| 147 |
+
},
|
| 148 |
+
{
|
| 149 |
+
"cell_type": "code",
|
| 150 |
+
"execution_count": 2,
|
| 151 |
+
"id": "8df01f33",
|
| 152 |
+
"metadata": {
|
| 153 |
+
"tags": []
|
| 154 |
+
},
|
| 155 |
+
"outputs": [
|
| 156 |
+
{
|
| 157 |
+
"data": {
|
| 158 |
+
"text/html": [
|
| 159 |
+
"<div>\n",
|
| 160 |
+
"<style scoped>\n",
|
| 161 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 162 |
+
" vertical-align: middle;\n",
|
| 163 |
+
" }\n",
|
| 164 |
+
"\n",
|
| 165 |
+
" .dataframe tbody tr th {\n",
|
| 166 |
+
" vertical-align: top;\n",
|
| 167 |
+
" }\n",
|
| 168 |
+
"\n",
|
| 169 |
+
" .dataframe thead th {\n",
|
| 170 |
+
" text-align: right;\n",
|
| 171 |
+
" }\n",
|
| 172 |
+
"</style>\n",
|
| 173 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 174 |
+
" <thead>\n",
|
| 175 |
+
" <tr style=\"text-align: right;\">\n",
|
| 176 |
+
" <th></th>\n",
|
| 177 |
+
" <th>Capability</th>\n",
|
| 178 |
+
" <th>Value</th>\n",
|
| 179 |
+
" </tr>\n",
|
| 180 |
+
" </thead>\n",
|
| 181 |
+
" <tbody>\n",
|
| 182 |
+
" <tr>\n",
|
| 183 |
+
" <th>0</th>\n",
|
| 184 |
+
" <td>model_archetype</td>\n",
|
| 185 |
+
" <td>collection_system_with_storage</td>\n",
|
| 186 |
+
" </tr>\n",
|
| 187 |
+
" <tr>\n",
|
| 188 |
+
" <th>1</th>\n",
|
| 189 |
+
" <td>has_subcatchments</td>\n",
|
| 190 |
+
" <td>True</td>\n",
|
| 191 |
+
" </tr>\n",
|
| 192 |
+
" <tr>\n",
|
| 193 |
+
" <th>2</th>\n",
|
| 194 |
+
" <td>has_conveyance</td>\n",
|
| 195 |
+
" <td>True</td>\n",
|
| 196 |
+
" </tr>\n",
|
| 197 |
+
" <tr>\n",
|
| 198 |
+
" <th>3</th>\n",
|
| 199 |
+
" <td>has_storage</td>\n",
|
| 200 |
+
" <td>True</td>\n",
|
| 201 |
+
" </tr>\n",
|
| 202 |
+
" <tr>\n",
|
| 203 |
+
" <th>4</th>\n",
|
| 204 |
+
" <td>has_outlet_structures</td>\n",
|
| 205 |
+
" <td>True</td>\n",
|
| 206 |
+
" </tr>\n",
|
| 207 |
+
" <tr>\n",
|
| 208 |
+
" <th>5</th>\n",
|
| 209 |
+
" <td>has_water_quality</td>\n",
|
| 210 |
+
" <td>False</td>\n",
|
| 211 |
+
" </tr>\n",
|
| 212 |
+
" <tr>\n",
|
| 213 |
+
" <th>6</th>\n",
|
| 214 |
+
" <td>has_lid</td>\n",
|
| 215 |
+
" <td>False</td>\n",
|
| 216 |
+
" </tr>\n",
|
| 217 |
+
" <tr>\n",
|
| 218 |
+
" <th>7</th>\n",
|
| 219 |
+
" <td>has_snowmelt</td>\n",
|
| 220 |
+
" <td>False</td>\n",
|
| 221 |
+
" </tr>\n",
|
| 222 |
+
" <tr>\n",
|
| 223 |
+
" <th>8</th>\n",
|
| 224 |
+
" <td>has_groundwater</td>\n",
|
| 225 |
+
" <td>False</td>\n",
|
| 226 |
+
" </tr>\n",
|
| 227 |
+
" <tr>\n",
|
| 228 |
+
" <th>9</th>\n",
|
| 229 |
+
" <td>has_controls</td>\n",
|
| 230 |
+
" <td>False</td>\n",
|
| 231 |
+
" </tr>\n",
|
| 232 |
+
" </tbody>\n",
|
| 233 |
+
"</table>\n",
|
| 234 |
+
"</div>"
|
| 235 |
+
],
|
| 236 |
+
"text/plain": [
|
| 237 |
+
" Capability Value\n",
|
| 238 |
+
"0 model_archetype collection_system_with_storage\n",
|
| 239 |
+
"1 has_subcatchments True\n",
|
| 240 |
+
"2 has_conveyance True\n",
|
| 241 |
+
"3 has_storage True\n",
|
| 242 |
+
"4 has_outlet_structures True\n",
|
| 243 |
+
"5 has_water_quality False\n",
|
| 244 |
+
"6 has_lid False\n",
|
| 245 |
+
"7 has_snowmelt False\n",
|
| 246 |
+
"8 has_groundwater False\n",
|
| 247 |
+
"9 has_controls False"
|
| 248 |
+
]
|
| 249 |
+
},
|
| 250 |
+
"metadata": {},
|
| 251 |
+
"output_type": "display_data"
|
| 252 |
+
},
|
| 253 |
+
{
|
| 254 |
+
"data": {
|
| 255 |
+
"text/markdown": [
|
| 256 |
+
"### Applicable review modules"
|
| 257 |
+
],
|
| 258 |
+
"text/plain": [
|
| 259 |
+
"<IPython.core.display.Markdown object>"
|
| 260 |
+
]
|
| 261 |
+
},
|
| 262 |
+
"metadata": {},
|
| 263 |
+
"output_type": "display_data"
|
| 264 |
+
},
|
| 265 |
+
{
|
| 266 |
+
"data": {
|
| 267 |
+
"text/html": [
|
| 268 |
+
"<div>\n",
|
| 269 |
+
"<style scoped>\n",
|
| 270 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 271 |
+
" vertical-align: middle;\n",
|
| 272 |
+
" }\n",
|
| 273 |
+
"\n",
|
| 274 |
+
" .dataframe tbody tr th {\n",
|
| 275 |
+
" vertical-align: top;\n",
|
| 276 |
+
" }\n",
|
| 277 |
+
"\n",
|
| 278 |
+
" .dataframe thead th {\n",
|
| 279 |
+
" text-align: right;\n",
|
| 280 |
+
" }\n",
|
| 281 |
+
"</style>\n",
|
| 282 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 283 |
+
" <thead>\n",
|
| 284 |
+
" <tr style=\"text-align: right;\">\n",
|
| 285 |
+
" <th></th>\n",
|
| 286 |
+
" <th>Module</th>\n",
|
| 287 |
+
" </tr>\n",
|
| 288 |
+
" </thead>\n",
|
| 289 |
+
" <tbody>\n",
|
| 290 |
+
" <tr>\n",
|
| 291 |
+
" <th>0</th>\n",
|
| 292 |
+
" <td>project</td>\n",
|
| 293 |
+
" </tr>\n",
|
| 294 |
+
" <tr>\n",
|
| 295 |
+
" <th>1</th>\n",
|
| 296 |
+
" <td>inventory</td>\n",
|
| 297 |
+
" </tr>\n",
|
| 298 |
+
" <tr>\n",
|
| 299 |
+
" <th>2</th>\n",
|
| 300 |
+
" <td>topology</td>\n",
|
| 301 |
+
" </tr>\n",
|
| 302 |
+
" <tr>\n",
|
| 303 |
+
" <th>3</th>\n",
|
| 304 |
+
" <td>scenario_paths</td>\n",
|
| 305 |
+
" </tr>\n",
|
| 306 |
+
" <tr>\n",
|
| 307 |
+
" <th>4</th>\n",
|
| 308 |
+
" <td>hydrology</td>\n",
|
| 309 |
+
" </tr>\n",
|
| 310 |
+
" <tr>\n",
|
| 311 |
+
" <th>5</th>\n",
|
| 312 |
+
" <td>hydraulics</td>\n",
|
| 313 |
+
" </tr>\n",
|
| 314 |
+
" <tr>\n",
|
| 315 |
+
" <th>6</th>\n",
|
| 316 |
+
" <td>storage</td>\n",
|
| 317 |
+
" </tr>\n",
|
| 318 |
+
" <tr>\n",
|
| 319 |
+
" <th>7</th>\n",
|
| 320 |
+
" <td>outlet_structures</td>\n",
|
| 321 |
+
" </tr>\n",
|
| 322 |
+
" </tbody>\n",
|
| 323 |
+
"</table>\n",
|
| 324 |
+
"</div>"
|
| 325 |
+
],
|
| 326 |
+
"text/plain": [
|
| 327 |
+
" Module\n",
|
| 328 |
+
"0 project\n",
|
| 329 |
+
"1 inventory\n",
|
| 330 |
+
"2 topology\n",
|
| 331 |
+
"3 scenario_paths\n",
|
| 332 |
+
"4 hydrology\n",
|
| 333 |
+
"5 hydraulics\n",
|
| 334 |
+
"6 storage\n",
|
| 335 |
+
"7 outlet_structures"
|
| 336 |
+
]
|
| 337 |
+
},
|
| 338 |
+
"metadata": {},
|
| 339 |
+
"output_type": "display_data"
|
| 340 |
+
}
|
| 341 |
+
],
|
| 342 |
+
"source": [
|
| 343 |
+
"import pandas as pd\n",
|
| 344 |
+
"from IPython.display import display, Markdown\n",
|
| 345 |
+
"\n",
|
| 346 |
+
"capabilities = client.capabilities.detect()\n",
|
| 347 |
+
"\n",
|
| 348 |
+
"display(pd.DataFrame(\n",
|
| 349 |
+
" [\n",
|
| 350 |
+
" {\"Capability\": key, \"Value\": value}\n",
|
| 351 |
+
" for key, value in capabilities.items()\n",
|
| 352 |
+
" if key != \"counts\"\n",
|
| 353 |
+
" ]\n",
|
| 354 |
+
"))\n",
|
| 355 |
+
"\n",
|
| 356 |
+
"display(Markdown(\"### Applicable review modules\"))\n",
|
| 357 |
+
"display(pd.DataFrame({\n",
|
| 358 |
+
" \"Module\": client.capabilities.applicable_review_modules()\n",
|
| 359 |
+
"}))"
|
| 360 |
+
]
|
| 361 |
+
},
|
| 362 |
+
{
|
| 363 |
+
"cell_type": "markdown",
|
| 364 |
+
"id": "87dc6b09",
|
| 365 |
+
"metadata": {},
|
| 366 |
+
"source": [
|
| 367 |
+
"## 3. Generic project and topology review"
|
| 368 |
+
]
|
| 369 |
+
},
|
| 370 |
+
{
|
| 371 |
+
"cell_type": "code",
|
| 372 |
+
"execution_count": 3,
|
| 373 |
+
"id": "c5a955d5",
|
| 374 |
+
"metadata": {
|
| 375 |
+
"tags": []
|
| 376 |
+
},
|
| 377 |
+
"outputs": [
|
| 378 |
+
{
|
| 379 |
+
"data": {
|
| 380 |
+
"text/html": [
|
| 381 |
+
"<div>\n",
|
| 382 |
+
"<style scoped>\n",
|
| 383 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 384 |
+
" vertical-align: middle;\n",
|
| 385 |
+
" }\n",
|
| 386 |
+
"\n",
|
| 387 |
+
" .dataframe tbody tr th {\n",
|
| 388 |
+
" vertical-align: top;\n",
|
| 389 |
+
" }\n",
|
| 390 |
+
"\n",
|
| 391 |
+
" .dataframe thead th {\n",
|
| 392 |
+
" text-align: right;\n",
|
| 393 |
+
" }\n",
|
| 394 |
+
"</style>\n",
|
| 395 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 396 |
+
" <thead>\n",
|
| 397 |
+
" <tr style=\"text-align: right;\">\n",
|
| 398 |
+
" <th></th>\n",
|
| 399 |
+
" <th>Property</th>\n",
|
| 400 |
+
" <th>Value</th>\n",
|
| 401 |
+
" </tr>\n",
|
| 402 |
+
" </thead>\n",
|
| 403 |
+
" <tbody>\n",
|
| 404 |
+
" <tr>\n",
|
| 405 |
+
" <th>0</th>\n",
|
| 406 |
+
" <td>captured_at</td>\n",
|
| 407 |
+
" <td>2026-08-01T08:00:57</td>\n",
|
| 408 |
+
" </tr>\n",
|
| 409 |
+
" <tr>\n",
|
| 410 |
+
" <th>1</th>\n",
|
| 411 |
+
" <td>project_open</td>\n",
|
| 412 |
+
" <td>True</td>\n",
|
| 413 |
+
" </tr>\n",
|
| 414 |
+
" <tr>\n",
|
| 415 |
+
" <th>2</th>\n",
|
| 416 |
+
" <td>project_name</td>\n",
|
| 417 |
+
" <td>Valleyfield to-be dual system</td>\n",
|
| 418 |
+
" </tr>\n",
|
| 419 |
+
" <tr>\n",
|
| 420 |
+
" <th>3</th>\n",
|
| 421 |
+
" <td>project_folder</td>\n",
|
| 422 |
+
" <td>D:\\Documents\\EPA SWMM Projects\\</td>\n",
|
| 423 |
+
" </tr>\n",
|
| 424 |
+
" <tr>\n",
|
| 425 |
+
" <th>4</th>\n",
|
| 426 |
+
" <td>model_file</td>\n",
|
| 427 |
+
" <td>D:\\Documents\\EPA SWMM Projects\\Valleyfield to-...</td>\n",
|
| 428 |
+
" </tr>\n",
|
| 429 |
+
" <tr>\n",
|
| 430 |
+
" <th>5</th>\n",
|
| 431 |
+
" <td>swmm_version</td>\n",
|
| 432 |
+
" <td>SWMM5.0.022</td>\n",
|
| 433 |
+
" </tr>\n",
|
| 434 |
+
" <tr>\n",
|
| 435 |
+
" <th>6</th>\n",
|
| 436 |
+
" <td>run_status</td>\n",
|
| 437 |
+
" <td>PCSWMM.Scripts.PySWMMRunStatus</td>\n",
|
| 438 |
+
" </tr>\n",
|
| 439 |
+
" <tr>\n",
|
| 440 |
+
" <th>7</th>\n",
|
| 441 |
+
" <td>scenario_count</td>\n",
|
| 442 |
+
" <td>2</td>\n",
|
| 443 |
+
" </tr>\n",
|
| 444 |
+
" <tr>\n",
|
| 445 |
+
" <th>8</th>\n",
|
| 446 |
+
" <td>node_count</td>\n",
|
| 447 |
+
" <td>20</td>\n",
|
| 448 |
+
" </tr>\n",
|
| 449 |
+
" <tr>\n",
|
| 450 |
+
" <th>9</th>\n",
|
| 451 |
+
" <td>link_count</td>\n",
|
| 452 |
+
" <td>28</td>\n",
|
| 453 |
+
" </tr>\n",
|
| 454 |
+
" <tr>\n",
|
| 455 |
+
" <th>10</th>\n",
|
| 456 |
+
" <td>junction_count</td>\n",
|
| 457 |
+
" <td>18</td>\n",
|
| 458 |
+
" </tr>\n",
|
| 459 |
+
" <tr>\n",
|
| 460 |
+
" <th>11</th>\n",
|
| 461 |
+
" <td>conduit_count</td>\n",
|
| 462 |
+
" <td>18</td>\n",
|
| 463 |
+
" </tr>\n",
|
| 464 |
+
" <tr>\n",
|
| 465 |
+
" <th>12</th>\n",
|
| 466 |
+
" <td>subcatchment_count</td>\n",
|
| 467 |
+
" <td>9</td>\n",
|
| 468 |
+
" </tr>\n",
|
| 469 |
+
" <tr>\n",
|
| 470 |
+
" <th>13</th>\n",
|
| 471 |
+
" <td>storage_count</td>\n",
|
| 472 |
+
" <td>1</td>\n",
|
| 473 |
+
" </tr>\n",
|
| 474 |
+
" <tr>\n",
|
| 475 |
+
" <th>14</th>\n",
|
| 476 |
+
" <td>outfall_count</td>\n",
|
| 477 |
+
" <td>1</td>\n",
|
| 478 |
+
" </tr>\n",
|
| 479 |
+
" <tr>\n",
|
| 480 |
+
" <th>15</th>\n",
|
| 481 |
+
" <td>graph_file_count</td>\n",
|
| 482 |
+
" <td>1</td>\n",
|
| 483 |
+
" </tr>\n",
|
| 484 |
+
" </tbody>\n",
|
| 485 |
+
"</table>\n",
|
| 486 |
+
"</div>"
|
| 487 |
+
],
|
| 488 |
+
"text/plain": [
|
| 489 |
+
" Property Value\n",
|
| 490 |
+
"0 captured_at 2026-08-01T08:00:57\n",
|
| 491 |
+
"1 project_open True\n",
|
| 492 |
+
"2 project_name Valleyfield to-be dual system\n",
|
| 493 |
+
"3 project_folder D:\\Documents\\EPA SWMM Projects\\\n",
|
| 494 |
+
"4 model_file D:\\Documents\\EPA SWMM Projects\\Valleyfield to-...\n",
|
| 495 |
+
"5 swmm_version SWMM5.0.022\n",
|
| 496 |
+
"6 run_status PCSWMM.Scripts.PySWMMRunStatus\n",
|
| 497 |
+
"7 scenario_count 2\n",
|
| 498 |
+
"8 node_count 20\n",
|
| 499 |
+
"9 link_count 28\n",
|
| 500 |
+
"10 junction_count 18\n",
|
| 501 |
+
"11 conduit_count 18\n",
|
| 502 |
+
"12 subcatchment_count 9\n",
|
| 503 |
+
"13 storage_count 1\n",
|
| 504 |
+
"14 outfall_count 1\n",
|
| 505 |
+
"15 graph_file_count 1"
|
| 506 |
+
]
|
| 507 |
+
},
|
| 508 |
+
"metadata": {},
|
| 509 |
+
"output_type": "display_data"
|
| 510 |
+
},
|
| 511 |
+
{
|
| 512 |
+
"data": {
|
| 513 |
+
"text/markdown": [
|
| 514 |
+
"### Collection inventory"
|
| 515 |
+
],
|
| 516 |
+
"text/plain": [
|
| 517 |
+
"<IPython.core.display.Markdown object>"
|
| 518 |
+
]
|
| 519 |
+
},
|
| 520 |
+
"metadata": {},
|
| 521 |
+
"output_type": "display_data"
|
| 522 |
+
},
|
| 523 |
+
{
|
| 524 |
+
"data": {
|
| 525 |
+
"text/html": [
|
| 526 |
+
"<div>\n",
|
| 527 |
+
"<style scoped>\n",
|
| 528 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 529 |
+
" vertical-align: middle;\n",
|
| 530 |
+
" }\n",
|
| 531 |
+
"\n",
|
| 532 |
+
" .dataframe tbody tr th {\n",
|
| 533 |
+
" vertical-align: top;\n",
|
| 534 |
+
" }\n",
|
| 535 |
+
"\n",
|
| 536 |
+
" .dataframe thead th {\n",
|
| 537 |
+
" text-align: right;\n",
|
| 538 |
+
" }\n",
|
| 539 |
+
"</style>\n",
|
| 540 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 541 |
+
" <thead>\n",
|
| 542 |
+
" <tr style=\"text-align: right;\">\n",
|
| 543 |
+
" <th></th>\n",
|
| 544 |
+
" <th>collection</th>\n",
|
| 545 |
+
" <th>count</th>\n",
|
| 546 |
+
" <th>type</th>\n",
|
| 547 |
+
" </tr>\n",
|
| 548 |
+
" </thead>\n",
|
| 549 |
+
" <tbody>\n",
|
| 550 |
+
" <tr>\n",
|
| 551 |
+
" <th>0</th>\n",
|
| 552 |
+
" <td>Scenarios</td>\n",
|
| 553 |
+
" <td>2</td>\n",
|
| 554 |
+
" <td><class 'PCSWMM.Scripts.PythonDictionaryExt'></td>\n",
|
| 555 |
+
" </tr>\n",
|
| 556 |
+
" <tr>\n",
|
| 557 |
+
" <th>1</th>\n",
|
| 558 |
+
" <td>Nodes</td>\n",
|
| 559 |
+
" <td>20</td>\n",
|
| 560 |
+
" <td><class 'PCSWMM.Scripts.PythonDictionaryExt'></td>\n",
|
| 561 |
+
" </tr>\n",
|
| 562 |
+
" <tr>\n",
|
| 563 |
+
" <th>2</th>\n",
|
| 564 |
+
" <td>Links</td>\n",
|
| 565 |
+
" <td>28</td>\n",
|
| 566 |
+
" <td><class 'PCSWMM.Scripts.PythonDictionaryExt'></td>\n",
|
| 567 |
+
" </tr>\n",
|
| 568 |
+
" <tr>\n",
|
| 569 |
+
" <th>3</th>\n",
|
| 570 |
+
" <td>Subcatchments</td>\n",
|
| 571 |
+
" <td>9</td>\n",
|
| 572 |
+
" <td><class 'PCSWMM.Scripts.PythonDictionaryExt'></td>\n",
|
| 573 |
+
" </tr>\n",
|
| 574 |
+
" <tr>\n",
|
| 575 |
+
" <th>4</th>\n",
|
| 576 |
+
" <td>Junctions</td>\n",
|
| 577 |
+
" <td>18</td>\n",
|
| 578 |
+
" <td><class 'PCSWMM.Scripts.PythonDictionaryExt'></td>\n",
|
| 579 |
+
" </tr>\n",
|
| 580 |
+
" <tr>\n",
|
| 581 |
+
" <th>5</th>\n",
|
| 582 |
+
" <td>Outfalls</td>\n",
|
| 583 |
+
" <td>1</td>\n",
|
| 584 |
+
" <td><class 'PCSWMM.Scripts.PythonDictionaryExt'></td>\n",
|
| 585 |
+
" </tr>\n",
|
| 586 |
+
" <tr>\n",
|
| 587 |
+
" <th>6</th>\n",
|
| 588 |
+
" <td>Dividers</td>\n",
|
| 589 |
+
" <td>0</td>\n",
|
| 590 |
+
" <td><class 'PCSWMM.Scripts.PythonDictionaryExt'></td>\n",
|
| 591 |
+
" </tr>\n",
|
| 592 |
+
" <tr>\n",
|
| 593 |
+
" <th>7</th>\n",
|
| 594 |
+
" <td>Storages</td>\n",
|
| 595 |
+
" <td>1</td>\n",
|
| 596 |
+
" <td><class 'PCSWMM.Scripts.PythonDictionaryExt'></td>\n",
|
| 597 |
+
" </tr>\n",
|
| 598 |
+
" <tr>\n",
|
| 599 |
+
" <th>8</th>\n",
|
| 600 |
+
" <td>Conduits</td>\n",
|
| 601 |
+
" <td>18</td>\n",
|
| 602 |
+
" <td><class 'PCSWMM.Scripts.PythonDictionaryExt'></td>\n",
|
| 603 |
+
" </tr>\n",
|
| 604 |
+
" <tr>\n",
|
| 605 |
+
" <th>9</th>\n",
|
| 606 |
+
" <td>Pumps</td>\n",
|
| 607 |
+
" <td>0</td>\n",
|
| 608 |
+
" <td><class 'PCSWMM.Scripts.PythonDictionaryExt'></td>\n",
|
| 609 |
+
" </tr>\n",
|
| 610 |
+
" <tr>\n",
|
| 611 |
+
" <th>10</th>\n",
|
| 612 |
+
" <td>Orifices</td>\n",
|
| 613 |
+
" <td>0</td>\n",
|
| 614 |
+
" <td><class 'PCSWMM.Scripts.PythonDictionaryExt'></td>\n",
|
| 615 |
+
" </tr>\n",
|
| 616 |
+
" <tr>\n",
|
| 617 |
+
" <th>11</th>\n",
|
| 618 |
+
" <td>Weirs</td>\n",
|
| 619 |
+
" <td>0</td>\n",
|
| 620 |
+
" <td><class 'PCSWMM.Scripts.PythonDictionaryExt'></td>\n",
|
| 621 |
+
" </tr>\n",
|
| 622 |
+
" <tr>\n",
|
| 623 |
+
" <th>12</th>\n",
|
| 624 |
+
" <td>Outlets</td>\n",
|
| 625 |
+
" <td>10</td>\n",
|
| 626 |
+
" <td><class 'PCSWMM.Scripts.PythonDictionaryExt'></td>\n",
|
| 627 |
+
" </tr>\n",
|
| 628 |
+
" <tr>\n",
|
| 629 |
+
" <th>13</th>\n",
|
| 630 |
+
" <td>Raingages</td>\n",
|
| 631 |
+
" <td>2</td>\n",
|
| 632 |
+
" <td><class 'PCSWMM.Scripts.PythonDictionaryExt'></td>\n",
|
| 633 |
+
" </tr>\n",
|
| 634 |
+
" <tr>\n",
|
| 635 |
+
" <th>14</th>\n",
|
| 636 |
+
" <td>Curves</td>\n",
|
| 637 |
+
" <td>2</td>\n",
|
| 638 |
+
" <td><class 'PCSWMM.Scripts.PythonDictionaryExt'></td>\n",
|
| 639 |
+
" </tr>\n",
|
| 640 |
+
" <tr>\n",
|
| 641 |
+
" <th>15</th>\n",
|
| 642 |
+
" <td>TimeSeries</td>\n",
|
| 643 |
+
" <td>2</td>\n",
|
| 644 |
+
" <td><class 'PCSWMM.Scripts.PythonDictionaryExt'></td>\n",
|
| 645 |
+
" </tr>\n",
|
| 646 |
+
" <tr>\n",
|
| 647 |
+
" <th>16</th>\n",
|
| 648 |
+
" <td>Controls</td>\n",
|
| 649 |
+
" <td>0</td>\n",
|
| 650 |
+
" <td><class 'str'></td>\n",
|
| 651 |
+
" </tr>\n",
|
| 652 |
+
" <tr>\n",
|
| 653 |
+
" <th>17</th>\n",
|
| 654 |
+
" <td>Patterns</td>\n",
|
| 655 |
+
" <td>0</td>\n",
|
| 656 |
+
" <td><class 'PCSWMM.Scripts.PythonDictionaryExt'></td>\n",
|
| 657 |
+
" </tr>\n",
|
| 658 |
+
" <tr>\n",
|
| 659 |
+
" <th>18</th>\n",
|
| 660 |
+
" <td>Pollutants</td>\n",
|
| 661 |
+
" <td>0</td>\n",
|
| 662 |
+
" <td><class 'PCSWMM.Scripts.PythonDictionaryExt'></td>\n",
|
| 663 |
+
" </tr>\n",
|
| 664 |
+
" </tbody>\n",
|
| 665 |
+
"</table>\n",
|
| 666 |
+
"</div>"
|
| 667 |
+
],
|
| 668 |
+
"text/plain": [
|
| 669 |
+
" collection count type\n",
|
| 670 |
+
"0 Scenarios 2 <class 'PCSWMM.Scripts.PythonDictionaryExt'>\n",
|
| 671 |
+
"1 Nodes 20 <class 'PCSWMM.Scripts.PythonDictionaryExt'>\n",
|
| 672 |
+
"2 Links 28 <class 'PCSWMM.Scripts.PythonDictionaryExt'>\n",
|
| 673 |
+
"3 Subcatchments 9 <class 'PCSWMM.Scripts.PythonDictionaryExt'>\n",
|
| 674 |
+
"4 Junctions 18 <class 'PCSWMM.Scripts.PythonDictionaryExt'>\n",
|
| 675 |
+
"5 Outfalls 1 <class 'PCSWMM.Scripts.PythonDictionaryExt'>\n",
|
| 676 |
+
"6 Dividers 0 <class 'PCSWMM.Scripts.PythonDictionaryExt'>\n",
|
| 677 |
+
"7 Storages 1 <class 'PCSWMM.Scripts.PythonDictionaryExt'>\n",
|
| 678 |
+
"8 Conduits 18 <class 'PCSWMM.Scripts.PythonDictionaryExt'>\n",
|
| 679 |
+
"9 Pumps 0 <class 'PCSWMM.Scripts.PythonDictionaryExt'>\n",
|
| 680 |
+
"10 Orifices 0 <class 'PCSWMM.Scripts.PythonDictionaryExt'>\n",
|
| 681 |
+
"11 Weirs 0 <class 'PCSWMM.Scripts.PythonDictionaryExt'>\n",
|
| 682 |
+
"12 Outlets 10 <class 'PCSWMM.Scripts.PythonDictionaryExt'>\n",
|
| 683 |
+
"13 Raingages 2 <class 'PCSWMM.Scripts.PythonDictionaryExt'>\n",
|
| 684 |
+
"14 Curves 2 <class 'PCSWMM.Scripts.PythonDictionaryExt'>\n",
|
| 685 |
+
"15 TimeSeries 2 <class 'PCSWMM.Scripts.PythonDictionaryExt'>\n",
|
| 686 |
+
"16 Controls 0 <class 'str'>\n",
|
| 687 |
+
"17 Patterns 0 <class 'PCSWMM.Scripts.PythonDictionaryExt'>\n",
|
| 688 |
+
"18 Pollutants 0 <class 'PCSWMM.Scripts.PythonDictionaryExt'>"
|
| 689 |
+
]
|
| 690 |
+
},
|
| 691 |
+
"metadata": {},
|
| 692 |
+
"output_type": "display_data"
|
| 693 |
+
},
|
| 694 |
+
{
|
| 695 |
+
"data": {
|
| 696 |
+
"text/markdown": [
|
| 697 |
+
"### Link endpoints"
|
| 698 |
+
],
|
| 699 |
+
"text/plain": [
|
| 700 |
+
"<IPython.core.display.Markdown object>"
|
| 701 |
+
]
|
| 702 |
+
},
|
| 703 |
+
"metadata": {},
|
| 704 |
+
"output_type": "display_data"
|
| 705 |
+
},
|
| 706 |
+
{
|
| 707 |
+
"data": {
|
| 708 |
+
"text/html": [
|
| 709 |
+
"<div>\n",
|
| 710 |
+
"<style scoped>\n",
|
| 711 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 712 |
+
" vertical-align: middle;\n",
|
| 713 |
+
" }\n",
|
| 714 |
+
"\n",
|
| 715 |
+
" .dataframe tbody tr th {\n",
|
| 716 |
+
" vertical-align: top;\n",
|
| 717 |
+
" }\n",
|
| 718 |
+
"\n",
|
| 719 |
+
" .dataframe thead th {\n",
|
| 720 |
+
" text-align: right;\n",
|
| 721 |
+
" }\n",
|
| 722 |
+
"</style>\n",
|
| 723 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 724 |
+
" <thead>\n",
|
| 725 |
+
" <tr style=\"text-align: right;\">\n",
|
| 726 |
+
" <th></th>\n",
|
| 727 |
+
" <th>link</th>\n",
|
| 728 |
+
" <th>from_node</th>\n",
|
| 729 |
+
" <th>to_node</th>\n",
|
| 730 |
+
" </tr>\n",
|
| 731 |
+
" </thead>\n",
|
| 732 |
+
" <tbody>\n",
|
| 733 |
+
" <tr>\n",
|
| 734 |
+
" <th>0</th>\n",
|
| 735 |
+
" <td>C7</td>\n",
|
| 736 |
+
" <td>J7</td>\n",
|
| 737 |
+
" <td>J8</td>\n",
|
| 738 |
+
" </tr>\n",
|
| 739 |
+
" <tr>\n",
|
| 740 |
+
" <th>1</th>\n",
|
| 741 |
+
" <td>C7-S</td>\n",
|
| 742 |
+
" <td>J7-S</td>\n",
|
| 743 |
+
" <td>J8-S</td>\n",
|
| 744 |
+
" </tr>\n",
|
| 745 |
+
" <tr>\n",
|
| 746 |
+
" <th>2</th>\n",
|
| 747 |
+
" <td>C2</td>\n",
|
| 748 |
+
" <td>J2</td>\n",
|
| 749 |
+
" <td>J3</td>\n",
|
| 750 |
+
" </tr>\n",
|
| 751 |
+
" <tr>\n",
|
| 752 |
+
" <th>3</th>\n",
|
| 753 |
+
" <td>C6-S</td>\n",
|
| 754 |
+
" <td>J6-S</td>\n",
|
| 755 |
+
" <td>J7-S</td>\n",
|
| 756 |
+
" </tr>\n",
|
| 757 |
+
" <tr>\n",
|
| 758 |
+
" <th>4</th>\n",
|
| 759 |
+
" <td>J7-IC</td>\n",
|
| 760 |
+
" <td>J7-S</td>\n",
|
| 761 |
+
" <td>J7</td>\n",
|
| 762 |
+
" </tr>\n",
|
| 763 |
+
" <tr>\n",
|
| 764 |
+
" <th>5</th>\n",
|
| 765 |
+
" <td>C9</td>\n",
|
| 766 |
+
" <td>J9</td>\n",
|
| 767 |
+
" <td>J4</td>\n",
|
| 768 |
+
" </tr>\n",
|
| 769 |
+
" <tr>\n",
|
| 770 |
+
" <th>6</th>\n",
|
| 771 |
+
" <td>J9-IC</td>\n",
|
| 772 |
+
" <td>J9-S</td>\n",
|
| 773 |
+
" <td>J9</td>\n",
|
| 774 |
+
" </tr>\n",
|
| 775 |
+
" <tr>\n",
|
| 776 |
+
" <th>7</th>\n",
|
| 777 |
+
" <td>J6-IC</td>\n",
|
| 778 |
+
" <td>J6-S</td>\n",
|
| 779 |
+
" <td>J6</td>\n",
|
| 780 |
+
" </tr>\n",
|
| 781 |
+
" <tr>\n",
|
| 782 |
+
" <th>8</th>\n",
|
| 783 |
+
" <td>C1</td>\n",
|
| 784 |
+
" <td>J1</td>\n",
|
| 785 |
+
" <td>J2</td>\n",
|
| 786 |
+
" </tr>\n",
|
| 787 |
+
" <tr>\n",
|
| 788 |
+
" <th>9</th>\n",
|
| 789 |
+
" <td>J8-IC</td>\n",
|
| 790 |
+
" <td>J8-S</td>\n",
|
| 791 |
+
" <td>J8</td>\n",
|
| 792 |
+
" </tr>\n",
|
| 793 |
+
" <tr>\n",
|
| 794 |
+
" <th>10</th>\n",
|
| 795 |
+
" <td>C3-S</td>\n",
|
| 796 |
+
" <td>J3-S</td>\n",
|
| 797 |
+
" <td>J4-S</td>\n",
|
| 798 |
+
" </tr>\n",
|
| 799 |
+
" <tr>\n",
|
| 800 |
+
" <th>11</th>\n",
|
| 801 |
+
" <td>J5-IC</td>\n",
|
| 802 |
+
" <td>J5-S</td>\n",
|
| 803 |
+
" <td>J5</td>\n",
|
| 804 |
+
" </tr>\n",
|
| 805 |
+
" <tr>\n",
|
| 806 |
+
" <th>12</th>\n",
|
| 807 |
+
" <td>C2-S</td>\n",
|
| 808 |
+
" <td>J2-S</td>\n",
|
| 809 |
+
" <td>J3-S</td>\n",
|
| 810 |
+
" </tr>\n",
|
| 811 |
+
" <tr>\n",
|
| 812 |
+
" <th>13</th>\n",
|
| 813 |
+
" <td>C9-S</td>\n",
|
| 814 |
+
" <td>J9-S</td>\n",
|
| 815 |
+
" <td>J4-S</td>\n",
|
| 816 |
+
" </tr>\n",
|
| 817 |
+
" <tr>\n",
|
| 818 |
+
" <th>14</th>\n",
|
| 819 |
+
" <td>J4-IC</td>\n",
|
| 820 |
+
" <td>J4-S</td>\n",
|
| 821 |
+
" <td>J4</td>\n",
|
| 822 |
+
" </tr>\n",
|
| 823 |
+
" <tr>\n",
|
| 824 |
+
" <th>15</th>\n",
|
| 825 |
+
" <td>J3-IC</td>\n",
|
| 826 |
+
" <td>J3-S</td>\n",
|
| 827 |
+
" <td>J3</td>\n",
|
| 828 |
+
" </tr>\n",
|
| 829 |
+
" <tr>\n",
|
| 830 |
+
" <th>16</th>\n",
|
| 831 |
+
" <td>C4</td>\n",
|
| 832 |
+
" <td>J4</td>\n",
|
| 833 |
+
" <td>J8</td>\n",
|
| 834 |
+
" </tr>\n",
|
| 835 |
+
" <tr>\n",
|
| 836 |
+
" <th>17</th>\n",
|
| 837 |
+
" <td>PondOutlet</td>\n",
|
| 838 |
+
" <td>Pond</td>\n",
|
| 839 |
+
" <td>Outfall</td>\n",
|
| 840 |
+
" </tr>\n",
|
| 841 |
+
" <tr>\n",
|
| 842 |
+
" <th>18</th>\n",
|
| 843 |
+
" <td>C8-S</td>\n",
|
| 844 |
+
" <td>J8-S</td>\n",
|
| 845 |
+
" <td>Pond</td>\n",
|
| 846 |
+
" </tr>\n",
|
| 847 |
+
" <tr>\n",
|
| 848 |
+
" <th>19</th>\n",
|
| 849 |
+
" <td>J2-IC</td>\n",
|
| 850 |
+
" <td>J2-S</td>\n",
|
| 851 |
+
" <td>J2</td>\n",
|
| 852 |
+
" </tr>\n",
|
| 853 |
+
" <tr>\n",
|
| 854 |
+
" <th>20</th>\n",
|
| 855 |
+
" <td>C3</td>\n",
|
| 856 |
+
" <td>J3</td>\n",
|
| 857 |
+
" <td>J4</td>\n",
|
| 858 |
+
" </tr>\n",
|
| 859 |
+
" <tr>\n",
|
| 860 |
+
" <th>21</th>\n",
|
| 861 |
+
" <td>J1-IC</td>\n",
|
| 862 |
+
" <td>J1-S</td>\n",
|
| 863 |
+
" <td>J1</td>\n",
|
| 864 |
+
" </tr>\n",
|
| 865 |
+
" <tr>\n",
|
| 866 |
+
" <th>22</th>\n",
|
| 867 |
+
" <td>C6</td>\n",
|
| 868 |
+
" <td>J6</td>\n",
|
| 869 |
+
" <td>J7</td>\n",
|
| 870 |
+
" </tr>\n",
|
| 871 |
+
" <tr>\n",
|
| 872 |
+
" <th>23</th>\n",
|
| 873 |
+
" <td>C5-S</td>\n",
|
| 874 |
+
" <td>J5-S</td>\n",
|
| 875 |
+
" <td>J6-S</td>\n",
|
| 876 |
+
" </tr>\n",
|
| 877 |
+
" <tr>\n",
|
| 878 |
+
" <th>24</th>\n",
|
| 879 |
+
" <td>C4-S</td>\n",
|
| 880 |
+
" <td>J4-S</td>\n",
|
| 881 |
+
" <td>J8-S</td>\n",
|
| 882 |
+
" </tr>\n",
|
| 883 |
+
" <tr>\n",
|
| 884 |
+
" <th>25</th>\n",
|
| 885 |
+
" <td>C5</td>\n",
|
| 886 |
+
" <td>J5</td>\n",
|
| 887 |
+
" <td>J6</td>\n",
|
| 888 |
+
" </tr>\n",
|
| 889 |
+
" <tr>\n",
|
| 890 |
+
" <th>26</th>\n",
|
| 891 |
+
" <td>C8</td>\n",
|
| 892 |
+
" <td>J8</td>\n",
|
| 893 |
+
" <td>Pond</td>\n",
|
| 894 |
+
" </tr>\n",
|
| 895 |
+
" <tr>\n",
|
| 896 |
+
" <th>27</th>\n",
|
| 897 |
+
" <td>C1-S</td>\n",
|
| 898 |
+
" <td>J1-S</td>\n",
|
| 899 |
+
" <td>J2-S</td>\n",
|
| 900 |
+
" </tr>\n",
|
| 901 |
+
" </tbody>\n",
|
| 902 |
+
"</table>\n",
|
| 903 |
+
"</div>"
|
| 904 |
+
],
|
| 905 |
+
"text/plain": [
|
| 906 |
+
" link from_node to_node\n",
|
| 907 |
+
"0 C7 J7 J8\n",
|
| 908 |
+
"1 C7-S J7-S J8-S\n",
|
| 909 |
+
"2 C2 J2 J3\n",
|
| 910 |
+
"3 C6-S J6-S J7-S\n",
|
| 911 |
+
"4 J7-IC J7-S J7\n",
|
| 912 |
+
"5 C9 J9 J4\n",
|
| 913 |
+
"6 J9-IC J9-S J9\n",
|
| 914 |
+
"7 J6-IC J6-S J6\n",
|
| 915 |
+
"8 C1 J1 J2\n",
|
| 916 |
+
"9 J8-IC J8-S J8\n",
|
| 917 |
+
"10 C3-S J3-S J4-S\n",
|
| 918 |
+
"11 J5-IC J5-S J5\n",
|
| 919 |
+
"12 C2-S J2-S J3-S\n",
|
| 920 |
+
"13 C9-S J9-S J4-S\n",
|
| 921 |
+
"14 J4-IC J4-S J4\n",
|
| 922 |
+
"15 J3-IC J3-S J3\n",
|
| 923 |
+
"16 C4 J4 J8\n",
|
| 924 |
+
"17 PondOutlet Pond Outfall\n",
|
| 925 |
+
"18 C8-S J8-S Pond\n",
|
| 926 |
+
"19 J2-IC J2-S J2\n",
|
| 927 |
+
"20 C3 J3 J4\n",
|
| 928 |
+
"21 J1-IC J1-S J1\n",
|
| 929 |
+
"22 C6 J6 J7\n",
|
| 930 |
+
"23 C5-S J5-S J6-S\n",
|
| 931 |
+
"24 C4-S J4-S J8-S\n",
|
| 932 |
+
"25 C5 J5 J6\n",
|
| 933 |
+
"26 C8 J8 Pond\n",
|
| 934 |
+
"27 C1-S J1-S J2-S"
|
| 935 |
+
]
|
| 936 |
+
},
|
| 937 |
+
"metadata": {},
|
| 938 |
+
"output_type": "display_data"
|
| 939 |
+
},
|
| 940 |
+
{
|
| 941 |
+
"data": {
|
| 942 |
+
"text/markdown": [
|
| 943 |
+
"### Orphan links"
|
| 944 |
+
],
|
| 945 |
+
"text/plain": [
|
| 946 |
+
"<IPython.core.display.Markdown object>"
|
| 947 |
+
]
|
| 948 |
+
},
|
| 949 |
+
"metadata": {},
|
| 950 |
+
"output_type": "display_data"
|
| 951 |
+
},
|
| 952 |
+
{
|
| 953 |
+
"data": {
|
| 954 |
+
"text/html": [
|
| 955 |
+
"<div>\n",
|
| 956 |
+
"<style scoped>\n",
|
| 957 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 958 |
+
" vertical-align: middle;\n",
|
| 959 |
+
" }\n",
|
| 960 |
+
"\n",
|
| 961 |
+
" .dataframe tbody tr th {\n",
|
| 962 |
+
" vertical-align: top;\n",
|
| 963 |
+
" }\n",
|
| 964 |
+
"\n",
|
| 965 |
+
" .dataframe thead th {\n",
|
| 966 |
+
" text-align: right;\n",
|
| 967 |
+
" }\n",
|
| 968 |
+
"</style>\n",
|
| 969 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 970 |
+
" <thead>\n",
|
| 971 |
+
" <tr style=\"text-align: right;\">\n",
|
| 972 |
+
" <th></th>\n",
|
| 973 |
+
" </tr>\n",
|
| 974 |
+
" </thead>\n",
|
| 975 |
+
" <tbody>\n",
|
| 976 |
+
" </tbody>\n",
|
| 977 |
+
"</table>\n",
|
| 978 |
+
"</div>"
|
| 979 |
+
],
|
| 980 |
+
"text/plain": [
|
| 981 |
+
"Empty DataFrame\n",
|
| 982 |
+
"Columns: []\n",
|
| 983 |
+
"Index: []"
|
| 984 |
+
]
|
| 985 |
+
},
|
| 986 |
+
"metadata": {},
|
| 987 |
+
"output_type": "display_data"
|
| 988 |
+
},
|
| 989 |
+
{
|
| 990 |
+
"data": {
|
| 991 |
+
"text/markdown": [
|
| 992 |
+
"### Isolated nodes"
|
| 993 |
+
],
|
| 994 |
+
"text/plain": [
|
| 995 |
+
"<IPython.core.display.Markdown object>"
|
| 996 |
+
]
|
| 997 |
+
},
|
| 998 |
+
"metadata": {},
|
| 999 |
+
"output_type": "display_data"
|
| 1000 |
+
},
|
| 1001 |
+
{
|
| 1002 |
+
"data": {
|
| 1003 |
+
"text/html": [
|
| 1004 |
+
"<div>\n",
|
| 1005 |
+
"<style scoped>\n",
|
| 1006 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 1007 |
+
" vertical-align: middle;\n",
|
| 1008 |
+
" }\n",
|
| 1009 |
+
"\n",
|
| 1010 |
+
" .dataframe tbody tr th {\n",
|
| 1011 |
+
" vertical-align: top;\n",
|
| 1012 |
+
" }\n",
|
| 1013 |
+
"\n",
|
| 1014 |
+
" .dataframe thead th {\n",
|
| 1015 |
+
" text-align: right;\n",
|
| 1016 |
+
" }\n",
|
| 1017 |
+
"</style>\n",
|
| 1018 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 1019 |
+
" <thead>\n",
|
| 1020 |
+
" <tr style=\"text-align: right;\">\n",
|
| 1021 |
+
" <th></th>\n",
|
| 1022 |
+
" </tr>\n",
|
| 1023 |
+
" </thead>\n",
|
| 1024 |
+
" <tbody>\n",
|
| 1025 |
+
" </tbody>\n",
|
| 1026 |
+
"</table>\n",
|
| 1027 |
+
"</div>"
|
| 1028 |
+
],
|
| 1029 |
+
"text/plain": [
|
| 1030 |
+
"Empty DataFrame\n",
|
| 1031 |
+
"Columns: []\n",
|
| 1032 |
+
"Index: []"
|
| 1033 |
+
]
|
| 1034 |
+
},
|
| 1035 |
+
"metadata": {},
|
| 1036 |
+
"output_type": "display_data"
|
| 1037 |
+
}
|
| 1038 |
+
],
|
| 1039 |
+
"source": [
|
| 1040 |
+
"display(pd.DataFrame(\n",
|
| 1041 |
+
" list(client.project.summary().items()),\n",
|
| 1042 |
+
" columns=[\"Property\", \"Value\"],\n",
|
| 1043 |
+
"))\n",
|
| 1044 |
+
"\n",
|
| 1045 |
+
"display(Markdown(\"### Collection inventory\"))\n",
|
| 1046 |
+
"display(pd.DataFrame(client.collections.summary()))\n",
|
| 1047 |
+
"\n",
|
| 1048 |
+
"display(Markdown(\"### Link endpoints\"))\n",
|
| 1049 |
+
"display(pd.DataFrame(client.topology.link_endpoints()))\n",
|
| 1050 |
+
"\n",
|
| 1051 |
+
"display(Markdown(\"### Orphan links\"))\n",
|
| 1052 |
+
"display(pd.DataFrame(client.topology.orphan_links()))\n",
|
| 1053 |
+
"\n",
|
| 1054 |
+
"display(Markdown(\"### Isolated nodes\"))\n",
|
| 1055 |
+
"display(pd.DataFrame(client.topology.isolated_nodes()))"
|
| 1056 |
+
]
|
| 1057 |
+
},
|
| 1058 |
+
{
|
| 1059 |
+
"cell_type": "markdown",
|
| 1060 |
+
"id": "da05eee1",
|
| 1061 |
+
"metadata": {},
|
| 1062 |
+
"source": [
|
| 1063 |
+
"## 4. Conditional hydrology review"
|
| 1064 |
+
]
|
| 1065 |
+
},
|
| 1066 |
+
{
|
| 1067 |
+
"cell_type": "code",
|
| 1068 |
+
"execution_count": 4,
|
| 1069 |
+
"id": "e14293ce",
|
| 1070 |
+
"metadata": {
|
| 1071 |
+
"tags": []
|
| 1072 |
+
},
|
| 1073 |
+
"outputs": [
|
| 1074 |
+
{
|
| 1075 |
+
"data": {
|
| 1076 |
+
"text/html": [
|
| 1077 |
+
"<div>\n",
|
| 1078 |
+
"<style scoped>\n",
|
| 1079 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 1080 |
+
" vertical-align: middle;\n",
|
| 1081 |
+
" }\n",
|
| 1082 |
+
"\n",
|
| 1083 |
+
" .dataframe tbody tr th {\n",
|
| 1084 |
+
" vertical-align: top;\n",
|
| 1085 |
+
" }\n",
|
| 1086 |
+
"\n",
|
| 1087 |
+
" .dataframe thead th {\n",
|
| 1088 |
+
" text-align: right;\n",
|
| 1089 |
+
" }\n",
|
| 1090 |
+
"</style>\n",
|
| 1091 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 1092 |
+
" <thead>\n",
|
| 1093 |
+
" <tr style=\"text-align: right;\">\n",
|
| 1094 |
+
" <th></th>\n",
|
| 1095 |
+
" <th>Metric</th>\n",
|
| 1096 |
+
" <th>Value</th>\n",
|
| 1097 |
+
" </tr>\n",
|
| 1098 |
+
" </thead>\n",
|
| 1099 |
+
" <tbody>\n",
|
| 1100 |
+
" <tr>\n",
|
| 1101 |
+
" <th>0</th>\n",
|
| 1102 |
+
" <td>subcatchment_count</td>\n",
|
| 1103 |
+
" <td>9.00</td>\n",
|
| 1104 |
+
" </tr>\n",
|
| 1105 |
+
" <tr>\n",
|
| 1106 |
+
" <th>1</th>\n",
|
| 1107 |
+
" <td>total_area_model_units</td>\n",
|
| 1108 |
+
" <td>7.17</td>\n",
|
| 1109 |
+
" </tr>\n",
|
| 1110 |
+
" <tr>\n",
|
| 1111 |
+
" <th>2</th>\n",
|
| 1112 |
+
" <td>weighted_percent_impervious</td>\n",
|
| 1113 |
+
" <td>30.00</td>\n",
|
| 1114 |
+
" </tr>\n",
|
| 1115 |
+
" <tr>\n",
|
| 1116 |
+
" <th>3</th>\n",
|
| 1117 |
+
" <td>finding_count</td>\n",
|
| 1118 |
+
" <td>9.00</td>\n",
|
| 1119 |
+
" </tr>\n",
|
| 1120 |
+
" </tbody>\n",
|
| 1121 |
+
"</table>\n",
|
| 1122 |
+
"</div>"
|
| 1123 |
+
],
|
| 1124 |
+
"text/plain": [
|
| 1125 |
+
" Metric Value\n",
|
| 1126 |
+
"0 subcatchment_count 9.00\n",
|
| 1127 |
+
"1 total_area_model_units 7.17\n",
|
| 1128 |
+
"2 weighted_percent_impervious 30.00\n",
|
| 1129 |
+
"3 finding_count 9.00"
|
| 1130 |
+
]
|
| 1131 |
+
},
|
| 1132 |
+
"metadata": {},
|
| 1133 |
+
"output_type": "display_data"
|
| 1134 |
+
},
|
| 1135 |
+
{
|
| 1136 |
+
"data": {
|
| 1137 |
+
"text/html": [
|
| 1138 |
+
"<div>\n",
|
| 1139 |
+
"<style scoped>\n",
|
| 1140 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 1141 |
+
" vertical-align: middle;\n",
|
| 1142 |
+
" }\n",
|
| 1143 |
+
"\n",
|
| 1144 |
+
" .dataframe tbody tr th {\n",
|
| 1145 |
+
" vertical-align: top;\n",
|
| 1146 |
+
" }\n",
|
| 1147 |
+
"\n",
|
| 1148 |
+
" .dataframe thead th {\n",
|
| 1149 |
+
" text-align: right;\n",
|
| 1150 |
+
" }\n",
|
| 1151 |
+
"</style>\n",
|
| 1152 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 1153 |
+
" <thead>\n",
|
| 1154 |
+
" <tr style=\"text-align: right;\">\n",
|
| 1155 |
+
" <th></th>\n",
|
| 1156 |
+
" <th>Name</th>\n",
|
| 1157 |
+
" <th>Area</th>\n",
|
| 1158 |
+
" <th>Width</th>\n",
|
| 1159 |
+
" <th>WidthAreaRatio</th>\n",
|
| 1160 |
+
" <th>Slope</th>\n",
|
| 1161 |
+
" <th>PctImperv</th>\n",
|
| 1162 |
+
" <th>CurveNumber</th>\n",
|
| 1163 |
+
" <th>Outlet</th>\n",
|
| 1164 |
+
" <th>issues</th>\n",
|
| 1165 |
+
" </tr>\n",
|
| 1166 |
+
" </thead>\n",
|
| 1167 |
+
" <tbody>\n",
|
| 1168 |
+
" <tr>\n",
|
| 1169 |
+
" <th>0</th>\n",
|
| 1170 |
+
" <td>S1</td>\n",
|
| 1171 |
+
" <td>1.41</td>\n",
|
| 1172 |
+
" <td>148.4210</td>\n",
|
| 1173 |
+
" <td>105.263121</td>\n",
|
| 1174 |
+
" <td>0.5</td>\n",
|
| 1175 |
+
" <td>30.0</td>\n",
|
| 1176 |
+
" <td>None</td>\n",
|
| 1177 |
+
" <td>J1-S</td>\n",
|
| 1178 |
+
" <td>[width-to-area ratio outside screening range]</td>\n",
|
| 1179 |
+
" </tr>\n",
|
| 1180 |
+
" <tr>\n",
|
| 1181 |
+
" <th>1</th>\n",
|
| 1182 |
+
" <td>S2</td>\n",
|
| 1183 |
+
" <td>1.05</td>\n",
|
| 1184 |
+
" <td>110.5263</td>\n",
|
| 1185 |
+
" <td>105.263143</td>\n",
|
| 1186 |
+
" <td>0.5</td>\n",
|
| 1187 |
+
" <td>30.0</td>\n",
|
| 1188 |
+
" <td>None</td>\n",
|
| 1189 |
+
" <td>J2-S</td>\n",
|
| 1190 |
+
" <td>[width-to-area ratio outside screening range]</td>\n",
|
| 1191 |
+
" </tr>\n",
|
| 1192 |
+
" <tr>\n",
|
| 1193 |
+
" <th>2</th>\n",
|
| 1194 |
+
" <td>S3</td>\n",
|
| 1195 |
+
" <td>1.03</td>\n",
|
| 1196 |
+
" <td>108.4210</td>\n",
|
| 1197 |
+
" <td>105.263107</td>\n",
|
| 1198 |
+
" <td>0.5</td>\n",
|
| 1199 |
+
" <td>30.0</td>\n",
|
| 1200 |
+
" <td>None</td>\n",
|
| 1201 |
+
" <td>J3-S</td>\n",
|
| 1202 |
+
" <td>[width-to-area ratio outside screening range]</td>\n",
|
| 1203 |
+
" </tr>\n",
|
| 1204 |
+
" <tr>\n",
|
| 1205 |
+
" <th>3</th>\n",
|
| 1206 |
+
" <td>S4</td>\n",
|
| 1207 |
+
" <td>0.55</td>\n",
|
| 1208 |
+
" <td>57.8947</td>\n",
|
| 1209 |
+
" <td>105.263091</td>\n",
|
| 1210 |
+
" <td>0.5</td>\n",
|
| 1211 |
+
" <td>30.0</td>\n",
|
| 1212 |
+
" <td>None</td>\n",
|
| 1213 |
+
" <td>J4-S</td>\n",
|
| 1214 |
+
" <td>[width-to-area ratio outside screening range]</td>\n",
|
| 1215 |
+
" </tr>\n",
|
| 1216 |
+
" <tr>\n",
|
| 1217 |
+
" <th>4</th>\n",
|
| 1218 |
+
" <td>S5</td>\n",
|
| 1219 |
+
" <td>0.18</td>\n",
|
| 1220 |
+
" <td>18.9474</td>\n",
|
| 1221 |
+
" <td>105.263333</td>\n",
|
| 1222 |
+
" <td>0.5</td>\n",
|
| 1223 |
+
" <td>30.0</td>\n",
|
| 1224 |
+
" <td>None</td>\n",
|
| 1225 |
+
" <td>J5-S</td>\n",
|
| 1226 |
+
" <td>[width-to-area ratio outside screening range]</td>\n",
|
| 1227 |
+
" </tr>\n",
|
| 1228 |
+
" <tr>\n",
|
| 1229 |
+
" <th>5</th>\n",
|
| 1230 |
+
" <td>S6</td>\n",
|
| 1231 |
+
" <td>0.97</td>\n",
|
| 1232 |
+
" <td>102.1053</td>\n",
|
| 1233 |
+
" <td>105.263196</td>\n",
|
| 1234 |
+
" <td>0.5</td>\n",
|
| 1235 |
+
" <td>30.0</td>\n",
|
| 1236 |
+
" <td>None</td>\n",
|
| 1237 |
+
" <td>J6-S</td>\n",
|
| 1238 |
+
" <td>[width-to-area ratio outside screening range]</td>\n",
|
| 1239 |
+
" </tr>\n",
|
| 1240 |
+
" <tr>\n",
|
| 1241 |
+
" <th>6</th>\n",
|
| 1242 |
+
" <td>S7</td>\n",
|
| 1243 |
+
" <td>1.49</td>\n",
|
| 1244 |
+
" <td>156.8420</td>\n",
|
| 1245 |
+
" <td>105.263087</td>\n",
|
| 1246 |
+
" <td>0.5</td>\n",
|
| 1247 |
+
" <td>30.0</td>\n",
|
| 1248 |
+
" <td>None</td>\n",
|
| 1249 |
+
" <td>J7-S</td>\n",
|
| 1250 |
+
" <td>[width-to-area ratio outside screening range]</td>\n",
|
| 1251 |
+
" </tr>\n",
|
| 1252 |
+
" <tr>\n",
|
| 1253 |
+
" <th>7</th>\n",
|
| 1254 |
+
" <td>S8</td>\n",
|
| 1255 |
+
" <td>0.26</td>\n",
|
| 1256 |
+
" <td>27.3684</td>\n",
|
| 1257 |
+
" <td>105.263077</td>\n",
|
| 1258 |
+
" <td>0.5</td>\n",
|
| 1259 |
+
" <td>30.0</td>\n",
|
| 1260 |
+
" <td>None</td>\n",
|
| 1261 |
+
" <td>J8-S</td>\n",
|
| 1262 |
+
" <td>[width-to-area ratio outside screening range]</td>\n",
|
| 1263 |
+
" </tr>\n",
|
| 1264 |
+
" <tr>\n",
|
| 1265 |
+
" <th>8</th>\n",
|
| 1266 |
+
" <td>S9</td>\n",
|
| 1267 |
+
" <td>0.23</td>\n",
|
| 1268 |
+
" <td>24.2105</td>\n",
|
| 1269 |
+
" <td>105.263043</td>\n",
|
| 1270 |
+
" <td>0.5</td>\n",
|
| 1271 |
+
" <td>30.0</td>\n",
|
| 1272 |
+
" <td>None</td>\n",
|
| 1273 |
+
" <td>J9-S</td>\n",
|
| 1274 |
+
" <td>[width-to-area ratio outside screening range]</td>\n",
|
| 1275 |
+
" </tr>\n",
|
| 1276 |
+
" </tbody>\n",
|
| 1277 |
+
"</table>\n",
|
| 1278 |
+
"</div>"
|
| 1279 |
+
],
|
| 1280 |
+
"text/plain": [
|
| 1281 |
+
" Name Area Width WidthAreaRatio Slope PctImperv CurveNumber Outlet \\\n",
|
| 1282 |
+
"0 S1 1.41 148.4210 105.263121 0.5 30.0 None J1-S \n",
|
| 1283 |
+
"1 S2 1.05 110.5263 105.263143 0.5 30.0 None J2-S \n",
|
| 1284 |
+
"2 S3 1.03 108.4210 105.263107 0.5 30.0 None J3-S \n",
|
| 1285 |
+
"3 S4 0.55 57.8947 105.263091 0.5 30.0 None J4-S \n",
|
| 1286 |
+
"4 S5 0.18 18.9474 105.263333 0.5 30.0 None J5-S \n",
|
| 1287 |
+
"5 S6 0.97 102.1053 105.263196 0.5 30.0 None J6-S \n",
|
| 1288 |
+
"6 S7 1.49 156.8420 105.263087 0.5 30.0 None J7-S \n",
|
| 1289 |
+
"7 S8 0.26 27.3684 105.263077 0.5 30.0 None J8-S \n",
|
| 1290 |
+
"8 S9 0.23 24.2105 105.263043 0.5 30.0 None J9-S \n",
|
| 1291 |
+
"\n",
|
| 1292 |
+
" issues \n",
|
| 1293 |
+
"0 [width-to-area ratio outside screening range] \n",
|
| 1294 |
+
"1 [width-to-area ratio outside screening range] \n",
|
| 1295 |
+
"2 [width-to-area ratio outside screening range] \n",
|
| 1296 |
+
"3 [width-to-area ratio outside screening range] \n",
|
| 1297 |
+
"4 [width-to-area ratio outside screening range] \n",
|
| 1298 |
+
"5 [width-to-area ratio outside screening range] \n",
|
| 1299 |
+
"6 [width-to-area ratio outside screening range] \n",
|
| 1300 |
+
"7 [width-to-area ratio outside screening range] \n",
|
| 1301 |
+
"8 [width-to-area ratio outside screening range] "
|
| 1302 |
+
]
|
| 1303 |
+
},
|
| 1304 |
+
"metadata": {},
|
| 1305 |
+
"output_type": "display_data"
|
| 1306 |
+
}
|
| 1307 |
+
],
|
| 1308 |
+
"source": [
|
| 1309 |
+
"if capabilities[\"has_subcatchments\"]:\n",
|
| 1310 |
+
" display(pd.DataFrame(\n",
|
| 1311 |
+
" list(client.hydrology.summary().items()),\n",
|
| 1312 |
+
" columns=[\"Metric\", \"Value\"],\n",
|
| 1313 |
+
" ))\n",
|
| 1314 |
+
" display(pd.DataFrame(client.hydrology.review()))\n",
|
| 1315 |
+
"else:\n",
|
| 1316 |
+
" print(\"Hydrology review is not applicable to this model.\")"
|
| 1317 |
+
]
|
| 1318 |
+
},
|
| 1319 |
+
{
|
| 1320 |
+
"cell_type": "markdown",
|
| 1321 |
+
"id": "94e3a023",
|
| 1322 |
+
"metadata": {},
|
| 1323 |
+
"source": [
|
| 1324 |
+
"## 5. Conditional storage and outlet review"
|
| 1325 |
+
]
|
| 1326 |
+
},
|
| 1327 |
+
{
|
| 1328 |
+
"cell_type": "code",
|
| 1329 |
+
"execution_count": 5,
|
| 1330 |
+
"id": "5edb6b42",
|
| 1331 |
+
"metadata": {
|
| 1332 |
+
"tags": []
|
| 1333 |
+
},
|
| 1334 |
+
"outputs": [
|
| 1335 |
+
{
|
| 1336 |
+
"data": {
|
| 1337 |
+
"text/markdown": [
|
| 1338 |
+
"### Storage summary"
|
| 1339 |
+
],
|
| 1340 |
+
"text/plain": [
|
| 1341 |
+
"<IPython.core.display.Markdown object>"
|
| 1342 |
+
]
|
| 1343 |
+
},
|
| 1344 |
+
"metadata": {},
|
| 1345 |
+
"output_type": "display_data"
|
| 1346 |
+
},
|
| 1347 |
+
{
|
| 1348 |
+
"data": {
|
| 1349 |
+
"text/html": [
|
| 1350 |
+
"<div>\n",
|
| 1351 |
+
"<style scoped>\n",
|
| 1352 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 1353 |
+
" vertical-align: middle;\n",
|
| 1354 |
+
" }\n",
|
| 1355 |
+
"\n",
|
| 1356 |
+
" .dataframe tbody tr th {\n",
|
| 1357 |
+
" vertical-align: top;\n",
|
| 1358 |
+
" }\n",
|
| 1359 |
+
"\n",
|
| 1360 |
+
" .dataframe thead th {\n",
|
| 1361 |
+
" text-align: right;\n",
|
| 1362 |
+
" }\n",
|
| 1363 |
+
"</style>\n",
|
| 1364 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 1365 |
+
" <thead>\n",
|
| 1366 |
+
" <tr style=\"text-align: right;\">\n",
|
| 1367 |
+
" <th></th>\n",
|
| 1368 |
+
" <th>Metric</th>\n",
|
| 1369 |
+
" <th>Value</th>\n",
|
| 1370 |
+
" </tr>\n",
|
| 1371 |
+
" </thead>\n",
|
| 1372 |
+
" <tbody>\n",
|
| 1373 |
+
" <tr>\n",
|
| 1374 |
+
" <th>0</th>\n",
|
| 1375 |
+
" <td>storage_count</td>\n",
|
| 1376 |
+
" <td>1</td>\n",
|
| 1377 |
+
" </tr>\n",
|
| 1378 |
+
" <tr>\n",
|
| 1379 |
+
" <th>1</th>\n",
|
| 1380 |
+
" <td>outlet_structure_count</td>\n",
|
| 1381 |
+
" <td>10</td>\n",
|
| 1382 |
+
" </tr>\n",
|
| 1383 |
+
" <tr>\n",
|
| 1384 |
+
" <th>2</th>\n",
|
| 1385 |
+
" <td>finding_count</td>\n",
|
| 1386 |
+
" <td>0</td>\n",
|
| 1387 |
+
" </tr>\n",
|
| 1388 |
+
" </tbody>\n",
|
| 1389 |
+
"</table>\n",
|
| 1390 |
+
"</div>"
|
| 1391 |
+
],
|
| 1392 |
+
"text/plain": [
|
| 1393 |
+
" Metric Value\n",
|
| 1394 |
+
"0 storage_count 1\n",
|
| 1395 |
+
"1 outlet_structure_count 10\n",
|
| 1396 |
+
"2 finding_count 0"
|
| 1397 |
+
]
|
| 1398 |
+
},
|
| 1399 |
+
"metadata": {},
|
| 1400 |
+
"output_type": "display_data"
|
| 1401 |
+
},
|
| 1402 |
+
{
|
| 1403 |
+
"data": {
|
| 1404 |
+
"text/markdown": [
|
| 1405 |
+
"### Storage records"
|
| 1406 |
+
],
|
| 1407 |
+
"text/plain": [
|
| 1408 |
+
"<IPython.core.display.Markdown object>"
|
| 1409 |
+
]
|
| 1410 |
+
},
|
| 1411 |
+
"metadata": {},
|
| 1412 |
+
"output_type": "display_data"
|
| 1413 |
+
},
|
| 1414 |
+
{
|
| 1415 |
+
"data": {
|
| 1416 |
+
"text/html": [
|
| 1417 |
+
"<div>\n",
|
| 1418 |
+
"<style scoped>\n",
|
| 1419 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 1420 |
+
" vertical-align: middle;\n",
|
| 1421 |
+
" }\n",
|
| 1422 |
+
"\n",
|
| 1423 |
+
" .dataframe tbody tr th {\n",
|
| 1424 |
+
" vertical-align: top;\n",
|
| 1425 |
+
" }\n",
|
| 1426 |
+
"\n",
|
| 1427 |
+
" .dataframe thead th {\n",
|
| 1428 |
+
" text-align: right;\n",
|
| 1429 |
+
" }\n",
|
| 1430 |
+
"</style>\n",
|
| 1431 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 1432 |
+
" <thead>\n",
|
| 1433 |
+
" <tr style=\"text-align: right;\">\n",
|
| 1434 |
+
" <th></th>\n",
|
| 1435 |
+
" <th>Name</th>\n",
|
| 1436 |
+
" <th>ObjectType</th>\n",
|
| 1437 |
+
" <th>Conductivity</th>\n",
|
| 1438 |
+
" <th>DWInflow</th>\n",
|
| 1439 |
+
" <th>DWInflows</th>\n",
|
| 1440 |
+
" <th>Depth</th>\n",
|
| 1441 |
+
" <th>Description</th>\n",
|
| 1442 |
+
" <th>DirectInflow</th>\n",
|
| 1443 |
+
" <th>DirectInflows</th>\n",
|
| 1444 |
+
" <th>EvapFactor</th>\n",
|
| 1445 |
+
" <th>...</th>\n",
|
| 1446 |
+
" <th>SewershedArea</th>\n",
|
| 1447 |
+
" <th>StorageCurveType</th>\n",
|
| 1448 |
+
" <th>SuctionHead</th>\n",
|
| 1449 |
+
" <th>SurchargeDepth</th>\n",
|
| 1450 |
+
" <th>Tag</th>\n",
|
| 1451 |
+
" <th>Treatment</th>\n",
|
| 1452 |
+
" <th>Treatments</th>\n",
|
| 1453 |
+
" <th>UH</th>\n",
|
| 1454 |
+
" <th>X</th>\n",
|
| 1455 |
+
" <th>Y</th>\n",
|
| 1456 |
+
" </tr>\n",
|
| 1457 |
+
" </thead>\n",
|
| 1458 |
+
" <tbody>\n",
|
| 1459 |
+
" <tr>\n",
|
| 1460 |
+
" <th>0</th>\n",
|
| 1461 |
+
" <td>Pond</td>\n",
|
| 1462 |
+
" <td>Storages</td>\n",
|
| 1463 |
+
" <td>0.0</td>\n",
|
| 1464 |
+
" <td>PCSWMM.Scripts.IndexProperty`2[System.String,P...</td>\n",
|
| 1465 |
+
" <td>PCSWMM.Scripts.PythonDictionaryExt</td>\n",
|
| 1466 |
+
" <td>2.0</td>\n",
|
| 1467 |
+
" <td>None</td>\n",
|
| 1468 |
+
" <td>PCSWMM.Scripts.IndexProperty`2[System.String,P...</td>\n",
|
| 1469 |
+
" <td>PCSWMM.Scripts.PythonDictionaryExt</td>\n",
|
| 1470 |
+
" <td>0.0</td>\n",
|
| 1471 |
+
" <td>...</td>\n",
|
| 1472 |
+
" <td>0.0</td>\n",
|
| 1473 |
+
" <td>FUNCTIONAL</td>\n",
|
| 1474 |
+
" <td>0.0</td>\n",
|
| 1475 |
+
" <td>0.0</td>\n",
|
| 1476 |
+
" <td></td>\n",
|
| 1477 |
+
" <td>PCSWMM.Scripts.IndexProperty`2[System.String,S...</td>\n",
|
| 1478 |
+
" <td>PCSWMM.Scripts.PythonDictionaryExt</td>\n",
|
| 1479 |
+
" <td></td>\n",
|
| 1480 |
+
" <td>254377.071</td>\n",
|
| 1481 |
+
" <td>5015025.677</td>\n",
|
| 1482 |
+
" </tr>\n",
|
| 1483 |
+
" </tbody>\n",
|
| 1484 |
+
"</table>\n",
|
| 1485 |
+
"<p>1 rows × 29 columns</p>\n",
|
| 1486 |
+
"</div>"
|
| 1487 |
+
],
|
| 1488 |
+
"text/plain": [
|
| 1489 |
+
" Name ObjectType Conductivity \\\n",
|
| 1490 |
+
"0 Pond Storages 0.0 \n",
|
| 1491 |
+
"\n",
|
| 1492 |
+
" DWInflow \\\n",
|
| 1493 |
+
"0 PCSWMM.Scripts.IndexProperty`2[System.String,P... \n",
|
| 1494 |
+
"\n",
|
| 1495 |
+
" DWInflows Depth Description \\\n",
|
| 1496 |
+
"0 PCSWMM.Scripts.PythonDictionaryExt 2.0 None \n",
|
| 1497 |
+
"\n",
|
| 1498 |
+
" DirectInflow \\\n",
|
| 1499 |
+
"0 PCSWMM.Scripts.IndexProperty`2[System.String,P... \n",
|
| 1500 |
+
"\n",
|
| 1501 |
+
" DirectInflows EvapFactor ... SewershedArea \\\n",
|
| 1502 |
+
"0 PCSWMM.Scripts.PythonDictionaryExt 0.0 ... 0.0 \n",
|
| 1503 |
+
"\n",
|
| 1504 |
+
" StorageCurveType SuctionHead SurchargeDepth Tag \\\n",
|
| 1505 |
+
"0 FUNCTIONAL 0.0 0.0 \n",
|
| 1506 |
+
"\n",
|
| 1507 |
+
" Treatment \\\n",
|
| 1508 |
+
"0 PCSWMM.Scripts.IndexProperty`2[System.String,S... \n",
|
| 1509 |
+
"\n",
|
| 1510 |
+
" Treatments UH X Y \n",
|
| 1511 |
+
"0 PCSWMM.Scripts.PythonDictionaryExt 254377.071 5015025.677 \n",
|
| 1512 |
+
"\n",
|
| 1513 |
+
"[1 rows x 29 columns]"
|
| 1514 |
+
]
|
| 1515 |
+
},
|
| 1516 |
+
"metadata": {},
|
| 1517 |
+
"output_type": "display_data"
|
| 1518 |
+
},
|
| 1519 |
+
{
|
| 1520 |
+
"data": {
|
| 1521 |
+
"text/markdown": [
|
| 1522 |
+
"### Outlet structures"
|
| 1523 |
+
],
|
| 1524 |
+
"text/plain": [
|
| 1525 |
+
"<IPython.core.display.Markdown object>"
|
| 1526 |
+
]
|
| 1527 |
+
},
|
| 1528 |
+
"metadata": {},
|
| 1529 |
+
"output_type": "display_data"
|
| 1530 |
+
},
|
| 1531 |
+
{
|
| 1532 |
+
"data": {
|
| 1533 |
+
"text/html": [
|
| 1534 |
+
"<div>\n",
|
| 1535 |
+
"<style scoped>\n",
|
| 1536 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 1537 |
+
" vertical-align: middle;\n",
|
| 1538 |
+
" }\n",
|
| 1539 |
+
"\n",
|
| 1540 |
+
" .dataframe tbody tr th {\n",
|
| 1541 |
+
" vertical-align: top;\n",
|
| 1542 |
+
" }\n",
|
| 1543 |
+
"\n",
|
| 1544 |
+
" .dataframe thead th {\n",
|
| 1545 |
+
" text-align: right;\n",
|
| 1546 |
+
" }\n",
|
| 1547 |
+
"</style>\n",
|
| 1548 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 1549 |
+
" <thead>\n",
|
| 1550 |
+
" <tr style=\"text-align: right;\">\n",
|
| 1551 |
+
" <th></th>\n",
|
| 1552 |
+
" <th>Name</th>\n",
|
| 1553 |
+
" <th>ObjectType</th>\n",
|
| 1554 |
+
" <th>Curve</th>\n",
|
| 1555 |
+
" <th>Description</th>\n",
|
| 1556 |
+
" <th>FlapGate</th>\n",
|
| 1557 |
+
" <th>FunctionCoeff</th>\n",
|
| 1558 |
+
" <th>FunctionExp</th>\n",
|
| 1559 |
+
" <th>InletNode</th>\n",
|
| 1560 |
+
" <th>InletOffset</th>\n",
|
| 1561 |
+
" <th>Notes</th>\n",
|
| 1562 |
+
" <th>OutletNode</th>\n",
|
| 1563 |
+
" <th>RatingCurveType</th>\n",
|
| 1564 |
+
" <th>Tag</th>\n",
|
| 1565 |
+
" <th>StructureCollection</th>\n",
|
| 1566 |
+
" </tr>\n",
|
| 1567 |
+
" </thead>\n",
|
| 1568 |
+
" <tbody>\n",
|
| 1569 |
+
" <tr>\n",
|
| 1570 |
+
" <th>0</th>\n",
|
| 1571 |
+
" <td>J2-IC</td>\n",
|
| 1572 |
+
" <td>Outlets</td>\n",
|
| 1573 |
+
" <td>Catchbasin</td>\n",
|
| 1574 |
+
" <td>None</td>\n",
|
| 1575 |
+
" <td>NO</td>\n",
|
| 1576 |
+
" <td>10.0</td>\n",
|
| 1577 |
+
" <td>0.5</td>\n",
|
| 1578 |
+
" <td>J2-S</td>\n",
|
| 1579 |
+
" <td>0.0</td>\n",
|
| 1580 |
+
" <td>System.Collections.Generic.List`1[PCSWMM.Scrip...</td>\n",
|
| 1581 |
+
" <td>J2</td>\n",
|
| 1582 |
+
" <td>TABULAR/DEPTH</td>\n",
|
| 1583 |
+
" <td></td>\n",
|
| 1584 |
+
" <td>Outlets</td>\n",
|
| 1585 |
+
" </tr>\n",
|
| 1586 |
+
" <tr>\n",
|
| 1587 |
+
" <th>1</th>\n",
|
| 1588 |
+
" <td>J8-IC</td>\n",
|
| 1589 |
+
" <td>Outlets</td>\n",
|
| 1590 |
+
" <td>Catchbasin</td>\n",
|
| 1591 |
+
" <td>None</td>\n",
|
| 1592 |
+
" <td>NO</td>\n",
|
| 1593 |
+
" <td>10.0</td>\n",
|
| 1594 |
+
" <td>0.5</td>\n",
|
| 1595 |
+
" <td>J8-S</td>\n",
|
| 1596 |
+
" <td>0.0</td>\n",
|
| 1597 |
+
" <td>System.Collections.Generic.List`1[PCSWMM.Scrip...</td>\n",
|
| 1598 |
+
" <td>J8</td>\n",
|
| 1599 |
+
" <td>TABULAR/DEPTH</td>\n",
|
| 1600 |
+
" <td></td>\n",
|
| 1601 |
+
" <td>Outlets</td>\n",
|
| 1602 |
+
" </tr>\n",
|
| 1603 |
+
" <tr>\n",
|
| 1604 |
+
" <th>2</th>\n",
|
| 1605 |
+
" <td>J3-IC</td>\n",
|
| 1606 |
+
" <td>Outlets</td>\n",
|
| 1607 |
+
" <td>Catchbasin</td>\n",
|
| 1608 |
+
" <td>None</td>\n",
|
| 1609 |
+
" <td>NO</td>\n",
|
| 1610 |
+
" <td>10.0</td>\n",
|
| 1611 |
+
" <td>0.5</td>\n",
|
| 1612 |
+
" <td>J3-S</td>\n",
|
| 1613 |
+
" <td>0.0</td>\n",
|
| 1614 |
+
" <td>System.Collections.Generic.List`1[PCSWMM.Scrip...</td>\n",
|
| 1615 |
+
" <td>J3</td>\n",
|
| 1616 |
+
" <td>TABULAR/DEPTH</td>\n",
|
| 1617 |
+
" <td></td>\n",
|
| 1618 |
+
" <td>Outlets</td>\n",
|
| 1619 |
+
" </tr>\n",
|
| 1620 |
+
" <tr>\n",
|
| 1621 |
+
" <th>3</th>\n",
|
| 1622 |
+
" <td>J1-IC</td>\n",
|
| 1623 |
+
" <td>Outlets</td>\n",
|
| 1624 |
+
" <td>Catchbasin</td>\n",
|
| 1625 |
+
" <td>None</td>\n",
|
| 1626 |
+
" <td>NO</td>\n",
|
| 1627 |
+
" <td>10.0</td>\n",
|
| 1628 |
+
" <td>0.5</td>\n",
|
| 1629 |
+
" <td>J1-S</td>\n",
|
| 1630 |
+
" <td>0.0</td>\n",
|
| 1631 |
+
" <td>System.Collections.Generic.List`1[PCSWMM.Scrip...</td>\n",
|
| 1632 |
+
" <td>J1</td>\n",
|
| 1633 |
+
" <td>TABULAR/DEPTH</td>\n",
|
| 1634 |
+
" <td></td>\n",
|
| 1635 |
+
" <td>Outlets</td>\n",
|
| 1636 |
+
" </tr>\n",
|
| 1637 |
+
" <tr>\n",
|
| 1638 |
+
" <th>4</th>\n",
|
| 1639 |
+
" <td>J9-IC</td>\n",
|
| 1640 |
+
" <td>Outlets</td>\n",
|
| 1641 |
+
" <td>Catchbasin</td>\n",
|
| 1642 |
+
" <td>None</td>\n",
|
| 1643 |
+
" <td>NO</td>\n",
|
| 1644 |
+
" <td>10.0</td>\n",
|
| 1645 |
+
" <td>0.5</td>\n",
|
| 1646 |
+
" <td>J9-S</td>\n",
|
| 1647 |
+
" <td>0.0</td>\n",
|
| 1648 |
+
" <td>System.Collections.Generic.List`1[PCSWMM.Scrip...</td>\n",
|
| 1649 |
+
" <td>J9</td>\n",
|
| 1650 |
+
" <td>TABULAR/DEPTH</td>\n",
|
| 1651 |
+
" <td></td>\n",
|
| 1652 |
+
" <td>Outlets</td>\n",
|
| 1653 |
+
" </tr>\n",
|
| 1654 |
+
" <tr>\n",
|
| 1655 |
+
" <th>5</th>\n",
|
| 1656 |
+
" <td>J4-IC</td>\n",
|
| 1657 |
+
" <td>Outlets</td>\n",
|
| 1658 |
+
" <td>Catchbasin</td>\n",
|
| 1659 |
+
" <td>None</td>\n",
|
| 1660 |
+
" <td>NO</td>\n",
|
| 1661 |
+
" <td>10.0</td>\n",
|
| 1662 |
+
" <td>0.5</td>\n",
|
| 1663 |
+
" <td>J4-S</td>\n",
|
| 1664 |
+
" <td>0.0</td>\n",
|
| 1665 |
+
" <td>System.Collections.Generic.List`1[PCSWMM.Scrip...</td>\n",
|
| 1666 |
+
" <td>J4</td>\n",
|
| 1667 |
+
" <td>TABULAR/DEPTH</td>\n",
|
| 1668 |
+
" <td></td>\n",
|
| 1669 |
+
" <td>Outlets</td>\n",
|
| 1670 |
+
" </tr>\n",
|
| 1671 |
+
" <tr>\n",
|
| 1672 |
+
" <th>6</th>\n",
|
| 1673 |
+
" <td>J7-IC</td>\n",
|
| 1674 |
+
" <td>Outlets</td>\n",
|
| 1675 |
+
" <td>Catchbasin</td>\n",
|
| 1676 |
+
" <td>None</td>\n",
|
| 1677 |
+
" <td>NO</td>\n",
|
| 1678 |
+
" <td>10.0</td>\n",
|
| 1679 |
+
" <td>0.5</td>\n",
|
| 1680 |
+
" <td>J7-S</td>\n",
|
| 1681 |
+
" <td>0.0</td>\n",
|
| 1682 |
+
" <td>System.Collections.Generic.List`1[PCSWMM.Scrip...</td>\n",
|
| 1683 |
+
" <td>J7</td>\n",
|
| 1684 |
+
" <td>TABULAR/DEPTH</td>\n",
|
| 1685 |
+
" <td></td>\n",
|
| 1686 |
+
" <td>Outlets</td>\n",
|
| 1687 |
+
" </tr>\n",
|
| 1688 |
+
" <tr>\n",
|
| 1689 |
+
" <th>7</th>\n",
|
| 1690 |
+
" <td>J5-IC</td>\n",
|
| 1691 |
+
" <td>Outlets</td>\n",
|
| 1692 |
+
" <td>Catchbasin</td>\n",
|
| 1693 |
+
" <td>None</td>\n",
|
| 1694 |
+
" <td>NO</td>\n",
|
| 1695 |
+
" <td>10.0</td>\n",
|
| 1696 |
+
" <td>0.5</td>\n",
|
| 1697 |
+
" <td>J5-S</td>\n",
|
| 1698 |
+
" <td>0.0</td>\n",
|
| 1699 |
+
" <td>System.Collections.Generic.List`1[PCSWMM.Scrip...</td>\n",
|
| 1700 |
+
" <td>J5</td>\n",
|
| 1701 |
+
" <td>TABULAR/DEPTH</td>\n",
|
| 1702 |
+
" <td></td>\n",
|
| 1703 |
+
" <td>Outlets</td>\n",
|
| 1704 |
+
" </tr>\n",
|
| 1705 |
+
" <tr>\n",
|
| 1706 |
+
" <th>8</th>\n",
|
| 1707 |
+
" <td>J6-IC</td>\n",
|
| 1708 |
+
" <td>Outlets</td>\n",
|
| 1709 |
+
" <td>Catchbasin</td>\n",
|
| 1710 |
+
" <td>None</td>\n",
|
| 1711 |
+
" <td>NO</td>\n",
|
| 1712 |
+
" <td>10.0</td>\n",
|
| 1713 |
+
" <td>0.5</td>\n",
|
| 1714 |
+
" <td>J6-S</td>\n",
|
| 1715 |
+
" <td>0.0</td>\n",
|
| 1716 |
+
" <td>System.Collections.Generic.List`1[PCSWMM.Scrip...</td>\n",
|
| 1717 |
+
" <td>J6</td>\n",
|
| 1718 |
+
" <td>TABULAR/DEPTH</td>\n",
|
| 1719 |
+
" <td></td>\n",
|
| 1720 |
+
" <td>Outlets</td>\n",
|
| 1721 |
+
" </tr>\n",
|
| 1722 |
+
" <tr>\n",
|
| 1723 |
+
" <th>9</th>\n",
|
| 1724 |
+
" <td>PondOutlet</td>\n",
|
| 1725 |
+
" <td>Outlets</td>\n",
|
| 1726 |
+
" <td>PondOutlet</td>\n",
|
| 1727 |
+
" <td>None</td>\n",
|
| 1728 |
+
" <td>NO</td>\n",
|
| 1729 |
+
" <td>10.0</td>\n",
|
| 1730 |
+
" <td>0.5</td>\n",
|
| 1731 |
+
" <td>Pond</td>\n",
|
| 1732 |
+
" <td>0.0</td>\n",
|
| 1733 |
+
" <td>System.Collections.Generic.List`1[PCSWMM.Scrip...</td>\n",
|
| 1734 |
+
" <td>Outfall</td>\n",
|
| 1735 |
+
" <td>TABULAR/DEPTH</td>\n",
|
| 1736 |
+
" <td></td>\n",
|
| 1737 |
+
" <td>Outlets</td>\n",
|
| 1738 |
+
" </tr>\n",
|
| 1739 |
+
" </tbody>\n",
|
| 1740 |
+
"</table>\n",
|
| 1741 |
+
"</div>"
|
| 1742 |
+
],
|
| 1743 |
+
"text/plain": [
|
| 1744 |
+
" Name ObjectType Curve Description FlapGate FunctionCoeff \\\n",
|
| 1745 |
+
"0 J2-IC Outlets Catchbasin None NO 10.0 \n",
|
| 1746 |
+
"1 J8-IC Outlets Catchbasin None NO 10.0 \n",
|
| 1747 |
+
"2 J3-IC Outlets Catchbasin None NO 10.0 \n",
|
| 1748 |
+
"3 J1-IC Outlets Catchbasin None NO 10.0 \n",
|
| 1749 |
+
"4 J9-IC Outlets Catchbasin None NO 10.0 \n",
|
| 1750 |
+
"5 J4-IC Outlets Catchbasin None NO 10.0 \n",
|
| 1751 |
+
"6 J7-IC Outlets Catchbasin None NO 10.0 \n",
|
| 1752 |
+
"7 J5-IC Outlets Catchbasin None NO 10.0 \n",
|
| 1753 |
+
"8 J6-IC Outlets Catchbasin None NO 10.0 \n",
|
| 1754 |
+
"9 PondOutlet Outlets PondOutlet None NO 10.0 \n",
|
| 1755 |
+
"\n",
|
| 1756 |
+
" FunctionExp InletNode InletOffset \\\n",
|
| 1757 |
+
"0 0.5 J2-S 0.0 \n",
|
| 1758 |
+
"1 0.5 J8-S 0.0 \n",
|
| 1759 |
+
"2 0.5 J3-S 0.0 \n",
|
| 1760 |
+
"3 0.5 J1-S 0.0 \n",
|
| 1761 |
+
"4 0.5 J9-S 0.0 \n",
|
| 1762 |
+
"5 0.5 J4-S 0.0 \n",
|
| 1763 |
+
"6 0.5 J7-S 0.0 \n",
|
| 1764 |
+
"7 0.5 J5-S 0.0 \n",
|
| 1765 |
+
"8 0.5 J6-S 0.0 \n",
|
| 1766 |
+
"9 0.5 Pond 0.0 \n",
|
| 1767 |
+
"\n",
|
| 1768 |
+
" Notes OutletNode \\\n",
|
| 1769 |
+
"0 System.Collections.Generic.List`1[PCSWMM.Scrip... J2 \n",
|
| 1770 |
+
"1 System.Collections.Generic.List`1[PCSWMM.Scrip... J8 \n",
|
| 1771 |
+
"2 System.Collections.Generic.List`1[PCSWMM.Scrip... J3 \n",
|
| 1772 |
+
"3 System.Collections.Generic.List`1[PCSWMM.Scrip... J1 \n",
|
| 1773 |
+
"4 System.Collections.Generic.List`1[PCSWMM.Scrip... J9 \n",
|
| 1774 |
+
"5 System.Collections.Generic.List`1[PCSWMM.Scrip... J4 \n",
|
| 1775 |
+
"6 System.Collections.Generic.List`1[PCSWMM.Scrip... J7 \n",
|
| 1776 |
+
"7 System.Collections.Generic.List`1[PCSWMM.Scrip... J5 \n",
|
| 1777 |
+
"8 System.Collections.Generic.List`1[PCSWMM.Scrip... J6 \n",
|
| 1778 |
+
"9 System.Collections.Generic.List`1[PCSWMM.Scrip... Outfall \n",
|
| 1779 |
+
"\n",
|
| 1780 |
+
" RatingCurveType Tag StructureCollection \n",
|
| 1781 |
+
"0 TABULAR/DEPTH Outlets \n",
|
| 1782 |
+
"1 TABULAR/DEPTH Outlets \n",
|
| 1783 |
+
"2 TABULAR/DEPTH Outlets \n",
|
| 1784 |
+
"3 TABULAR/DEPTH Outlets \n",
|
| 1785 |
+
"4 TABULAR/DEPTH Outlets \n",
|
| 1786 |
+
"5 TABULAR/DEPTH Outlets \n",
|
| 1787 |
+
"6 TABULAR/DEPTH Outlets \n",
|
| 1788 |
+
"7 TABULAR/DEPTH Outlets \n",
|
| 1789 |
+
"8 TABULAR/DEPTH Outlets \n",
|
| 1790 |
+
"9 TABULAR/DEPTH Outlets "
|
| 1791 |
+
]
|
| 1792 |
+
},
|
| 1793 |
+
"metadata": {},
|
| 1794 |
+
"output_type": "display_data"
|
| 1795 |
+
},
|
| 1796 |
+
{
|
| 1797 |
+
"data": {
|
| 1798 |
+
"text/markdown": [
|
| 1799 |
+
"### Findings"
|
| 1800 |
+
],
|
| 1801 |
+
"text/plain": [
|
| 1802 |
+
"<IPython.core.display.Markdown object>"
|
| 1803 |
+
]
|
| 1804 |
+
},
|
| 1805 |
+
"metadata": {},
|
| 1806 |
+
"output_type": "display_data"
|
| 1807 |
+
},
|
| 1808 |
+
{
|
| 1809 |
+
"data": {
|
| 1810 |
+
"text/html": [
|
| 1811 |
+
"<div>\n",
|
| 1812 |
+
"<style scoped>\n",
|
| 1813 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 1814 |
+
" vertical-align: middle;\n",
|
| 1815 |
+
" }\n",
|
| 1816 |
+
"\n",
|
| 1817 |
+
" .dataframe tbody tr th {\n",
|
| 1818 |
+
" vertical-align: top;\n",
|
| 1819 |
+
" }\n",
|
| 1820 |
+
"\n",
|
| 1821 |
+
" .dataframe thead th {\n",
|
| 1822 |
+
" text-align: right;\n",
|
| 1823 |
+
" }\n",
|
| 1824 |
+
"</style>\n",
|
| 1825 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 1826 |
+
" <thead>\n",
|
| 1827 |
+
" <tr style=\"text-align: right;\">\n",
|
| 1828 |
+
" <th></th>\n",
|
| 1829 |
+
" </tr>\n",
|
| 1830 |
+
" </thead>\n",
|
| 1831 |
+
" <tbody>\n",
|
| 1832 |
+
" </tbody>\n",
|
| 1833 |
+
"</table>\n",
|
| 1834 |
+
"</div>"
|
| 1835 |
+
],
|
| 1836 |
+
"text/plain": [
|
| 1837 |
+
"Empty DataFrame\n",
|
| 1838 |
+
"Columns: []\n",
|
| 1839 |
+
"Index: []"
|
| 1840 |
+
]
|
| 1841 |
+
},
|
| 1842 |
+
"metadata": {},
|
| 1843 |
+
"output_type": "display_data"
|
| 1844 |
+
}
|
| 1845 |
+
],
|
| 1846 |
+
"source": [
|
| 1847 |
+
"if capabilities[\"has_storage\"] or capabilities[\"has_outlet_structures\"]:\n",
|
| 1848 |
+
" display(Markdown(\"### Storage summary\"))\n",
|
| 1849 |
+
" display(pd.DataFrame(\n",
|
| 1850 |
+
" list(client.storage.summary().items()),\n",
|
| 1851 |
+
" columns=[\"Metric\", \"Value\"],\n",
|
| 1852 |
+
" ))\n",
|
| 1853 |
+
"\n",
|
| 1854 |
+
" display(Markdown(\"### Storage records\"))\n",
|
| 1855 |
+
" display(pd.DataFrame(client.storage.storage_records()))\n",
|
| 1856 |
+
"\n",
|
| 1857 |
+
" display(Markdown(\"### Outlet structures\"))\n",
|
| 1858 |
+
" display(pd.DataFrame(client.storage.outlet_structure_records()))\n",
|
| 1859 |
+
"\n",
|
| 1860 |
+
" display(Markdown(\"### Findings\"))\n",
|
| 1861 |
+
" display(pd.DataFrame(client.storage.review()))\n",
|
| 1862 |
+
"else:\n",
|
| 1863 |
+
" print(\"Storage/outlet review is not applicable to this model.\")"
|
| 1864 |
+
]
|
| 1865 |
+
},
|
| 1866 |
+
{
|
| 1867 |
+
"cell_type": "markdown",
|
| 1868 |
+
"id": "75c80e2f",
|
| 1869 |
+
"metadata": {},
|
| 1870 |
+
"source": [
|
| 1871 |
+
"## 6. Scenario path review"
|
| 1872 |
+
]
|
| 1873 |
+
},
|
| 1874 |
+
{
|
| 1875 |
+
"cell_type": "code",
|
| 1876 |
+
"execution_count": 6,
|
| 1877 |
+
"id": "46e32ca4",
|
| 1878 |
+
"metadata": {
|
| 1879 |
+
"tags": []
|
| 1880 |
+
},
|
| 1881 |
+
"outputs": [
|
| 1882 |
+
{
|
| 1883 |
+
"data": {
|
| 1884 |
+
"text/html": [
|
| 1885 |
+
"<div>\n",
|
| 1886 |
+
"<style scoped>\n",
|
| 1887 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 1888 |
+
" vertical-align: middle;\n",
|
| 1889 |
+
" }\n",
|
| 1890 |
+
"\n",
|
| 1891 |
+
" .dataframe tbody tr th {\n",
|
| 1892 |
+
" vertical-align: top;\n",
|
| 1893 |
+
" }\n",
|
| 1894 |
+
"\n",
|
| 1895 |
+
" .dataframe thead th {\n",
|
| 1896 |
+
" text-align: right;\n",
|
| 1897 |
+
" }\n",
|
| 1898 |
+
"</style>\n",
|
| 1899 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 1900 |
+
" <thead>\n",
|
| 1901 |
+
" <tr style=\"text-align: right;\">\n",
|
| 1902 |
+
" <th></th>\n",
|
| 1903 |
+
" <th>Metric</th>\n",
|
| 1904 |
+
" <th>Value</th>\n",
|
| 1905 |
+
" </tr>\n",
|
| 1906 |
+
" </thead>\n",
|
| 1907 |
+
" <tbody>\n",
|
| 1908 |
+
" <tr>\n",
|
| 1909 |
+
" <th>0</th>\n",
|
| 1910 |
+
" <td>scenario_count</td>\n",
|
| 1911 |
+
" <td>2</td>\n",
|
| 1912 |
+
" </tr>\n",
|
| 1913 |
+
" <tr>\n",
|
| 1914 |
+
" <th>1</th>\n",
|
| 1915 |
+
" <td>existing_path_count</td>\n",
|
| 1916 |
+
" <td>1</td>\n",
|
| 1917 |
+
" </tr>\n",
|
| 1918 |
+
" <tr>\n",
|
| 1919 |
+
" <th>2</th>\n",
|
| 1920 |
+
" <td>missing_path_count</td>\n",
|
| 1921 |
+
" <td>1</td>\n",
|
| 1922 |
+
" </tr>\n",
|
| 1923 |
+
" </tbody>\n",
|
| 1924 |
+
"</table>\n",
|
| 1925 |
+
"</div>"
|
| 1926 |
+
],
|
| 1927 |
+
"text/plain": [
|
| 1928 |
+
" Metric Value\n",
|
| 1929 |
+
"0 scenario_count 2\n",
|
| 1930 |
+
"1 existing_path_count 1\n",
|
| 1931 |
+
"2 missing_path_count 1"
|
| 1932 |
+
]
|
| 1933 |
+
},
|
| 1934 |
+
"metadata": {},
|
| 1935 |
+
"output_type": "display_data"
|
| 1936 |
+
},
|
| 1937 |
+
{
|
| 1938 |
+
"data": {
|
| 1939 |
+
"text/html": [
|
| 1940 |
+
"<div>\n",
|
| 1941 |
+
"<style scoped>\n",
|
| 1942 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 1943 |
+
" vertical-align: middle;\n",
|
| 1944 |
+
" }\n",
|
| 1945 |
+
"\n",
|
| 1946 |
+
" .dataframe tbody tr th {\n",
|
| 1947 |
+
" vertical-align: top;\n",
|
| 1948 |
+
" }\n",
|
| 1949 |
+
"\n",
|
| 1950 |
+
" .dataframe thead th {\n",
|
| 1951 |
+
" text-align: right;\n",
|
| 1952 |
+
" }\n",
|
| 1953 |
+
"</style>\n",
|
| 1954 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 1955 |
+
" <thead>\n",
|
| 1956 |
+
" <tr style=\"text-align: right;\">\n",
|
| 1957 |
+
" <th></th>\n",
|
| 1958 |
+
" <th>scenario_path</th>\n",
|
| 1959 |
+
" <th>exists</th>\n",
|
| 1960 |
+
" <th>suffix</th>\n",
|
| 1961 |
+
" <th>file_name</th>\n",
|
| 1962 |
+
" <th>parent</th>\n",
|
| 1963 |
+
" </tr>\n",
|
| 1964 |
+
" </thead>\n",
|
| 1965 |
+
" <tbody>\n",
|
| 1966 |
+
" <tr>\n",
|
| 1967 |
+
" <th>0</th>\n",
|
| 1968 |
+
" <td>D:\\Documents\\EPA SWMM Projects\\Valleyfield to-...</td>\n",
|
| 1969 |
+
" <td>True</td>\n",
|
| 1970 |
+
" <td>.inp</td>\n",
|
| 1971 |
+
" <td>Valleyfield to-be dual system.inp</td>\n",
|
| 1972 |
+
" <td>D:\\Documents\\EPA SWMM Projects</td>\n",
|
| 1973 |
+
" </tr>\n",
|
| 1974 |
+
" <tr>\n",
|
| 1975 |
+
" <th>1</th>\n",
|
| 1976 |
+
" <td>C:\\Users\\Raza Ali\\Documents\\EPA SWMM Projects\\...</td>\n",
|
| 1977 |
+
" <td>False</td>\n",
|
| 1978 |
+
" <td>.inp</td>\n",
|
| 1979 |
+
" <td>Valleyfield to-be dual system.inp</td>\n",
|
| 1980 |
+
" <td>C:\\Users\\Raza Ali\\Documents\\EPA SWMM Projects</td>\n",
|
| 1981 |
+
" </tr>\n",
|
| 1982 |
+
" </tbody>\n",
|
| 1983 |
+
"</table>\n",
|
| 1984 |
+
"</div>"
|
| 1985 |
+
],
|
| 1986 |
+
"text/plain": [
|
| 1987 |
+
" scenario_path exists suffix \\\n",
|
| 1988 |
+
"0 D:\\Documents\\EPA SWMM Projects\\Valleyfield to-... True .inp \n",
|
| 1989 |
+
"1 C:\\Users\\Raza Ali\\Documents\\EPA SWMM Projects\\... False .inp \n",
|
| 1990 |
+
"\n",
|
| 1991 |
+
" file_name \\\n",
|
| 1992 |
+
"0 Valleyfield to-be dual system.inp \n",
|
| 1993 |
+
"1 Valleyfield to-be dual system.inp \n",
|
| 1994 |
+
"\n",
|
| 1995 |
+
" parent \n",
|
| 1996 |
+
"0 D:\\Documents\\EPA SWMM Projects \n",
|
| 1997 |
+
"1 C:\\Users\\Raza Ali\\Documents\\EPA SWMM Projects "
|
| 1998 |
+
]
|
| 1999 |
+
},
|
| 2000 |
+
"metadata": {},
|
| 2001 |
+
"output_type": "display_data"
|
| 2002 |
+
}
|
| 2003 |
+
],
|
| 2004 |
+
"source": [
|
| 2005 |
+
"display(pd.DataFrame(\n",
|
| 2006 |
+
" list(client.scenarios.summary().items()),\n",
|
| 2007 |
+
" columns=[\"Metric\", \"Value\"],\n",
|
| 2008 |
+
"))\n",
|
| 2009 |
+
"display(pd.DataFrame(client.scenarios.path_status()))"
|
| 2010 |
+
]
|
| 2011 |
+
},
|
| 2012 |
+
{
|
| 2013 |
+
"cell_type": "markdown",
|
| 2014 |
+
"id": "39006904",
|
| 2015 |
+
"metadata": {},
|
| 2016 |
+
"source": [
|
| 2017 |
+
"## 7. Run generic review engine"
|
| 2018 |
+
]
|
| 2019 |
+
},
|
| 2020 |
+
{
|
| 2021 |
+
"cell_type": "code",
|
| 2022 |
+
"execution_count": 7,
|
| 2023 |
+
"id": "a1a3fc12",
|
| 2024 |
+
"metadata": {
|
| 2025 |
+
"tags": []
|
| 2026 |
+
},
|
| 2027 |
+
"outputs": [
|
| 2028 |
+
{
|
| 2029 |
+
"name": "stdout",
|
| 2030 |
+
"output_type": "stream",
|
| 2031 |
+
"text": [
|
| 2032 |
+
"Model archetype: collection_system_with_storage\n",
|
| 2033 |
+
"Applicable modules: ['project', 'inventory', 'topology', 'scenario_paths', 'hydrology', 'hydraulics', 'storage', 'outlet_structures']\n",
|
| 2034 |
+
"Report sections: ['generated_at', 'classification', 'project', 'capabilities', 'applicable_modules', 'inventory', 'topology', 'general_engineering', 'scenario_paths', 'hydrology', 'storage_and_outlets']\n"
|
| 2035 |
+
]
|
| 2036 |
+
}
|
| 2037 |
+
],
|
| 2038 |
+
"source": [
|
| 2039 |
+
"review = client.review_engine.run()\n",
|
| 2040 |
+
"\n",
|
| 2041 |
+
"print(\"Model archetype:\", review[\"capabilities\"][\"model_archetype\"])\n",
|
| 2042 |
+
"print(\"Applicable modules:\", review[\"applicable_modules\"])\n",
|
| 2043 |
+
"print(\"Report sections:\", list(review.keys()))"
|
| 2044 |
+
]
|
| 2045 |
+
},
|
| 2046 |
+
{
|
| 2047 |
+
"cell_type": "markdown",
|
| 2048 |
+
"id": "71ba8a3b",
|
| 2049 |
+
"metadata": {},
|
| 2050 |
+
"source": [
|
| 2051 |
+
"## 8. Optional hydraulic result examples"
|
| 2052 |
+
]
|
| 2053 |
+
},
|
| 2054 |
+
{
|
| 2055 |
+
"cell_type": "code",
|
| 2056 |
+
"execution_count": 8,
|
| 2057 |
+
"id": "163f0b89",
|
| 2058 |
+
"metadata": {
|
| 2059 |
+
"tags": []
|
| 2060 |
+
},
|
| 2061 |
+
"outputs": [],
|
| 2062 |
+
"source": [
|
| 2063 |
+
"# Confirm PCSWMM result labels and units before uncommenting.\n",
|
| 2064 |
+
"\n",
|
| 2065 |
+
"# Generic link peak:\n",
|
| 2066 |
+
"# display(pd.DataFrame(\n",
|
| 2067 |
+
"# client.hydraulics.peak_link_results(\"Flow\", \"CMS\")\n",
|
| 2068 |
+
"# ))\n",
|
| 2069 |
+
"\n",
|
| 2070 |
+
"# Generic node peak:\n",
|
| 2071 |
+
"# display(pd.DataFrame(\n",
|
| 2072 |
+
"# client.hydraulics.peak_node_results(\"Depth\", \"m\")\n",
|
| 2073 |
+
"# ))"
|
| 2074 |
+
]
|
| 2075 |
+
},
|
| 2076 |
+
{
|
| 2077 |
+
"cell_type": "markdown",
|
| 2078 |
+
"id": "1d8a23a8",
|
| 2079 |
+
"metadata": {},
|
| 2080 |
+
"source": [
|
| 2081 |
+
"## Design principle\n",
|
| 2082 |
+
"\n",
|
| 2083 |
+
"The SDK core is model-agnostic.\n",
|
| 2084 |
+
"\n",
|
| 2085 |
+
"- A runoff-only model activates hydrology review.\n",
|
| 2086 |
+
"- A pipe network activates conveyance and topology review.\n",
|
| 2087 |
+
"- A storage model activates storage/outlet review.\n",
|
| 2088 |
+
"- A combined network activates all applicable modules.\n",
|
| 2089 |
+
"- Future water-quality, LID, groundwater, snowmelt, and municipal rule packs\n",
|
| 2090 |
+
" will follow the same capability-based architecture."
|
| 2091 |
+
]
|
| 2092 |
+
},
|
| 2093 |
+
{
|
| 2094 |
+
"cell_type": "code",
|
| 2095 |
+
"execution_count": null,
|
| 2096 |
+
"id": "7a098d53-b24a-4d39-bb4d-35dbc6e3c796",
|
| 2097 |
+
"metadata": {},
|
| 2098 |
+
"outputs": [],
|
| 2099 |
+
"source": []
|
| 2100 |
+
}
|
| 2101 |
+
],
|
| 2102 |
+
"metadata": {
|
| 2103 |
+
"kernelspec": {
|
| 2104 |
+
"display_name": "Python 3 (ipykernel)",
|
| 2105 |
+
"language": "python",
|
| 2106 |
+
"name": "python3"
|
| 2107 |
+
},
|
| 2108 |
+
"language_info": {
|
| 2109 |
+
"codemirror_mode": {
|
| 2110 |
+
"name": "ipython",
|
| 2111 |
+
"version": 3
|
| 2112 |
+
},
|
| 2113 |
+
"file_extension": ".py",
|
| 2114 |
+
"mimetype": "text/x-python",
|
| 2115 |
+
"name": "python",
|
| 2116 |
+
"nbconvert_exporter": "python",
|
| 2117 |
+
"pygments_lexer": "ipython3",
|
| 2118 |
+
"version": "3.10.10"
|
| 2119 |
+
}
|
| 2120 |
+
},
|
| 2121 |
+
"nbformat": 4,
|
| 2122 |
+
"nbformat_minor": 5
|
| 2123 |
+
}
|
examples/PCSWMM_connection_test.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""PCSWMM Script Editor connection test.
|
| 2 |
+
|
| 3 |
+
PCSWMM injects pcpy. Do not import pcpy.
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
def safe_count(collection):
|
| 7 |
+
try:
|
| 8 |
+
return len(collection)
|
| 9 |
+
except Exception:
|
| 10 |
+
try:
|
| 11 |
+
return int(collection.Count)
|
| 12 |
+
except Exception:
|
| 13 |
+
return None
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
try:
|
| 17 |
+
swmm = pcpy.SWMM
|
| 18 |
+
|
| 19 |
+
information = {
|
| 20 |
+
"project_open": True,
|
| 21 |
+
"project_name": str(swmm.ProjectName),
|
| 22 |
+
"project_folder": str(swmm.ProjectFolder),
|
| 23 |
+
"model_file": str(swmm.FilePath),
|
| 24 |
+
"swmm_version": str(swmm.Version),
|
| 25 |
+
"scenario_count": safe_count(swmm.Scenarios),
|
| 26 |
+
"node_count": safe_count(swmm.Nodes),
|
| 27 |
+
"link_count": safe_count(swmm.Links),
|
| 28 |
+
"subcatchment_count": safe_count(swmm.Subcatchments),
|
| 29 |
+
"storage_count": safe_count(swmm.Storages),
|
| 30 |
+
"outfall_count": safe_count(swmm.Outfalls),
|
| 31 |
+
}
|
| 32 |
+
except Exception as exc:
|
| 33 |
+
information = {
|
| 34 |
+
"project_open": False,
|
| 35 |
+
"error": str(exc),
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
print("=" * 60)
|
| 39 |
+
print("PCSWMM CONNECTION TEST")
|
| 40 |
+
print("=" * 60)
|
| 41 |
+
|
| 42 |
+
for key, value in information.items():
|
| 43 |
+
print("{:<25} {}".format(key, value))
|
| 44 |
+
|
| 45 |
+
print("\nCONNECTION STATUS:", "SUCCESS" if information["project_open"] else "FAILED")
|