Datasets:
Upload folder using huggingface_hub
Browse files- README.md +116 -0
- data/slr_east_africa_island.csv +0 -0
- data/slr_southern_coastal_city.csv +0 -0
- data/slr_west_africa_delta.csv +0 -0
- generate_dataset.py +197 -0
- requirements.txt +3 -0
- validate_dataset.py +117 -0
- validation_report.png +3 -0
README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- tabular-classification
|
| 5 |
+
- tabular-regression
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
tags:
|
| 9 |
+
- climate-health
|
| 10 |
+
- sea-level-rise
|
| 11 |
+
- coastal-health
|
| 12 |
+
- flooding
|
| 13 |
+
- health-infrastructure
|
| 14 |
+
- synthetic
|
| 15 |
+
- sub-saharan-africa
|
| 16 |
+
pretty_name: Sea-Level Rise & Coastal Health Infrastructure (SSA)
|
| 17 |
+
size_categories:
|
| 18 |
+
- 10K<n<100K
|
| 19 |
+
configs:
|
| 20 |
+
- config_name: west_africa_delta
|
| 21 |
+
data_files: data/slr_west_africa_delta.csv
|
| 22 |
+
default: true
|
| 23 |
+
- config_name: east_africa_island
|
| 24 |
+
data_files: data/slr_east_africa_island.csv
|
| 25 |
+
- config_name: southern_coastal_city
|
| 26 |
+
data_files: data/slr_southern_coastal_city.csv
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
# Sea-Level Rise & Coastal Health Infrastructure in Sub-Saharan Africa
|
| 30 |
+
|
| 31 |
+
## Abstract
|
| 32 |
+
|
| 33 |
+
A synthetic dataset modelling sea-level rise impacts on coastal health infrastructure and disease outcomes across three coastal zone scenarios in SSA. Each record represents a location-year observation describing flood risk, facility damage, supply chain disruption, and disease burden. IPCC AR6 projects 0.3-1.0m global mean SLR by 2100, with African coasts among the most vulnerable due to low-lying deltas, limited adaptation, and high population density.
|
| 34 |
+
|
| 35 |
+
### Scenarios
|
| 36 |
+
|
| 37 |
+
- **West Africa Delta**: Low-lying Niger/Volta delta zones with high flood and erosion risk.
|
| 38 |
+
- **East Africa Island**: Indian Ocean island and coastal communities with storm surge exposure.
|
| 39 |
+
- **Southern Coastal City**: Urbanized coastal cities with higher baseline infrastructure but growing risk.
|
| 40 |
+
|
| 41 |
+
## Dataset Structure
|
| 42 |
+
|
| 43 |
+
Each scenario contains 10,000 records (30,000 total). Key columns:
|
| 44 |
+
|
| 45 |
+
- `elevation_m`, `slr_rate_mm_per_yr`, `cumulative_slr_cm`
|
| 46 |
+
- `storm_surge`, `surge_height_m`, `coastal_erosion_m_per_yr`
|
| 47 |
+
- `flood_risk`, `flooded`, `saltwater_intrusion`
|
| 48 |
+
- `facility_at_risk`, `facility_damaged`, `facility_inaccessible`
|
| 49 |
+
- `supply_chain_disrupted`, `essential_medicine_stockout`
|
| 50 |
+
- `displaced`, `population_exposed`
|
| 51 |
+
- `waterborne_disease`, `malaria_case`, `cholera_outbreak`, `mental_health_impact`
|
| 52 |
+
- `health_system_resilience`, `adaptation_score`
|
| 53 |
+
|
| 54 |
+
## Parameterization Evidence
|
| 55 |
+
|
| 56 |
+
| Parameter | Value Used | Source | Year |
|
| 57 |
+
| --- | --- | --- | --- |
|
| 58 |
+
| Global mean SLR 3-4 mm/yr | SLR rate baseline | IPCC AR6 WG1 | 2021 |
|
| 59 |
+
| West African coastline eroding 1-5 m/yr | Erosion rates | Appeaning Addo et al. | 2011 |
|
| 60 |
+
| 30% of African health facilities in climate-vulnerable zones | Facility risk | WHO-UNFCCC | 2021 |
|
| 61 |
+
| Flooding amplifies waterborne disease and malaria | Disease linkage | Lancet Countdown Africa | 2022 |
|
| 62 |
+
|
| 63 |
+
## Validation Summary
|
| 64 |
+
|
| 65 |
+
The 8-panel validation report (`validation_report.png`) confirms:
|
| 66 |
+
|
| 67 |
+
1. **Flood risk**: West Africa Delta has highest flood risk; elevation inversely correlated.
|
| 68 |
+
2. **Health impacts**: Waterborne disease and malaria highest in delta scenario.
|
| 69 |
+
3. **Facility risk**: Facility damage and inaccessibility track flood exposure.
|
| 70 |
+
4. **Elevation gradient**: Lower elevation strongly predicts higher flood risk.
|
| 71 |
+
5. **Supply chain**: Disruption rates highest in delta and island scenarios.
|
| 72 |
+
6. **Resilience**: Southern coastal cities show highest health system resilience.
|
| 73 |
+
7. **SLR trend**: Cumulative SLR increases over time across all scenarios.
|
| 74 |
+
8. **Adaptation**: Urban settings show modestly higher adaptation scores.
|
| 75 |
+
|
| 76 |
+

