quakecascade 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 (77) hide show
  1. quakecascade-0.1.0/.gitignore +13 -0
  2. quakecascade-0.1.0/CHANGELOG.md +76 -0
  3. quakecascade-0.1.0/CITATION.cff +15 -0
  4. quakecascade-0.1.0/LICENSE +28 -0
  5. quakecascade-0.1.0/NOTICE +79 -0
  6. quakecascade-0.1.0/PKG-INFO +178 -0
  7. quakecascade-0.1.0/README.md +128 -0
  8. quakecascade-0.1.0/docs/api.md +75 -0
  9. quakecascade-0.1.0/docs/changelog.md +76 -0
  10. quakecascade-0.1.0/docs/getting-started.md +94 -0
  11. quakecascade-0.1.0/docs/img/01_damage_and_closures.png +0 -0
  12. quakecascade-0.1.0/docs/img/02_unit_ranking.png +0 -0
  13. quakecascade-0.1.0/docs/img/03_city_bands.png +0 -0
  14. quakecascade-0.1.0/docs/index.md +69 -0
  15. quakecascade-0.1.0/docs/javascripts/katex.js +10 -0
  16. quakecascade-0.1.0/docs/methods/access.md +136 -0
  17. quakecascade-0.1.0/docs/methods/allocate.md +110 -0
  18. quakecascade-0.1.0/docs/methods/contract.md +57 -0
  19. quakecascade-0.1.0/docs/methods/debris.md +176 -0
  20. quakecascade-0.1.0/docs/methods/fragility.md +92 -0
  21. quakecascade-0.1.0/docs/methods/groundmotion.md +203 -0
  22. quakecascade-0.1.0/docs/methods/impact.md +108 -0
  23. quakecascade-0.1.0/docs/methods/lifelines.md +96 -0
  24. quakecascade-0.1.0/docs/methods/liquefaction.md +180 -0
  25. quakecascade-0.1.0/docs/methods/mcda.md +82 -0
  26. quakecascade-0.1.0/docs/methods/montecarlo.md +83 -0
  27. quakecascade-0.1.0/docs/methods/network.md +124 -0
  28. quakecascade-0.1.0/docs/notice/fragility.txt +30 -0
  29. quakecascade-0.1.0/docs/notice/groundmotion.txt +32 -0
  30. quakecascade-0.1.0/docs/notice/liquefaction.txt +32 -0
  31. quakecascade-0.1.0/docs/tutorial.md +246 -0
  32. quakecascade-0.1.0/examples/01_synthetic_town.py +152 -0
  33. quakecascade-0.1.0/examples/02_open_data.py +203 -0
  34. quakecascade-0.1.0/pyproject.toml +86 -0
  35. quakecascade-0.1.0/src/quakecascade/__init__.py +55 -0
  36. quakecascade-0.1.0/src/quakecascade/_compat.py +32 -0
  37. quakecascade-0.1.0/src/quakecascade/access.py +466 -0
  38. quakecascade-0.1.0/src/quakecascade/allocate.py +641 -0
  39. quakecascade-0.1.0/src/quakecascade/cascade.py +936 -0
  40. quakecascade-0.1.0/src/quakecascade/contract.py +352 -0
  41. quakecascade-0.1.0/src/quakecascade/crs.py +113 -0
  42. quakecascade-0.1.0/src/quakecascade/datasets.py +606 -0
  43. quakecascade-0.1.0/src/quakecascade/debris.py +994 -0
  44. quakecascade-0.1.0/src/quakecascade/fragility.py +618 -0
  45. quakecascade-0.1.0/src/quakecascade/groundmotion/__init__.py +62 -0
  46. quakecascade-0.1.0/src/quakecascade/groundmotion/_asb2014_data.py +462 -0
  47. quakecascade-0.1.0/src/quakecascade/groundmotion/asb2014.py +431 -0
  48. quakecascade-0.1.0/src/quakecascade/groundmotion/distance.py +255 -0
  49. quakecascade-0.1.0/src/quakecascade/groundmotion/rupture.py +327 -0
  50. quakecascade-0.1.0/src/quakecascade/groundmotion/scenario.py +206 -0
  51. quakecascade-0.1.0/src/quakecascade/hydro.py +324 -0
  52. quakecascade-0.1.0/src/quakecascade/impact.py +1198 -0
  53. quakecascade-0.1.0/src/quakecascade/lifelines.py +243 -0
  54. quakecascade-0.1.0/src/quakecascade/liquefaction.py +684 -0
  55. quakecascade-0.1.0/src/quakecascade/mcda.py +167 -0
  56. quakecascade-0.1.0/src/quakecascade/montecarlo.py +291 -0
  57. quakecascade-0.1.0/src/quakecascade/network/__init__.py +693 -0
  58. quakecascade-0.1.0/src/quakecascade/network/_graphs.py +275 -0
  59. quakecascade-0.1.0/src/quakecascade/network/_paths.py +197 -0
  60. quakecascade-0.1.0/tests/data/asb14_pygmm_reference.json +1343 -0
  61. quakecascade-0.1.0/tests/test_access.py +264 -0
  62. quakecascade-0.1.0/tests/test_allocate.py +314 -0
  63. quakecascade-0.1.0/tests/test_cascade.py +548 -0
  64. quakecascade-0.1.0/tests/test_contract.py +121 -0
  65. quakecascade-0.1.0/tests/test_crs.py +90 -0
  66. quakecascade-0.1.0/tests/test_datasets.py +307 -0
  67. quakecascade-0.1.0/tests/test_debris.py +433 -0
  68. quakecascade-0.1.0/tests/test_fragility.py +263 -0
  69. quakecascade-0.1.0/tests/test_groundmotion.py +273 -0
  70. quakecascade-0.1.0/tests/test_groundmotion_rupture.py +354 -0
  71. quakecascade-0.1.0/tests/test_hydro.py +223 -0
  72. quakecascade-0.1.0/tests/test_impact.py +360 -0
  73. quakecascade-0.1.0/tests/test_lifelines.py +121 -0
  74. quakecascade-0.1.0/tests/test_liquefaction.py +400 -0
  75. quakecascade-0.1.0/tests/test_mcda.py +123 -0
  76. quakecascade-0.1.0/tests/test_montecarlo.py +232 -0
  77. quakecascade-0.1.0/tests/test_network.py +590 -0
