swmmanywhere 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. swmmanywhere-0.1.0/.gitignore +139 -0
  2. swmmanywhere-0.1.0/LICENSE +29 -0
  3. swmmanywhere-0.1.0/PKG-INFO +125 -0
  4. swmmanywhere-0.1.0/README.md +58 -0
  5. swmmanywhere-0.1.0/netcomp/LICENSE.txt +21 -0
  6. swmmanywhere-0.1.0/netcomp/README.md +5 -0
  7. swmmanywhere-0.1.0/netcomp/__init__.py +25 -0
  8. swmmanywhere-0.1.0/netcomp/distance/__init__.py +10 -0
  9. swmmanywhere-0.1.0/netcomp/distance/exact.py +329 -0
  10. swmmanywhere-0.1.0/netcomp/distance/features.py +141 -0
  11. swmmanywhere-0.1.0/netcomp/exception.py +19 -0
  12. swmmanywhere-0.1.0/netcomp/linalg/__init__.py +14 -0
  13. swmmanywhere-0.1.0/netcomp/linalg/eigenstuff.py +133 -0
  14. swmmanywhere-0.1.0/netcomp/linalg/fast_bp.py +57 -0
  15. swmmanywhere-0.1.0/netcomp/linalg/matrices.py +94 -0
  16. swmmanywhere-0.1.0/netcomp/linalg/resistance.py +260 -0
  17. swmmanywhere-0.1.0/pyproject.toml +135 -0
  18. swmmanywhere-0.1.0/swmmanywhere/__init__.py +12 -0
  19. swmmanywhere-0.1.0/swmmanywhere/__main__.py +50 -0
  20. swmmanywhere-0.1.0/swmmanywhere/defs/basic_drainage_all_bits.inp +173 -0
  21. swmmanywhere-0.1.0/swmmanywhere/defs/demo_config.yml +61 -0
  22. swmmanywhere-0.1.0/swmmanywhere/defs/iso_converter.yml +247 -0
  23. swmmanywhere-0.1.0/swmmanywhere/defs/schema.yml +35 -0
  24. swmmanywhere-0.1.0/swmmanywhere/defs/storm.dat +5 -0
  25. swmmanywhere-0.1.0/swmmanywhere/defs/swmm_conversion.yml +54 -0
  26. swmmanywhere-0.1.0/swmmanywhere/examples/data.py +8 -0
  27. swmmanywhere-0.1.0/swmmanywhere/examples/demo_graph.json +1 -0
  28. swmmanywhere-0.1.0/swmmanywhere/filepaths.py +371 -0
  29. swmmanywhere-0.1.0/swmmanywhere/geospatial_utilities.py +1004 -0
  30. swmmanywhere-0.1.0/swmmanywhere/graph_utilities.py +284 -0
  31. swmmanywhere-0.1.0/swmmanywhere/graphfcns/__init__.py +11 -0
  32. swmmanywhere-0.1.0/swmmanywhere/graphfcns/design_graphfcns.py +241 -0
  33. swmmanywhere-0.1.0/swmmanywhere/graphfcns/network_cleaning_graphfcns.py +467 -0
  34. swmmanywhere-0.1.0/swmmanywhere/graphfcns/outfall_graphfcns.py +303 -0
  35. swmmanywhere-0.1.0/swmmanywhere/graphfcns/subcatchment_graphfcns.py +272 -0
  36. swmmanywhere-0.1.0/swmmanywhere/graphfcns/topology_graphfcns.py +327 -0
  37. swmmanywhere-0.1.0/swmmanywhere/logging.py +80 -0
  38. swmmanywhere-0.1.0/swmmanywhere/metric_utilities.py +1109 -0
  39. swmmanywhere-0.1.0/swmmanywhere/misc/debug_derive_rc.py +86 -0
  40. swmmanywhere-0.1.0/swmmanywhere/misc/debug_metrics.py +120 -0
  41. swmmanywhere-0.1.0/swmmanywhere/misc/debug_topology.py +63 -0
  42. swmmanywhere-0.1.0/swmmanywhere/parameters.py +284 -0
  43. swmmanywhere-0.1.0/swmmanywhere/post_processing.py +447 -0
  44. swmmanywhere-0.1.0/swmmanywhere/prepare_data.py +235 -0
  45. swmmanywhere-0.1.0/swmmanywhere/preprocessing.py +216 -0
  46. swmmanywhere-0.1.0/swmmanywhere/shortest_path_utils.py +172 -0
  47. swmmanywhere-0.1.0/swmmanywhere/swmmanywhere.py +524 -0
  48. swmmanywhere-0.1.0/swmmanywhere/utilities.py +50 -0