|
| 77 |
+
|
| 78 |
+
## Usage
|
| 79 |
+
|
| 80 |
+
```python
|
| 81 |
+
from datasets import load_dataset
|
| 82 |
+
|
| 83 |
+
ds = load_dataset("electricsheepafrica/sea-level-rise-coastal-health", name="west_africa_delta")
|
| 84 |
+
df = ds["train"].to_pandas()
|
| 85 |
+
|
| 86 |
+
print(df.groupby("flooded")[["waterborne_disease", "malaria_case"]].mean())
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
## Limitations
|
| 90 |
+
|
| 91 |
+
- **Synthetic data**: Not from tide gauges, satellite altimetry, or health facility surveys.
|
| 92 |
+
- **No spatial geocoding**: Scenarios proxy geography, not precise coordinates.
|
| 93 |
+
- **Simplified SLR model**: Linear trend; actual SLR is nonlinear with regional variation.
|
| 94 |
+
|
| 95 |
+
## References
|
| 96 |
+
|
| 97 |
+
1. IPCC. AR6 Working Group I: The Physical Science Basis. 2021.
|
| 98 |
+
2. Appeaning Addo K, et al. Shoreline change in Ghana's coastal zone. *Afr Geogr Rev*, 2011.
|
| 99 |
+
3. WHO-UNFCCC. Health and Climate Change Country Profiles. 2021.
|
| 100 |
+
4. Lancet Countdown on Health and Climate Change: Africa Report. 2022.
|
| 101 |
+
|
| 102 |
+
## Citation
|
| 103 |
+
|
| 104 |
+
```bibtex
|
| 105 |
+
@dataset{electricsheepafrica_sea_level_rise_coastal_health_2025,
|
| 106 |
+
title={Sea-Level Rise and Coastal Health Infrastructure in Sub-Saharan Africa},
|
| 107 |
+
author={Electric Sheep Africa},
|
| 108 |
+
year={2025},
|
| 109 |
+
publisher={HuggingFace},
|
| 110 |
+
url={https://huggingface.co/datasets/electricsheepafrica/sea-level-rise-coastal-health}
|
| 111 |
+
}
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
## License
|
| 115 |
+
|
| 116 |
+
CC-BY-4.0
|
data/slr_east_africa_island.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/slr_southern_coastal_city.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/slr_west_africa_delta.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
generate_dataset.py
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Generate synthetic sea-level rise & coastal health infrastructure dataset for SSA."""
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
import numpy as np
|
| 8 |
+
import pandas as pd
|
| 9 |
+
|
| 10 |
+
SEED = 42
|
| 11 |
+
N_PER_SCENARIO = 10_000
|
| 12 |
+
|
| 13 |
+
YEAR_RANGE = np.arange(2010, 2025)
|
| 14 |
+
YEAR_WEIGHTS = np.linspace(0.85, 1.3, len(YEAR_RANGE))
|
| 15 |
+
YEAR_WEIGHTS = YEAR_WEIGHTS / YEAR_WEIGHTS.sum()
|
| 16 |
+
|
| 17 |
+
SCENARIOS = {
|
| 18 |
+
"west_africa_delta": {
|
| 19 |
+
"slr_mm_per_yr_mean": 3.5,
|
| 20 |
+
"slr_mm_per_yr_sd": 0.8,
|
| 21 |
+
"storm_surge_freq": 0.25,
|
| 22 |
+
"coastal_erosion_m_per_yr": 2.5,
|
| 23 |
+
"elevation_mean": 3.0,
|
| 24 |
+
"elevation_sd": 2.0,
|
| 25 |
+
"flood_risk_base": 0.35,
|
| 26 |
+
"saltwater_intrusion_pct": 0.40,
|
| 27 |
+
"facility_at_risk_pct": 0.30,
|
| 28 |
+
"facility_damaged_pct": 0.12,
|
| 29 |
+
"population_density_mean": 450,
|
| 30 |
+
"displacement_pct": 0.20,
|
| 31 |
+
"waterborne_disease_rate": 120,
|
| 32 |
+
"malaria_rate_per1k": 180,
|
| 33 |
+
"cholera_risk": 0.15,
|
| 34 |
+
"mental_health_impact": 0.25,
|
| 35 |
+
"setting_probs": {"coastal_urban": 0.35, "coastal_rural": 0.40, "delta": 0.25},
|
| 36 |
+
},
|
| 37 |
+
"east_africa_island": {
|
| 38 |
+
"slr_mm_per_yr_mean": 4.0,
|
| 39 |
+
"slr_mm_per_yr_sd": 1.0,
|
| 40 |
+
"storm_surge_freq": 0.30,
|
| 41 |
+
"coastal_erosion_m_per_yr": 1.8,
|
| 42 |
+
"elevation_mean": 4.5,
|
| 43 |
+
"elevation_sd": 2.5,
|
| 44 |
+
"flood_risk_base": 0.28,
|
| 45 |
+
"saltwater_intrusion_pct": 0.35,
|
| 46 |
+
"facility_at_risk_pct": 0.25,
|
| 47 |
+
"facility_damaged_pct": 0.10,
|
| 48 |
+
"population_density_mean": 300,
|
| 49 |
+
"displacement_pct": 0.15,
|
| 50 |
+
"waterborne_disease_rate": 95,
|
| 51 |
+
"malaria_rate_per1k": 140,
|
| 52 |
+
"cholera_risk": 0.10,
|
| 53 |
+
"mental_health_impact": 0.22,
|
| 54 |
+
"setting_probs": {"coastal_urban": 0.30, "coastal_rural": 0.35, "island": 0.35},
|
| 55 |
+
},
|
| 56 |
+
"southern_coastal_city": {
|
| 57 |
+
"slr_mm_per_yr_mean": 3.0,
|
| 58 |
+
"slr_mm_per_yr_sd": 0.6,
|
| 59 |
+
"storm_surge_freq": 0.20,
|
| 60 |
+
"coastal_erosion_m_per_yr": 1.5,
|
| 61 |
+
"elevation_mean": 6.0,
|
| 62 |
+
"elevation_sd": 3.0,
|
| 63 |
+
"flood_risk_base": 0.22,
|
| 64 |
+
"saltwater_intrusion_pct": 0.25,
|
| 65 |
+
"facility_at_risk_pct": 0.18,
|
| 66 |
+
"facility_damaged_pct": 0.07,
|
| 67 |
+
"population_density_mean": 600,
|
| 68 |
+
"displacement_pct": 0.10,
|
| 69 |
+
"waterborne_disease_rate": 65,
|
| 70 |
+
"malaria_rate_per1k": 80,
|
| 71 |
+
"cholera_risk": 0.06,
|
| 72 |
+
"mental_health_impact": 0.18,
|
| 73 |
+
"setting_probs": {"coastal_urban": 0.55, "coastal_rural": 0.25, "peri_urban": 0.20},
|
| 74 |
+
},
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
SCENARIO_FILES = {
|
| 78 |
+
"west_africa_delta": "slr_west_africa_delta.csv",
|
| 79 |
+
"east_africa_island": "slr_east_africa_island.csv",
|
| 80 |
+
"southern_coastal_city": "slr_southern_coastal_city.csv",
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def _choice(rng, prob_map):
|
| 85 |
+
keys = list(prob_map.keys())
|
| 86 |
+
weights = np.array(list(prob_map.values()), dtype=float)
|
| 87 |
+
weights = weights / weights.sum()
|
| 88 |
+
return rng.choice(keys, p=weights)
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
def _simulate_scenario(name, params, seed):
|
| 92 |
+
rng = np.random.default_rng(seed)
|
| 93 |
+
records = []
|
| 94 |
+
|
| 95 |
+
for idx in range(N_PER_SCENARIO):
|
| 96 |
+
year = int(rng.choice(YEAR_RANGE, p=YEAR_WEIGHTS))
|
| 97 |
+
setting = _choice(rng, params["setting_probs"])
|
| 98 |
+
|
| 99 |
+
elevation_m = float(np.clip(rng.normal(params["elevation_mean"], params["elevation_sd"]), 0.2, 20))
|
| 100 |
+
slr_rate = float(np.clip(rng.normal(params["slr_mm_per_yr_mean"], params["slr_mm_per_yr_sd"]), 1, 8))
|
| 101 |
+
cumulative_slr_cm = float(slr_rate * (year - 2000) / 10)
|
| 102 |
+
|
| 103 |
+
storm_surge = int(rng.random() < params["storm_surge_freq"])
|
| 104 |
+
surge_height_m = float(np.clip(rng.exponential(0.8), 0, 3.5)) if storm_surge else 0.0
|
| 105 |
+
coastal_erosion = float(np.clip(
|
| 106 |
+
rng.normal(params["coastal_erosion_m_per_yr"], 0.8), 0, 8
|
| 107 |
+
))
|
| 108 |
+
|
| 109 |
+
flood_risk = float(np.clip(
|
| 110 |
+
params["flood_risk_base"] + (cumulative_slr_cm / 15) * 0.2 - (elevation_m / 10) * 0.15,
|
| 111 |
+
0, 1,
|
| 112 |
+
))
|
| 113 |
+
flooded = int(rng.random() < flood_risk)
|
| 114 |
+
saltwater_intrusion = int(rng.random() < params["saltwater_intrusion_pct"] + cumulative_slr_cm * 0.01)
|
| 115 |
+
|
| 116 |
+
facility_at_risk = int(rng.random() < params["facility_at_risk_pct"])
|
| 117 |
+
facility_damaged = int(facility_at_risk and rng.random() < params["facility_damaged_pct"] / params["facility_at_risk_pct"])
|
| 118 |
+
facility_inaccessible = int((flooded or facility_damaged) and rng.random() < 0.4)
|
| 119 |
+
|
| 120 |
+
supply_chain_disrupted = int((flooded or storm_surge) and rng.random() < 0.35)
|
| 121 |
+
essential_medicine_stockout = int(supply_chain_disrupted and rng.random() < 0.45)
|
| 122 |
+
|
| 123 |
+
displaced = int(rng.random() < params["displacement_pct"] * (1 + flooded * 0.5))
|
| 124 |
+
population_exposed = int(np.clip(
|
| 125 |
+
rng.normal(params["population_density_mean"], 120) * (1 if elevation_m < 5 else 0.5),
|
| 126 |
+
50, 2000,
|
| 127 |
+
))
|
| 128 |
+
|
| 129 |
+
wb_disease_rate = params["waterborne_disease_rate"] * (1 + flooded * 0.6 + saltwater_intrusion * 0.3)
|
| 130 |
+
waterborne_disease = int(rng.random() < wb_disease_rate / 1000)
|
| 131 |
+
|
| 132 |
+
malaria_rate = params["malaria_rate_per1k"] * (1 + flooded * 0.4)
|
| 133 |
+
malaria_case = int(rng.random() < malaria_rate / 1000)
|
| 134 |
+
|
| 135 |
+
cholera_outbreak = int(rng.random() < params["cholera_risk"] * (1 + flooded * 1.5 + saltwater_intrusion * 0.5))
|
| 136 |
+
|
| 137 |
+
mental_health_impact = int(rng.random() < params["mental_health_impact"] * (1 + displaced * 0.5))
|
| 138 |
+
|
| 139 |
+
health_system_resilience = float(np.clip(
|
| 140 |
+
0.5
|
| 141 |
+
- facility_damaged * 0.15
|
| 142 |
+
- supply_chain_disrupted * 0.1
|
| 143 |
+
- facility_inaccessible * 0.1
|
| 144 |
+
+ (0.1 if "urban" in setting else 0)
|
| 145 |
+
+ rng.normal(0, 0.05),
|
| 146 |
+
0, 1,
|
| 147 |
+
))
|
| 148 |
+
|
| 149 |
+
adaptation_score = float(np.clip(
|
| 150 |
+
rng.normal(0.3, 0.12) + (0.1 if "urban" in setting else 0),
|
| 151 |
+
0, 1,
|
| 152 |
+
))
|
| 153 |
+
|
| 154 |
+
record = {
|
| 155 |
+
"record_id": f"{name[:3].upper()}-{idx:05d}",
|
| 156 |
+
"scenario": name,
|
| 157 |
+
"year": year,
|
| 158 |
+
"setting": setting,
|
| 159 |
+
"elevation_m": round(elevation_m, 1),
|
| 160 |
+
"slr_rate_mm_per_yr": round(slr_rate, 1),
|
| 161 |
+
"cumulative_slr_cm": round(cumulative_slr_cm, 1),
|
| 162 |
+
"storm_surge": storm_surge,
|
| 163 |
+
"surge_height_m": round(surge_height_m, 1),
|
| 164 |
+
"coastal_erosion_m_per_yr": round(coastal_erosion, 1),
|
| 165 |
+
"flood_risk": round(flood_risk, 2),
|
| 166 |
+
"flooded": flooded,
|
| 167 |
+
"saltwater_intrusion": saltwater_intrusion,
|
| 168 |
+
"facility_at_risk": facility_at_risk,
|
| 169 |
+
"facility_damaged": facility_damaged,
|
| 170 |
+
"facility_inaccessible": facility_inaccessible,
|
| 171 |
+
"supply_chain_disrupted": supply_chain_disrupted,
|
| 172 |
+
"essential_medicine_stockout": essential_medicine_stockout,
|
| 173 |
+
"displaced": displaced,
|
| 174 |
+
"population_exposed": population_exposed,
|
| 175 |
+
"waterborne_disease": waterborne_disease,
|
| 176 |
+
"malaria_case": malaria_case,
|
| 177 |
+
"cholera_outbreak": cholera_outbreak,
|
| 178 |
+
"mental_health_impact": mental_health_impact,
|
| 179 |
+
"health_system_resilience": round(health_system_resilience, 2),
|
| 180 |
+
"adaptation_score": round(adaptation_score, 2),
|
| 181 |
+
}
|
| 182 |
+
records.append(record)
|
| 183 |
+
|
| 184 |
+
return pd.DataFrame(records)
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
def main():
|
| 188 |
+
output_dir = Path("data")
|
| 189 |
+
output_dir.mkdir(parents=True, exist_ok=True)
|
| 190 |
+
for idx, (name, params) in enumerate(SCENARIOS.items()):
|
| 191 |
+
df = _simulate_scenario(name, params, SEED + idx * 211)
|
| 192 |
+
df.to_csv(output_dir / SCENARIO_FILES[name], index=False)
|
| 193 |
+
print(f"Saved {name} -> {SCENARIO_FILES[name]}")
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
if __name__ == "__main__":
|
| 197 |
+
main()
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
numpy>=1.24
|
| 2 |
+
pandas>=2.0
|
| 3 |
+
matplotlib>=3.7
|
validate_dataset.py
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Validate synthetic sea-level rise & coastal health infrastructure dataset."""
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
import matplotlib.pyplot as plt
|
| 8 |
+
import pandas as pd
|
| 9 |
+
|
| 10 |
+
SCENARIO_FILES = {
|
| 11 |
+
"west_africa_delta": "slr_west_africa_delta.csv",
|
| 12 |
+
"east_africa_island": "slr_east_africa_island.csv",
|
| 13 |
+
"southern_coastal_city": "slr_southern_coastal_city.csv",
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
COLORS = {
|
| 17 |
+
"west_africa_delta": "#e6550d",
|
| 18 |
+
"east_africa_island": "#3182bd",
|
| 19 |
+
"southern_coastal_city": "#31a354",
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def load_data() -> pd.DataFrame:
|
| 24 |
+
frames = []
|
| 25 |
+
for scenario, filename in SCENARIO_FILES.items():
|
| 26 |
+
df = pd.read_csv(Path("data") / filename)
|
| 27 |
+
frames.append(df)
|
| 28 |
+
return pd.concat(frames, ignore_index=True)
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def plot_validation(df: pd.DataFrame, output_path: Path) -> None:
|
| 32 |
+
fig, axes = plt.subplots(4, 2, figsize=(14, 16))
|
| 33 |
+
axes = axes.flatten()
|
| 34 |
+
|
| 35 |
+
# Panel 1: Flood risk by scenario
|
| 36 |
+
for s in SCENARIO_FILES:
|
| 37 |
+
subset = df[df["scenario"] == s]
|
| 38 |
+
axes[0].hist(subset["flood_risk"], bins=25, alpha=0.5, color=COLORS[s], label=s)
|
| 39 |
+
axes[0].set_title("Flood Risk Distribution by Scenario")
|
| 40 |
+
axes[0].set_xlabel("Flood risk")
|
| 41 |
+
axes[0].legend(fontsize=7)
|
| 42 |
+
|
| 43 |
+
# Panel 2: Health impacts
|
| 44 |
+
health_cols = ["waterborne_disease", "malaria_case", "cholera_outbreak", "mental_health_impact"]
|
| 45 |
+
rates = df.groupby("scenario")[health_cols].mean() * 100
|
| 46 |
+
rates.plot(kind="bar", ax=axes[1])
|
| 47 |
+
axes[1].set_title("Health Impact Rates (%)")
|
| 48 |
+
axes[1].set_ylabel("Percent")
|
| 49 |
+
axes[1].legend(fontsize=7)
|
| 50 |
+
|
| 51 |
+
# Panel 3: Facility damage & inaccessibility
|
| 52 |
+
fac_cols = ["facility_at_risk", "facility_damaged", "facility_inaccessible"]
|
| 53 |
+
fac_rates = df.groupby("scenario")[fac_cols].mean() * 100
|
| 54 |
+
fac_rates.plot(kind="bar", ax=axes[2])
|
| 55 |
+
axes[2].set_title("Health Facility Risk (%)")
|
| 56 |
+
axes[2].set_ylabel("Percent")
|
| 57 |
+
axes[2].legend(fontsize=7)
|
| 58 |
+
|
| 59 |
+
# Panel 4: Elevation vs flood risk
|
| 60 |
+
for s in SCENARIO_FILES:
|
| 61 |
+
subset = df[df["scenario"] == s]
|
| 62 |
+
axes[3].scatter(subset["elevation_m"], subset["flood_risk"], s=6, alpha=0.15, color=COLORS[s], label=s)
|
| 63 |
+
axes[3].set_title("Elevation vs Flood Risk")
|
| 64 |
+
axes[3].set_xlabel("Elevation (m)")
|
| 65 |
+
axes[3].set_ylabel("Flood risk")
|
| 66 |
+
axes[3].legend(fontsize=7)
|
| 67 |
+
|
| 68 |
+
# Panel 5: Supply chain disruption
|
| 69 |
+
sc_cols = ["supply_chain_disrupted", "essential_medicine_stockout"]
|
| 70 |
+
sc_rates = df.groupby("scenario")[sc_cols].mean() * 100
|
| 71 |
+
sc_rates.plot(kind="bar", ax=axes[4])
|
| 72 |
+
axes[4].set_title("Supply Chain Disruption (%)")
|
| 73 |
+
axes[4].set_ylabel("Percent")
|
| 74 |
+
axes[4].legend(fontsize=7)
|
| 75 |
+
|
| 76 |
+
# Panel 6: Health system resilience
|
| 77 |
+
res_data = [df[df["scenario"] == s]["health_system_resilience"] for s in SCENARIO_FILES]
|
| 78 |
+
bp = axes[5].boxplot(res_data, tick_labels=SCENARIO_FILES.keys(), patch_artist=True)
|
| 79 |
+
for patch, s in zip(bp["boxes"], SCENARIO_FILES.keys()):
|
| 80 |
+
patch.set_facecolor(COLORS[s])
|
| 81 |
+
patch.set_alpha(0.6)
|
| 82 |
+
axes[5].set_title("Health System Resilience Score")
|
| 83 |
+
axes[5].set_ylabel("Score")
|
| 84 |
+
|
| 85 |
+
# Panel 7: Cumulative SLR trend
|
| 86 |
+
yearly = df.groupby(["scenario", "year"])["cumulative_slr_cm"].mean().reset_index()
|
| 87 |
+
for s in SCENARIO_FILES:
|
| 88 |
+
sub = yearly[yearly["scenario"] == s]
|
| 89 |
+
axes[6].plot(sub["year"], sub["cumulative_slr_cm"], marker="o", color=COLORS[s], label=s)
|
| 90 |
+
axes[6].set_title("Cumulative Sea-Level Rise Trend")
|
| 91 |
+
axes[6].set_xlabel("Year")
|
| 92 |
+
axes[6].set_ylabel("Cumulative SLR (cm)")
|
| 93 |
+
axes[6].legend(fontsize=7)
|
| 94 |
+
|
| 95 |
+
# Panel 8: Adaptation score
|
| 96 |
+
adapt_data = [df[df["scenario"] == s]["adaptation_score"] for s in SCENARIO_FILES]
|
| 97 |
+
bp2 = axes[7].boxplot(adapt_data, tick_labels=SCENARIO_FILES.keys(), patch_artist=True)
|
| 98 |
+
for patch, s in zip(bp2["boxes"], SCENARIO_FILES.keys()):
|
| 99 |
+
patch.set_facecolor(COLORS[s])
|
| 100 |
+
patch.set_alpha(0.6)
|
| 101 |
+
axes[7].set_title("Adaptation Score by Scenario")
|
| 102 |
+
axes[7].set_ylabel("Score")
|
| 103 |
+
|
| 104 |
+
plt.tight_layout()
|
| 105 |
+
fig.savefig(output_path, dpi=200)
|
| 106 |
+
plt.close(fig)
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def main() -> None:
|
| 110 |
+
df = load_data()
|
| 111 |
+
output_path = Path("validation_report.png")
|
| 112 |
+
plot_validation(df, output_path)
|
| 113 |
+
print(f"Saved {output_path}")
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
if __name__ == "__main__":
|
| 117 |
+
main()
|
validation_report.png
ADDED
|
Git LFS Details
|