@@ -0,0 +1,13 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ build/
5
+ dist/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ examples/output/
9
+ .coverage*
10
+ coverage.xml
11
+ report.xml
12
+ site/
13
+ public/
@@ -0,0 +1,76 @@
1
+ # Changelog
2
+
3
+ All notable changes are recorded here. The format follows Keep a Changelog and the
4
+ project uses semantic versioning.
5
+
6
+ ## [0.1.0] - unreleased
7
+
8
+ First release: the full cascade from ground motion to relief allocation.
9
+
10
+ ### Added
11
+
12
+ - `groundmotion`: Akkar, Sandıkkaya & Bommer (2014) GMPE for PGA, PGV and spectral
13
+ acceleration with Joyner–Boore, epicentral and hypocentral distances; rupture-plane
14
+ projection from a surface trace, dip and seismogenic depths; Wells & Coppersmith (1994)
15
+ width and magnitude relations; percentile scenario driver with applicability flags.
16
+ - `fragility`: Hazus 6.1 equivalent-PGA fragilities for 36 building types at four design
17
+ levels, height classes and design-level bracketing.
18
+ - `impact`: Hazus 6.1 casualties by severity and time of day, displaced households and
19
+ public shelter need.
20
+ - `montecarlo`: city-total damage bands under independent, between-event and fully
21
+ correlated sampling that preserve each building's marginal distribution.
22
+ - `liquefaction` and `hydro`: Zhu et al. (2015) geospatial model with clips, coverage
23
+ factor and the USGS Ground Failure screening limits, Hazus susceptibility-class model,
24
+ Vs30 from slope by the USGS global Vs30 method, D8 flow accumulation and the compound
25
+ topographic index on the HYDRO1k scale the Zhu model was fitted on (metre convention
26
+ optional).
27
+ - `debris`: debris reach envelopes, road debris pressure, corridor blockage share,
28
+ navigable-core test, closed-road selection that separates debris closures from roads that
29
+ were never passable, and `partial`/`no_height` roads near buildings of unknown height.
30
+ - `network`: routable road network with distance-based junction merging, snapping, class
31
+ speeds, Tobler walking speed, SciPy or pure-NumPy shortest paths, and a multi-source
32
+ nearest-facility search that respects one-way and direction-dependent costs.
33
+ - `access`: isolation status before and after the event, nearest-facility times, 2SFCA
34
+ with several decay kinds, and Hansen accessibility.
35
+ - `allocate`: p-median depot location (greedy plus interchange) and capacity-balanced
36
+ allocation.
37
+ - `mcda`: TOPSIS ranking with explicit weights and missing-value handling.
38
+ - `lifelines`: Hazus wave-propagation pipeline repair rates with a material range for
39
+ unknown pipe.
40
+ - `cascade`: one-call orchestration of every stage with a stage log, skipped-stage reasons
41
+ and a fingerprinted run manifest. Per-unit sums over incompletely computed buildings are
42
+ never ranked or allocated as complete totals (`partial_units`: exclude, scale or
43
+ lower_bound, recorded in the stage log); buildings without a damage state never read as
44
+ standing; every input frame's CRS is checked; `unknown_height_reach_m` and `default_height`
45
+ are stated choices whenever the data need them; `summary()` reports how many buildings each
46
+ sum leaves out.
47
+ - `datasets`: deterministic synthetic town; OpenStreetMap, Copernicus GLO-30 and GEM
48
+ active-fault fetchers; `gem_fault_geometry` for a sourced rupture geometry from a GEM record.
49
+ - `contract` and `crs`: status codes, column specifications, extensive/intensive
50
+ aggregation, manifest building and metric-CRS checks (Mercator projections refused).
51
+ - Documentation site (method pages, tutorial, API reference), end-to-end examples on the
52
+ synthetic town and on open data, GitLab CI across Python 3.10–3.14 with a pure-NumPy job,
53
+ and a JOSS paper draft.
54
+
55
+ ### Changed (during development, before the first release)
56
+
57
+ - Vs30 from slope (`liquefaction.vs30_from_slope`, `vs30_from_slope_array`) now follows the USGS
58
+ global Vs30 code `grad2vs30.c`. It interpolates log–log within the slope–Vs30 bins of Allen &
59
+ Wald (2009, Table 1, modified 30 arc sec, for active tectonic regions) and Wald & Allen (2007,
60
+ for stable continents). The end bins are extrapolated, held at 180 m/s below and capped at
61
+ 900 m/s above. This replaces linear interpolation on the Allen & Wald (2007, OFR 2007-1357)
62
+ Table 2 nodes, which were held at 180/760 m/s. `SLOPE_VS30_NODES` is replaced by
63
+ `SLOPE_VS30_BINS` and `VS30_FROM_SLOPE_LIMITS`. Effect, old → new in m/s:
64
+
65
+ | slope (m/m) | 3×10⁻⁴ | 10⁻³ | 3×10⁻³ | 0.01 | 0.03 | 0.08 | 0.2 |
66
+ |---|---|---|---|---|---|---|---|
67
+ | active | 186 → 180 | 206 → 207 | 252 → 236 | 319 → 300 | 409 → 420 | 568 → 575 | 760 → 900 |
68
+
69
+ | slope (m/m) | 10⁻⁴ | 10⁻³ | 3×10⁻³ | 0.01 | 0.03 |
70
+ |---|---|---|---|---|---|
71
+ | stable | 182 → 199 | 210 → 230 | 270 → 273 | 423 → 427 | 760 → 851 |
72
+
73
+ Inside the bins the change is at most about 20 m/s, at active-region slopes below 0.018
74
+ where Allen & Wald (2009) revised the bins. Beyond the last bin it reaches 140 m/s, because
75
+ the value is now extrapolated up to the 900 m/s cap instead of held at 760 m/s. A negative
76
+ slope now gives NaN instead of 180 m/s.
@@ -0,0 +1,15 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite it as below."
3
+ authors:
4
+ - family-names: "Eminoğlu"
5
+ given-names: "Yusuf"
6
+ email: "geospacephilo@gmail.com"
7
+ orcid: "https://orcid.org/0009-0005-6000-2934"
8
+ affiliation: "Dokuz Eylül University"
9
+ title: "quakecascade: earthquake scenario cascades for cities"
10
+ version: "0.1.0"
11
+ date-released: "2026-11-25"
12
+ license: "BSD-3-Clause"
13
+ repository-code: "https://gitlab.com/yusufeminoglu/quakecascade"
14
+ abstract: "A Python library that runs one scenario earthquake through to the decisions a city plans with: ground motion on a sourced rupture plane (Akkar, Sandıkkaya and Bommer 2014), Hazus 6.1 building damage at bracketing design levels, casualties and shelter demand, liquefaction screening (Zhu et al. 2015; Hazus), Gaussian-copula Monte Carlo bands, debris reach and street closure, the post-event road network, two-step floating catchment accessibility, isolation status, p-median and capacity-balanced relief allocation, TOPSIS ranking and pipeline repair demand. Missing inputs are carried as status codes, never as zeros, and every run can emit a fingerprinted manifest."
15
+ keywords: [earthquake, scenario, Hazus, ground motion, liquefaction, debris, road closure, accessibility, 2SFCA, p-median, TOPSIS, emergency planning]
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, Yusuf Eminoğlu
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,79 @@
1
+ quakecascade
2
+ Copyright (c) 2026 Yusuf Eminoğlu. Licensed under BSD-3-Clause (see LICENSE).
3
+
4
+ Third-party material distributed with this package
5
+ ---------------------------------------------------
6
+
7
+ 1. ASB2014 ground-motion coefficient table (MIT)
8
+
9
+ src/quakecascade/groundmotion/_asb2014_data.py reproduces the coefficient
10
+ tables of Akkar, Sandikkaya & Bommer (2014), Bulletin of Earthquake
11
+ Engineering 12(1), 359-387, doi:10.1007/s10518-013-9461-4, as distributed
12
+ with pyGMM (table dated 2016-03-17). tests/data/asb14_pygmm_reference.json
13
+ (source distribution only) holds reference values computed with pyGMM and is
14
+ used only by the test suite.
15
+
16
+ pyGMM
17
+ https://github.com/arkottke/pygmm
18
+ Copyright (c) 2016 Albert Kottke
19
+
20
+ Permission is hereby granted, free of charge, to any person obtaining a copy
21
+ of this software and associated documentation files (the "Software"), to deal
22
+ in the Software without restriction, including without limitation the rights
23
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24
+ copies of the Software, and to permit persons to whom the Software is
25
+ furnished to do so, subject to the following conditions:
26
+
27
+ The above copyright notice and this permission notice shall be included in all
28
+ copies or substantial portions of the Software.
29
+
30
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36
+ SOFTWARE.
37
+
38
+ Material transcribed from public-domain sources (cited, not licensed)
39
+ --------------------------------------------------------------------
40
+
41
+ 2. Hazus 6.1 Earthquake Model Technical Manual (FEMA 2024): equivalent-PGA
42
+ fragility medians and dispersions (Tables 5-37 to 5-40, Table 5-1), casualty
43
+ and population tables (Section 12), displaced-household and shelter weights
44
+ (Section 13), liquefaction susceptibility tables (Section 4.2.2.1) and
45
+ potable-water pipeline repair-rate relations. Works of the US federal
46
+ government, public domain in the United States. The values are US
47
+ calibrations.
48
+
49
+ 3. Slope-Vs30 bins of Allen & Wald (2009), BSSA 99(2A), Table 1 (active
50
+ tectonic) and Wald & Allen (2007), BSSA 97(5) (stable continents), with the
51
+ log-log interpolation and 180/900 m/s caps of the USGS global Vs30 code
52
+ grad2vs30.c (github.com/usgs/earthquake-global_vs30; US Government work,
53
+ CC0 1.0). The code was read and its arithmetic re-implemented, not copied.
54
+
55
+ 4. Zhu et al. (2015) liquefaction model coefficients and the Zhu et al. (2017)
56
+ coverage factor, cross-checked against the USGS groundfailure (gfail)
57
+ implementation (CC0 1.0). The gfail code was read, not copied.
58
+
59
+ Code provenance
60
+ ---------------
61
+
62
+ The modules are ported from the PlanX QGIS plugin engine and re-implement, as
63
+ open source, methods of the DİRİ platform, both by the same author, and are
64
+ released here under BSD-3-Clause. No DİRİ code and no data of İzmir
65
+ Metropolitan Municipality (İBB) or any other city is included. No third-party
66
+ source code other than the coefficient table in item 1 is bundled.
67
+
68
+ Data fetched at run time (not distributed)
69
+ ------------------------------------------
70
+
71
+ quakecascade.datasets can download, at the user's request:
72
+ * OpenStreetMap data via osmnx - (c) OpenStreetMap contributors, ODbL 1.0;
73
+ * Copernicus DEM GLO-30 - (c) DLR e.V. 2010-2014 and (c) Airbus Defence and
74
+ Space GmbH 2014-2018, provided under COPERNICUS by the European Union and
75
+ ESA; free licence with attribution;
76
+ * GEM Global Active Faults database - CC BY-SA 4.0.
77
+ Users who redistribute these data must follow their licences.
78
+
79
+ Per-module notes with more detail are kept in docs/notice/.
@@ -0,0 +1,178 @@
1
+ Metadata-Version: 2.5
2
+ Name: quakecascade
3
+ Version: 0.1.0
4
+ Summary: Earthquake scenario cascades for cities: ground motion, damage, debris road closure, post-event accessibility and relief allocation.
5
+ Project-URL: Homepage, https://gitlab.com/yusufeminoglu/quakecascade
6
+ Project-URL: Source, https://gitlab.com/yusufeminoglu/quakecascade
7
+ Project-URL: Issues, https://gitlab.com/yusufeminoglu/quakecascade/-/issues
8
+ Author-email: Yusuf Eminoğlu <geospacephilo@gmail.com>
9
+ License-Expression: BSD-3-Clause
10
+ License-File: LICENSE
11
+ License-File: NOTICE
12
+ Keywords: accessibility,debris,earthquake,emergency planning,ground motion,hazus,p-median,scenario
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Classifier: Topic :: Scientific/Engineering :: GIS
24
+ Classifier: Topic :: Scientific/Engineering :: Physics
25
+ Requires-Python: >=3.10
26
+ Requires-Dist: numpy>=1.24
27
+ Requires-Dist: pandas>=2.0
28
+ Requires-Dist: pyproj>=3.5
29
+ Requires-Dist: scipy>=1.10
30
+ Requires-Dist: shapely>=2.0
31
+ Provides-Extra: demo
32
+ Requires-Dist: geopandas>=0.14; extra == 'demo'
33
+ Requires-Dist: matplotlib>=3.7; extra == 'demo'
34
+ Requires-Dist: osmnx>=2.0; extra == 'demo'
35
+ Requires-Dist: pyogrio>=0.7; extra == 'demo'
36
+ Provides-Extra: docs
37
+ Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
38
+ Requires-Dist: mkdocstrings[python]>=0.25; extra == 'docs'
39
+ Provides-Extra: geo
40
+ Requires-Dist: geopandas>=0.14; extra == 'geo'
41
+ Requires-Dist: pyarrow>=14; extra == 'geo'
42
+ Requires-Dist: pyogrio>=0.7; extra == 'geo'
43
+ Provides-Extra: raster
44
+ Requires-Dist: rasterio>=1.3; extra == 'raster'
45
+ Provides-Extra: test
46
+ Requires-Dist: geopandas>=0.14; extra == 'test'
47
+ Requires-Dist: pytest-cov>=4.1; extra == 'test'
48
+ Requires-Dist: pytest>=7.4; extra == 'test'
49
+ Description-Content-Type: text/markdown
50
+
51
+ # quakecascade
52
+
53
+ Earthquake scenario cascades for cities: ground motion, building damage, casualties and shelter
54
+ need, liquefaction, debris-induced road closure, accessibility to emergency services, relief-depot
55
+ allocation, unit ranking and lifeline repair demand, computed on open or municipal inventories.
56
+
57
+ ```text
58
+ fault + magnitude ─► ground motion (ASB2014) ─► damage at bracketing design levels (Hazus 6.1)
59
+ ─► casualties, displaced households, shelter ─► liquefaction screen (Zhu 2015 / Hazus)
60
+ ─► Monte Carlo bands with shared ground-motion residuals
61
+ ─► debris reach, pressure, corridor blockage, navigable core ─► closed roads
62
+ ─► travel times before/after ─► isolation status, 2SFCA access
63
+ ─► p-median depots, capacity balance ─► TOPSIS unit ranking ─► pipeline repairs
64
+ ```
65
+
66
+ `quakecascade` re-implements, as open source, the methods of DİRİ, the earthquake
67
+ decision-support platform built for the İzmir Earthquake Master Plan. It contains none of DİRİ's
68
+ code and no data of İzmir Metropolitan Municipality (İBB) or any other city: everything runs on
69
+ inputs you supply, on open data, or on the built-in synthetic town.
70
+
71
+ ## Why another earthquake package
72
+
73
+ Loss engines stop at buildings and lifelines, while accessibility and location-allocation tools
74
+ assume the street network is intact. `quakecascade` connects the two in one library, under rules
75
+ that keep the chain honest:
76
+
77
+ - **Missing is never zero.** Each value comes with a status code (`computed`, `partial`,
78
+ `no_vs30`, `outside_envelope`, …), and an unknown street is never reported as a safe one.
79
+ - **No silent defaults.** Every coefficient cites its source. A planning choice without a
80
+ published value, such as the debris spread factor or the closure threshold, is a required
81
+ argument.
82
+ - **Counts sum, intensities do not.** Aggregation follows the nature of each column.
83
+ - **Reproducible.** A cascade run returns a manifest with its parameters, input digests and a
84
+ fingerprint.
85
+
86
+ ## Install
87
+
88
+ ```bash
89
+ git clone https://gitlab.com/yusufeminoglu/quakecascade.git
90
+ cd quakecascade
91
+ python -m pip install -e . # core: numpy, scipy, pandas, shapely, pyproj
92
+ python -m pip install -e ".[demo]" # + geopandas, osmnx, matplotlib for the examples
93
+ ```
94
+
95
+ Python 3.10 or newer is required. The package is not on PyPI yet.
96
+
97
+ ## Quick start
98
+
99
+ ```python
100
+ import numpy as np
101
+ from quakecascade import fragility, groundmotion as gm
102
+
103
+ trace = np.array([[0.0, 0.0], [30_000.0, 0.0]]) # metres, projected CRS
104
+ rupture = gm.FaultGeometry.from_wells_coppersmith(
105
+ dip_deg=60.0, dip_azimuth_deg=0.0, magnitude=6.8, mechanism="NS",
106
+ source="hypothetical example fault, dip 60 deg to the north")
107
+ sites = np.array([[15_000.0, 5_000.0], [15_000.0, 12_000.0], [15_000.0, 40_000.0]])
108
+ vs30 = np.array([300.0, np.nan, 760.0]) # the second site has no Vs30
109
+
110
+ motion = gm.scenario(sites, vs30, trace, magnitude=6.8, mechanism="NS", geometry=rupture)
111
+ dmg = fragility.damage(motion["pga_g_p50"].to_numpy(), ["C1M", "C1M", "URML"],
112
+ floors=[5, 5, 2], design_levels=["pre", "moderate"])
113
+ print(dmg[["building_id", "design_level", "p_complete", "dmg_status"]])
114
+ ```
115
+
116
+ ```text
117
+ building_id design_level p_complete dmg_status
118
+ 0 0 pre 0.519 computed
119
+ 1 1 pre NaN no_pga
120
+ 2 2 pre 0.006 computed
121
+ 3 0 moderate 0.138 computed
122
+ 4 1 moderate NaN no_pga
123
+ 5 2 moderate NaN no_fragility_curve
124
+ ```
125
+
126
+ The whole chain on the synthetic town, and on open data for a small area (network required):
127
+
128
+ ```bash
129
+ python examples/01_synthetic_town.py
130
+ python examples/02_open_data.py # needs the demo and raster extras
131
+ ```
132
+
133
+ ## Modules
134
+
135
+ | Module | Computes |
136
+ |---|---|
137
+ | `groundmotion` | Joyner–Boore distance to a dipping rupture plane; PGA, PGV and SA percentiles from Akkar, Sandıkkaya & Bommer (2014) |
138
+ | `fragility` | Hazus 6.1 damage-state probabilities at several design levels |
139
+ | `impact` | casualties by severity and time of day, displaced households, public shelter need (Hazus 6.1) |
140
+ | `montecarlo` | city-total damage bands under independent, between-event and fully correlated sampling |
141
+ | `liquefaction`, `hydro` | Zhu et al. (2015) geospatial liquefaction, Hazus susceptibility, CTI from a DEM |
142
+ | `debris` | debris reach, road pressure, blocked corridor share, navigable core, closed roads |
143
+ | `network` | routable road network with SciPy or pure-NumPy shortest paths |
144
+ | `access` | isolation status, nearest-facility time, 2SFCA and Hansen accessibility |
145
+ | `allocate` | p-median depot location and capacity-balanced allocation |
146
+ | `mcda` | TOPSIS ranking |
147
+ | `lifelines` | buried pipeline repair rates and counts |
148
+ | `cascade` | the whole chain as one run, with a stage log and manifest |
149
+ | `datasets` | synthetic demonstration town; OSM, Copernicus DEM and GEM fault fetchers |
150
+ | `contract`, `crs` | status codes, column specifications, aggregation rules, metric-CRS checks |
151
+
152
+ Each module has a method page under `docs/methods/` with its equations, parameter tables,
153
+ sources and caveats. Build the documentation site with
154
+ `pip install -e ".[docs]" && mkdocs serve`.
155
+
156
+ ## Scope and limits
157
+
158
+ Fragility, casualty and shelter tables are Hazus calibrations of US practice. Ground motion uses
159
+ one model, derived from European and Middle Eastern records. Debris parameters are not calibrated
160
+ against observations, so bracket them. The package is a scenario tool for planning and teaching.
161
+ It does not produce probabilistic seismic hazard and is not a substitute for a site-specific
162
+ engineering assessment.
163
+
164
+ ## Development
165
+
166
+ ```bash
167
+ python -m pip install -e ".[test]"
168
+ python -m pytest -q # 600+ tests, no network
169
+ QUAKECASCADE_FORCE_NUMPY=1 python -m pytest -q # pure-NumPy paths
170
+ ruff check src tests
171
+ ```
172
+
173
+ See `CONTRIBUTING.md` and `CODE_OF_CONDUCT.md`.
174
+
175
+ ## Licence and citation
176
+
177
+ BSD-3-Clause (see `LICENSE`). Third-party material, such as the ASB2014 coefficient table from
178
+ pyGMM (MIT), is listed in `NOTICE`. To cite the software, see `CITATION.cff`.
@@ -0,0 +1,128 @@
1
+ # quakecascade
2
+
3
+ Earthquake scenario cascades for cities: ground motion, building damage, casualties and shelter
4
+ need, liquefaction, debris-induced road closure, accessibility to emergency services, relief-depot
5
+ allocation, unit ranking and lifeline repair demand, computed on open or municipal inventories.
6
+
7
+ ```text
8
+ fault + magnitude ─► ground motion (ASB2014) ─► damage at bracketing design levels (Hazus 6.1)
9
+ ─► casualties, displaced households, shelter ─► liquefaction screen (Zhu 2015 / Hazus)
10
+ ─► Monte Carlo bands with shared ground-motion residuals
11
+ ─► debris reach, pressure, corridor blockage, navigable core ─► closed roads
12
+ ─► travel times before/after ─► isolation status, 2SFCA access
13
+ ─► p-median depots, capacity balance ─► TOPSIS unit ranking ─► pipeline repairs
14
+ ```
15
+
16
+ `quakecascade` re-implements, as open source, the methods of DİRİ, the earthquake
17
+ decision-support platform built for the İzmir Earthquake Master Plan. It contains none of DİRİ's
18
+ code and no data of İzmir Metropolitan Municipality (İBB) or any other city: everything runs on
19
+ inputs you supply, on open data, or on the built-in synthetic town.
20
+
21
+ ## Why another earthquake package
22
+
23
+ Loss engines stop at buildings and lifelines, while accessibility and location-allocation tools
24
+ assume the street network is intact. `quakecascade` connects the two in one library, under rules
25
+ that keep the chain honest:
26
+
27
+ - **Missing is never zero.** Each value comes with a status code (`computed`, `partial`,
28
+ `no_vs30`, `outside_envelope`, …), and an unknown street is never reported as a safe one.
29
+ - **No silent defaults.** Every coefficient cites its source. A planning choice without a
30
+ published value, such as the debris spread factor or the closure threshold, is a required
31
+ argument.
32
+ - **Counts sum, intensities do not.** Aggregation follows the nature of each column.
33
+ - **Reproducible.** A cascade run returns a manifest with its parameters, input digests and a
34
+ fingerprint.
35
+
36
+ ## Install
37
+
38
+ ```bash
39
+ git clone https://gitlab.com/yusufeminoglu/quakecascade.git
40
+ cd quakecascade
41
+ python -m pip install -e . # core: numpy, scipy, pandas, shapely, pyproj
42
+ python -m pip install -e ".[demo]" # + geopandas, osmnx, matplotlib for the examples
43
+ ```
44
+
45
+ Python 3.10 or newer is required. The package is not on PyPI yet.
46
+
47
+ ## Quick start
48
+
49
+ ```python
50
+ import numpy as np
51
+ from quakecascade import fragility, groundmotion as gm
52
+
53
+ trace = np.array([[0.0, 0.0], [30_000.0, 0.0]]) # metres, projected CRS
54
+ rupture = gm.FaultGeometry.from_wells_coppersmith(
55
+ dip_deg=60.0, dip_azimuth_deg=0.0, magnitude=6.8, mechanism="NS",
56
+ source="hypothetical example fault, dip 60 deg to the north")
57
+ sites = np.array([[15_000.0, 5_000.0], [15_000.0, 12_000.0], [15_000.0, 40_000.0]])
58
+ vs30 = np.array([300.0, np.nan, 760.0]) # the second site has no Vs30
59
+
60
+ motion = gm.scenario(sites, vs30, trace, magnitude=6.8, mechanism="NS", geometry=rupture)
61
+ dmg = fragility.damage(motion["pga_g_p50"].to_numpy(), ["C1M", "C1M", "URML"],
62
+ floors=[5, 5, 2], design_levels=["pre", "moderate"])
63
+ print(dmg[["building_id", "design_level", "p_complete", "dmg_status"]])
64
+ ```
65
+
66
+ ```text
67
+ building_id design_level p_complete dmg_status
68
+ 0 0 pre 0.519 computed
69
+ 1 1 pre NaN no_pga
70
+ 2 2 pre 0.006 computed
71
+ 3 0 moderate 0.138 computed
72
+ 4 1 moderate NaN no_pga
73
+ 5 2 moderate NaN no_fragility_curve
74
+ ```
75
+
76
+ The whole chain on the synthetic town, and on open data for a small area (network required):
77
+
78
+ ```bash
79
+ python examples/01_synthetic_town.py
80
+ python examples/02_open_data.py # needs the demo and raster extras
81
+ ```
82
+
83
+ ## Modules
84
+
85
+ | Module | Computes |
86
+ |---|---|
87
+ | `groundmotion` | Joyner–Boore distance to a dipping rupture plane; PGA, PGV and SA percentiles from Akkar, Sandıkkaya & Bommer (2014) |
88
+ | `fragility` | Hazus 6.1 damage-state probabilities at several design levels |
89
+ | `impact` | casualties by severity and time of day, displaced households, public shelter need (Hazus 6.1) |
90
+ | `montecarlo` | city-total damage bands under independent, between-event and fully correlated sampling |
91
+ | `liquefaction`, `hydro` | Zhu et al. (2015) geospatial liquefaction, Hazus susceptibility, CTI from a DEM |
92
+ | `debris` | debris reach, road pressure, blocked corridor share, navigable core, closed roads |
93
+ | `network` | routable road network with SciPy or pure-NumPy shortest paths |
94
+ | `access` | isolation status, nearest-facility time, 2SFCA and Hansen accessibility |
95
+ | `allocate` | p-median depot location and capacity-balanced allocation |
96
+ | `mcda` | TOPSIS ranking |
97
+ | `lifelines` | buried pipeline repair rates and counts |
98
+ | `cascade` | the whole chain as one run, with a stage log and manifest |
99
+ | `datasets` | synthetic demonstration town; OSM, Copernicus DEM and GEM fault fetchers |
100
+ | `contract`, `crs` | status codes, column specifications, aggregation rules, metric-CRS checks |
101
+
102
+ Each module has a method page under `docs/methods/` with its equations, parameter tables,
103
+ sources and caveats. Build the documentation site with
104
+ `pip install -e ".[docs]" && mkdocs serve`.
105
+
106
+ ## Scope and limits
107
+
108
+ Fragility, casualty and shelter tables are Hazus calibrations of US practice. Ground motion uses
109
+ one model, derived from European and Middle Eastern records. Debris parameters are not calibrated
110
+ against observations, so bracket them. The package is a scenario tool for planning and teaching.
111
+ It does not produce probabilistic seismic hazard and is not a substitute for a site-specific
112
+ engineering assessment.
113
+
114
+ ## Development
115
+
116
+ ```bash
117
+ python -m pip install -e ".[test]"
118
+ python -m pytest -q # 600+ tests, no network
119
+ QUAKECASCADE_FORCE_NUMPY=1 python -m pytest -q # pure-NumPy paths
120
+ ruff check src tests
121
+ ```
122
+
123
+ See `CONTRIBUTING.md` and `CODE_OF_CONDUCT.md`.
124
+
125
+ ## Licence and citation
126
+
127
+ BSD-3-Clause (see `LICENSE`). Third-party material, such as the ASB2014 coefficient table from
128
+ pyGMM (MIT), is listed in `NOTICE`. To cite the software, see `CITATION.cff`.
@@ -0,0 +1,75 @@
1
+ # API reference
2
+
3
+ Generated from the docstrings. Every module lists its public names in `__all__`.
4
+
5
+ ## Cascade
6
+
7
+ ::: quakecascade.cascade
8
+
9
+ ## Demonstration data
10
+
11
+ ::: quakecascade.datasets
12
+
13
+ ## Ground motion
14
+
15
+ ::: quakecascade.groundmotion
16
+ options:
17
+ members: false
18
+
19
+ ::: quakecascade.groundmotion.scenario
20
+
21
+ ::: quakecascade.groundmotion.asb2014
22
+
23
+ ::: quakecascade.groundmotion.distance
24
+
25
+ ::: quakecascade.groundmotion.rupture
26
+
27
+ ## Building damage
28
+
29
+ ::: quakecascade.fragility
30
+
31
+ ## Casualties and shelter
32
+
33
+ ::: quakecascade.impact
34
+
35
+ ## Monte Carlo bands
36
+
37
+ ::: quakecascade.montecarlo
38
+
39
+ ## Liquefaction and hydrology
40
+
41
+ ::: quakecascade.liquefaction
42
+
43
+ ::: quakecascade.hydro
44
+
45
+ ## Debris and road closure
46
+
47
+ ::: quakecascade.debris
48
+
49
+ ## Road network
50
+
51
+ ::: quakecascade.network
52
+
53
+ ## Accessibility and isolation
54
+
55
+ ::: quakecascade.access
56
+
57
+ ## Allocation
58
+
59
+ ::: quakecascade.allocate
60
+
61
+ ## Ranking
62
+
63
+ ::: quakecascade.mcda
64
+
65
+ ## Lifelines
66
+
67
+ ::: quakecascade.lifelines
68
+
69
+ ## Output contract
70
+
71
+ ::: quakecascade.contract
72
+
73
+ ## Coordinate reference systems
74
+
75
+ ::: quakecascade.crs