@@ -0,0 +1,139 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+
123
+ # mypy
124
+ .mypy_cache/
125
+ .dmypy.json
126
+ dmypy.json
127
+
128
+ # Pyre type checker
129
+ .pyre/
130
+
131
+ # Pysheds cache
132
+ cache/
133
+
134
+ # Documentation generated models
135
+ swmmanywhere_models/
136
+ whiteboxtools_binaries.zip
137
+
138
+ # Hatch
139
+ _version.py
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2022, barneydobson
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,125 @@
1
+ Metadata-Version: 2.3
2
+ Name: swmmanywhere
3
+ Version: 0.1.0
4
+ Summary: SWMManywhere software
5
+ Project-URL: Documentation, https://imperialcollegelondon.github.io/SWMManywhere/
6
+ Project-URL: Issues, https://github.com/ImperialCollegeLondon/SWMManywhere/issues
7
+ Project-URL: Source, https://github.com/ImperialCollegeLondon/SWMManywhere
8
+ Author-email: Barnaby Dobson <b.dobson@imperial.ac.uk>, Imperial College London RSE Team <ict-rse-team@imperial.ac.uk>
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Scientific/Engineering
20
+ Classifier: Topic :: Scientific/Engineering :: GIS
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: cdsapi
24
+ Requires-Dist: cytoolz
25
+ Requires-Dist: geopandas>=1
26
+ Requires-Dist: geopy
27
+ Requires-Dist: joblib
28
+ Requires-Dist: jsonschema
29
+ Requires-Dist: loguru
30
+ Requires-Dist: netcdf4
31
+ Requires-Dist: networkx>=3
32
+ Requires-Dist: numpy>=2
33
+ Requires-Dist: osmnx>=1.9.3
34
+ Requires-Dist: pandas
35
+ Requires-Dist: planetary-computer
36
+ Requires-Dist: pyarrow
37
+ Requires-Dist: pydantic
38
+ Requires-Dist: pyflwdir
39
+ Requires-Dist: pystac-client
40
+ Requires-Dist: pyswmm
41
+ Requires-Dist: pywbt>=0.2.2
42
+ Requires-Dist: pyyaml
43
+ Requires-Dist: rasterio
44
+ Requires-Dist: rioxarray
45
+ Requires-Dist: scipy
46
+ Requires-Dist: shapely
47
+ Requires-Dist: tqdm
48
+ Requires-Dist: xarray
49
+ Provides-Extra: dev
50
+ Requires-Dist: mypy; extra == 'dev'
51
+ Requires-Dist: pip-tools; extra == 'dev'
52
+ Requires-Dist: pre-commit; extra == 'dev'
53
+ Requires-Dist: pytest; extra == 'dev'
54
+ Requires-Dist: pytest-cov; extra == 'dev'
55
+ Requires-Dist: pytest-mock; extra == 'dev'
56
+ Requires-Dist: pytest-mypy; extra == 'dev'
57
+ Requires-Dist: ruff; extra == 'dev'
58
+ Provides-Extra: doc
59
+ Requires-Dist: mkdocs; extra == 'doc'
60
+ Requires-Dist: mkdocs-coverage; extra == 'doc'
61
+ Requires-Dist: mkdocs-include-markdown-plugin; extra == 'doc'
62
+ Requires-Dist: mkdocs-jupyter; extra == 'doc'
63
+ Requires-Dist: mkdocs-material; extra == 'doc'
64
+ Requires-Dist: mkdocs-material-extensions; extra == 'doc'
65
+ Requires-Dist: mkdocstrings[python]; extra == 'doc'
66
+ Description-Content-Type: text/markdown
67
+
68
+ # SWMManywhere: Synthesise Urban Drainage Network Models Anywhere in the World
69
+
70
+ <!-- markdown-link-check-disable -->
71
+ [![Test and build](https://github.com/ImperialCollegeLondon/SWMManywhere/actions/workflows/ci.yml/badge.svg)](https://github.com/ImperialCollegeLondon/SWMManywhere/actions/workflows/ci.yml)
72
+ <!-- markdown-link-check-enable -->
73
+
74
+ SWMManywhere is a tool to synthesise urban drainage network models (UDMs) using
75
+ publicly available data such as street network, DEM, and building footprints, across
76
+ the globe. It also provides tools for generating SWMM input files and performing
77
+ simulations for the synthesised UDMs.
78
+
79
+ ## Features
80
+
81
+ - **Automatic data retrieval and preprocessing**: all of our data requirements
82
+ are met with global datasets, so all you need is a bounding box!
83
+ - **Customisable network synthesis**: change a range of parameters to create
84
+ different networks, power users can easily extend existing functionality.
85
+ - **Streamlined evaluation to compare with real networks**: we include a variety
86
+ of performance metrics and automatic running/comparing if you have your own SWMM model.
87
+ - **Command line interface**: All of this and more can be accessed by passing a
88
+ configuration file to a CLI.
89
+
90
+ ## Installation
91
+
92
+ Install SWMManywhere:
93
+
94
+ ```bash
95
+ pip install swmmanywhere
96
+ ```
97
+
98
+ ## Documentation and Quickstart
99
+
100
+ Once installed, you can simply run SWMManywhere from the command line giving a
101
+ configuration file in YAML format as input. As SWMManywhere can download data
102
+ automatically from well known sources, this settings file can often be minimal and
103
+ restricted to indicating the geographical area to be processed:
104
+
105
+ `python -m swmmanywhere --config_path=\path\to\config.yml`
106
+
107
+ The result of the calculation will be a model of the sewage system for that area,
108
+ like the following, which can then be further processed or analysed with SWMM, for
109
+ example:
110
+
111
+ ![SWMM Model](docs/images/andorra_swmm_screenshot.png)
112
+
113
+ <!-- markdown-link-check-disable -->
114
+ Follow the [Quickstart](https://imperialcollegelondon.github.io/swmmanywhere/quickstart)
115
+ for a more detailed initial example and
116
+ [ReadTheDocs](https://imperialcollegelondon.github.io/swmmanywhere/)
117
+ for full information of SWMManywhere capabilities.
118
+ <!-- markdown-link-check-enable -->
119
+
120
+ ## Use and contributing
121
+
122
+ This project is licensed under the BSD-3-Clause licence, see [LICENSE](LICENSE).
123
+
124
+ There are many things we would like to do! If you are interested to contribute
125
+ please see [CONTRIBUTING](docs/CONTRIBUTING.md) and [CODE OF CONDUCT](docs/CODE_OF_CONDUCT.md).
@@ -0,0 +1,58 @@
1
+ # SWMManywhere: Synthesise Urban Drainage Network Models Anywhere in the World
2
+
3
+ <!-- markdown-link-check-disable -->
4
+ [![Test and build](https://github.com/ImperialCollegeLondon/SWMManywhere/actions/workflows/ci.yml/badge.svg)](https://github.com/ImperialCollegeLondon/SWMManywhere/actions/workflows/ci.yml)
5
+ <!-- markdown-link-check-enable -->
6
+
7
+ SWMManywhere is a tool to synthesise urban drainage network models (UDMs) using
8
+ publicly available data such as street network, DEM, and building footprints, across
9
+ the globe. It also provides tools for generating SWMM input files and performing
10
+ simulations for the synthesised UDMs.
11
+
12
+ ## Features
13
+
14
+ - **Automatic data retrieval and preprocessing**: all of our data requirements
15
+ are met with global datasets, so all you need is a bounding box!
16
+ - **Customisable network synthesis**: change a range of parameters to create
17
+ different networks, power users can easily extend existing functionality.
18
+ - **Streamlined evaluation to compare with real networks**: we include a variety
19
+ of performance metrics and automatic running/comparing if you have your own SWMM model.
20
+ - **Command line interface**: All of this and more can be accessed by passing a
21
+ configuration file to a CLI.
22
+
23
+ ## Installation
24
+
25
+ Install SWMManywhere:
26
+
27
+ ```bash
28
+ pip install swmmanywhere
29
+ ```
30
+
31
+ ## Documentation and Quickstart
32
+
33
+ Once installed, you can simply run SWMManywhere from the command line giving a
34
+ configuration file in YAML format as input. As SWMManywhere can download data
35
+ automatically from well known sources, this settings file can often be minimal and
36
+ restricted to indicating the geographical area to be processed:
37
+
38
+ `python -m swmmanywhere --config_path=\path\to\config.yml`
39
+
40
+ The result of the calculation will be a model of the sewage system for that area,
41
+ like the following, which can then be further processed or analysed with SWMM, for
42
+ example:
43
+
44
+ ![SWMM Model](docs/images/andorra_swmm_screenshot.png)
45
+
46
+ <!-- markdown-link-check-disable -->
47
+ Follow the [Quickstart](https://imperialcollegelondon.github.io/swmmanywhere/quickstart)
48
+ for a more detailed initial example and
49
+ [ReadTheDocs](https://imperialcollegelondon.github.io/swmmanywhere/)
50
+ for full information of SWMManywhere capabilities.
51
+ <!-- markdown-link-check-enable -->
52
+
53
+ ## Use and contributing
54
+
55
+ This project is licensed under the BSD-3-Clause licence, see [LICENSE](LICENSE).
56
+
57
+ There are many things we would like to do! If you are interested to contribute
58
+ please see [CONTRIBUTING](docs/CONTRIBUTING.md) and [CODE OF CONDUCT](docs/CODE_OF_CONDUCT.md).
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [year] [fullname]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,5 @@
1
+ # NetComp
2
+
3
+ See [original repo](https://github.com/barneydobson/NetComp) for more details on NetComp.
4
+
5
+ NetComp is distributed under a MIT license
@@ -0,0 +1,25 @@
1
+ """NetComp v0.2.2
2
+ ==============
3
+
4
+ NetComp is a Python package for comparing networks using pairwise distances,
5
+ and for performing anomaly detection on a time series of networks. It is
6
+ built on top of the NetworkX package. For details on usage and installation,
7
+ see README.md.
8
+
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ __author__ = "Peter Wills <peter.e.wills@gmail.com>"
14
+ __version__ = "0.2.2"
15
+ __license__ = "MIT"
16
+
17
+ import sys
18
+
19
+ if sys.version_info[0] < 3:
20
+ m = "Python 3.x required (%d.%d detected)."
21
+ raise ImportError(m % sys.version_info[:2])
22
+ del sys
23
+
24
+ from .linalg import * # noqa
25
+ from .distance import * # noqa
@@ -0,0 +1,10 @@
1
+ """*********
2
+ Distances
3
+ *********
4
+
5
+ Calculation of distances between graphs.
6
+ """
7
+ from __future__ import annotations
8
+
9
+ from .exact import *
10
+ from .features import *