Datasets:
Upload folder using huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- tabular-classification
|
| 5 |
+
- tabular-regression
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
tags:
|
| 9 |
+
- climate
|
| 10 |
+
- environment
|
| 11 |
+
- africa
|
| 12 |
+
- synthetic-data
|
| 13 |
+
- sub-saharan-africa
|
| 14 |
+
- drought
|
| 15 |
+
- flood
|
| 16 |
+
- disaster-impact
|
| 17 |
+
- climate-disasters
|
| 18 |
+
size_categories:
|
| 19 |
+
- 10K<n<100K
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
# Drought and Flood Impact - Africa
|
| 23 |
+
|
| 24 |
+
A comprehensive synthetic dataset documenting drought and flood events, their severity, impacts, and recovery metrics across Sub-Saharan African countries.
|
| 25 |
+
|
| 26 |
+
## Dataset Description
|
| 27 |
+
|
| 28 |
+
This dataset provides detailed records of drought and flood events across 15 Sub-Saharan African countries. It includes event characteristics, population impacts, economic damages, early warning indicators, and recovery progress. Data is stratified by malnutrition burden levels to analyze disaster-nutrition linkages.
|
| 29 |
+
|
| 30 |
+
### Key Statistics
|
| 31 |
+
|
| 32 |
+
| Metric | Value |
|
| 33 |
+
|--------|-------|
|
| 34 |
+
| Total Records | 14,998 |
|
| 35 |
+
| Countries Covered | 15 |
|
| 36 |
+
| Time Period | 2018-2025 |
|
| 37 |
+
| Files | 3 (high_burden, moderate_burden, low_burden) |
|
| 38 |
+
| Features | 31 |
|
| 39 |
+
|
| 40 |
+
### Countries Included
|
| 41 |
+
DRC, Ethiopia, Ghana, Kenya, Malawi, Mali, Mozambique, Niger, Nigeria, Rwanda, Senegal, South Africa, Tanzania, Uganda, Zambia
|
| 42 |
+
|
| 43 |
+
## Column Descriptions
|
| 44 |
+
|
| 45 |
+
| Column | Type | Description |
|
| 46 |
+
|--------|------|-------------|
|
| 47 |
+
| record_id | string | Unique identifier (DF_XXXXXX) |
|
| 48 |
+
| country | string | African country name |
|
| 49 |
+
| year | int | Year of event (2018-2025) |
|
| 50 |
+
| event_type | string | Type of event (drought/flood) |
|
| 51 |
+
| event_subtype | string | Specific event classification |
|
| 52 |
+
| event_duration_days | int | Duration in days |
|
| 53 |
+
| rainfall_deficit_pct | float | Rainfall deviation from normal (%) |
|
| 54 |
+
| severity_index | float | Composite severity score (0-10) |
|
| 55 |
+
| severity_category | string | Severity classification |
|
| 56 |
+
| affected_area_km2 | float | Geographic extent (km²) |
|
| 57 |
+
| population_affected | int | Number of people affected |
|
| 58 |
+
| population_displaced | int | Number of people displaced |
|
| 59 |
+
| deaths | int | Number of deaths |
|
| 60 |
+
| injuries | int | Number of injuries |
|
| 61 |
+
| housing_destroyed | int | Houses destroyed |
|
| 62 |
+
| housing_damaged | int | Houses damaged |
|
| 63 |
+
| agricultural_land_affected_ha | float | Agricultural land impacted (hectares) |
|
| 64 |
+
| crop_loss_value_usd | float | Value of crop losses (USD) |
|
| 65 |
+
| livestock_loss_heads | int | Livestock lost (heads) |
|
| 66 |
+
| infrastructure_damage_usd | float | Infrastructure damage (USD) |
|
| 67 |
+
| total_economic_damage_usd | float | Total economic damage (USD) |
|
| 68 |
+
| damage_gdp_pct | float | Damage as % of GDP |
|
| 69 |
+
| early_warning_issued | int | Whether early warning was issued (0/1) |
|
| 70 |
+
| warning_lead_time_hours | int | Warning lead time (hours) |
|
| 71 |
+
| emergency_response_activated | int | Emergency response status (0/1) |
|
| 72 |
+
| response_time_hours | int | Response time (hours) |
|
| 73 |
+
| international_aid_requested | int | Whether aid was requested (0/1) |
|
| 74 |
+
| international_aid_received_usd | float | International aid received (USD) |
|
| 75 |
+
| recovery_duration_months | int | Recovery duration (months) |
|
| 76 |
+
| recovery_progress_pct | float | Recovery progress (%) |
|
| 77 |
+
| long_term_displacement_risk | float | Risk of permanent displacement (0-1) |
|
| 78 |
+
|
| 79 |
+
### Event Types
|
| 80 |
+
- drought (meteorological, agricultural, hydrological)
|
| 81 |
+
- flood (flash, riverine, coastal)
|
| 82 |
+
|
| 83 |
+
### Severity Categories
|
| 84 |
+
- Minor, Moderate, Severe, Extreme, Catastrophic
|
| 85 |
+
|
| 86 |
+
## Usage Example
|
| 87 |
+
|
| 88 |
+
```python
|
| 89 |
+
import pandas as pd
|
| 90 |
+
|
| 91 |
+
# Load high burden dataset
|
| 92 |
+
df = pd.read_csv('drought_flood_impact_africa_high_burden.csv')
|
| 93 |
+
|
| 94 |
+
# Analyze by event type
|
| 95 |
+
event_impacts = df.groupby('event_type')['total_economic_damage_usd'].sum()
|
| 96 |
+
print(event_impacts)
|
| 97 |
+
|
| 98 |
+
# Filter catastrophic events
|
| 99 |
+
catastrophic = df[df['severity_category'] == 'Catastrophic']
|
| 100 |
+
|
| 101 |
+
# Calculate average recovery by severity
|
| 102 |
+
recovery_analysis = df.groupby('severity_category')['recovery_duration_months'].mean()
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
## Research Sources
|
| 106 |
+
|
| 107 |
+
This synthetic dataset is inspired by and aligned with data from:
|
| 108 |
+
- [EM-DAT International Disaster Database](https://www.emdat.be/)
|
| 109 |
+
- [FEWS NET](https://fews.net/)
|
| 110 |
+
- [Global Flood Awareness System](https://www.globalfloods.eu/)
|
| 111 |
+
- [UNDRR Disaster Data](https://www.undrr.org/)
|
drought_flood_impact_africa_high_burden.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
drought_flood_impact_africa_low_burden.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
drought_flood_impact_africa_moderate_burden.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
generate_dataset.py
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Drought and Flood Impact Dataset Generator for Africa
|
| 3 |
+
|
| 4 |
+
================================================================================
|
| 5 |
+
PARAMETER EVIDENCE TABLE
|
| 6 |
+
================================================================================
|
| 7 |
+
| Parameter | Value/Range | Source |
|
| 8 |
+
|------------------------------|-----------------------|--------------------------|
|
| 9 |
+
| Drought events (2015-2023) | 171 recorded | EM-DAT 2024 |
|
| 10 |
+
| Flood events (2015-2023) | 456 recorded | EM-DAT 2024 |
|
| 11 |
+
| Horn of Africa drought | 5 consecutive seasons | WMO 2024 |
|
| 12 |
+
| Economic loss (drought) | $30B (2018-2023) | AUC 2024 |
|
| 13 |
+
| Population affected drought | 150M (2020-2023) | OCHA 2024 |
|
| 14 |
+
| Flood displacement | 6.3M (2022 alone) | IDMC 2023 |
|
| 15 |
+
| Cyclone Idai damage | $2.2B (Mozambique) | World Bank 2019 |
|
| 16 |
+
| Recovery time average | 3-7 years | UNDRR 2024 |
|
| 17 |
+
================================================================================
|
| 18 |
+
|
| 19 |
+
DAG Structure:
|
| 20 |
+
climate_conditions -> event_type -> severity -> damage_assessment
|
| 21 |
+
vulnerability_factors -> impact_magnitude
|
| 22 |
+
infrastructure_resilience -> recovery_trajectory
|
| 23 |
+
response_capacity -> recovery_duration
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
import numpy as np
|
| 27 |
+
import pandas as pd
|
| 28 |
+
from pathlib import Path
|
| 29 |
+
|
| 30 |
+
COUNTRIES = [
|
| 31 |
+
"Kenya", "Uganda", "Nigeria", "Ghana", "Tanzania", "Ethiopia",
|
| 32 |
+
"Malawi", "Zambia", "Senegal", "Rwanda", "Niger", "Mali",
|
| 33 |
+
"DRC", "Mozambique", "South Africa"
|
| 34 |
+
]
|
| 35 |
+
|
| 36 |
+
YEARS = list(range(2018, 2026))
|
| 37 |
+
|
| 38 |
+
EVENT_TYPES = ["drought", "flood", "flash_flood", "riverine_flood", "cyclone"]
|
| 39 |
+
|
| 40 |
+
COUNTRY_EVENT_PROBABILITY = {
|
| 41 |
+
"Niger": {"drought": 0.625, "flood": 0.375},
|
| 42 |
+
"Mali": {"drought": 0.64, "flood": 0.36},
|
| 43 |
+
"Ethiopia": {"drought": 0.58, "flood": 0.42},
|
| 44 |
+
"Kenya": {"drought": 0.54, "flood": 0.46},
|
| 45 |
+
"Mozambique": {"drought": 0.22, "flood": 0.50, "cyclone": 0.28},
|
| 46 |
+
"Malawi": {"drought": 0.38, "flood": 0.62},
|
| 47 |
+
"DRC": {"drought": 0.25, "flood": 0.75},
|
| 48 |
+
"Tanzania": {"drought": 0.42, "flood": 0.58},
|
| 49 |
+
"Uganda": {"drought": 0.33, "flood": 0.67},
|
| 50 |
+
"Zambia": {"drought": 0.58, "flood": 0.42},
|
| 51 |
+
"Ghana": {"drought": 0.30, "flood": 0.70},
|
| 52 |
+
"Nigeria": {"drought": 0.33, "flood": 0.67},
|
| 53 |
+
"Senegal": {"drought": 0.58, "flood": 0.42},
|
| 54 |
+
"Rwanda": {"drought": 0.30, "flood": 0.70},
|
| 55 |
+
"South Africa": {"drought": 0.55, "flood": 0.45},
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
def generate_dataset(scenario: str, n_samples: int, seed: int) -> pd.DataFrame:
|
| 59 |
+
rng = np.random.default_rng(seed)
|
| 60 |
+
|
| 61 |
+
burden_mod = {"low_burden": 0.7, "moderate_burden": 1.0, "high_burden": 1.5}[scenario]
|
| 62 |
+
|
| 63 |
+
countries = rng.choice(COUNTRIES, size=n_samples)
|
| 64 |
+
years = rng.choice(YEARS, size=n_samples)
|
| 65 |
+
|
| 66 |
+
data = {
|
| 67 |
+
"record_id": [f"DF_{i:06d}" for i in range(n_samples)],
|
| 68 |
+
"country": countries,
|
| 69 |
+
"year": years,
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
event_types = []
|
| 73 |
+
for c in countries:
|
| 74 |
+
probs = COUNTRY_EVENT_PROBABILITY.get(c, {"drought": 0.40, "flood": 0.60})
|
| 75 |
+
event_types.append(rng.choice(list(probs.keys()), p=list(probs.values())))
|
| 76 |
+
data["event_type"] = event_types
|
| 77 |
+
data["event_subtype"] = np.select(
|
| 78 |
+
[np.array(event_types) == "flood", np.array(event_types) == "drought"],
|
| 79 |
+
[rng.choice(["riverine", "flash", "coastal"], n_samples, p=[0.5, 0.35, 0.15]),
|
| 80 |
+
rng.choice(["meteorological", "agricultural", "hydrological"], n_samples, p=[0.4, 0.35, 0.25])],
|
| 81 |
+
rng.choice(["tropical_storm", "cyclone", "severe_storm"], n_samples)
|
| 82 |
+
)
|
| 83 |
+
|
| 84 |
+
data["event_duration_days"] = np.select(
|
| 85 |
+
[np.array(event_types) == "drought",
|
| 86 |
+
np.array(event_types) == "flood",
|
| 87 |
+
np.array(event_types) == "cyclone"],
|
| 88 |
+
[rng.integers(60, 365, n_samples),
|
| 89 |
+
rng.integers(3, 30, n_samples),
|
| 90 |
+
rng.integers(1, 7, n_samples)]
|
| 91 |
+
)
|
| 92 |
+
|
| 93 |
+
data["rainfall_deficit_pct" if "drought" else "rainfall_excess_pct"] = np.select(
|
| 94 |
+
[np.array(event_types) == "drought", np.array(event_types) != "drought"],
|
| 95 |
+
[rng.integers(30, 80, n_samples) * burden_mod,
|
| 96 |
+
rng.integers(100, 400, n_samples) * burden_mod]
|
| 97 |
+
)
|
| 98 |
+
|
| 99 |
+
data["severity_index"] = np.clip(
|
| 100 |
+
rng.beta(2, 5, n_samples) * 10 * burden_mod, 1, 10
|
| 101 |
+
).round(2)
|
| 102 |
+
|
| 103 |
+
severity = data["severity_index"]
|
| 104 |
+
data["severity_category"] = np.select(
|
| 105 |
+
[severity < 3, severity < 5, severity < 7, severity < 9, severity >= 9],
|
| 106 |
+
["Minor", "Moderate", "Severe", "Extreme", "Catastrophic"]
|
| 107 |
+
)
|
| 108 |
+
|
| 109 |
+
data["affected_area_km2"] = np.clip(
|
| 110 |
+
rng.exponential(5000, n_samples) * (severity / 5) * burden_mod, 100, 500000
|
| 111 |
+
).astype(int)
|
| 112 |
+
|
| 113 |
+
data["population_affected"] = np.clip(
|
| 114 |
+
data["affected_area_km2"] * rng.exponential(50, n_samples) *
|
| 115 |
+
(severity / 5) * burden_mod, 1000, 25000000
|
| 116 |
+
).astype(int)
|
| 117 |
+
|
| 118 |
+
data["population_displaced"] = np.clip(
|
| 119 |
+
data["population_affected"] * rng.uniform(0.05, 0.35, n_samples) *
|
| 120 |
+
(severity / 5), 100, 5000000
|
| 121 |
+
).astype(int)
|
| 122 |
+
|
| 123 |
+
data["deaths"] = np.clip(
|
| 124 |
+
rng.poisson(50, n_samples) * (severity / 5) * burden_mod, 0, 5000
|
| 125 |
+
).astype(int)
|
| 126 |
+
|
| 127 |
+
data["injuries"] = np.clip(
|
| 128 |
+
data["deaths"] * rng.uniform(2, 8, n_samples), 0, 30000
|
| 129 |
+
).astype(int)
|
| 130 |
+
|
| 131 |
+
data["housing_destroyed"] = np.clip(
|
| 132 |
+
data["population_displaced"] * rng.uniform(0.2, 0.6, n_samples), 0, 500000
|
| 133 |
+
).astype(int)
|
| 134 |
+
|
| 135 |
+
data["housing_damaged"] = np.clip(
|
| 136 |
+
data["housing_destroyed"] * rng.uniform(1.5, 4, n_samples), 0, 1500000
|
| 137 |
+
).astype(int)
|
| 138 |
+
|
| 139 |
+
data["agricultural_land_affected_ha"] = np.clip(
|
| 140 |
+
data["affected_area_km2"] * 100 * rng.uniform(0.1, 0.5, n_samples), 100, 5000000
|
| 141 |
+
).astype(int)
|
| 142 |
+
|
| 143 |
+
data["crop_loss_value_usd"] = np.clip(
|
| 144 |
+
data["agricultural_land_affected_ha"] * rng.uniform(200, 800, n_samples) *
|
| 145 |
+
(severity / 5), 10000, 5000000000
|
| 146 |
+
).astype(int)
|
| 147 |
+
|
| 148 |
+
data["livestock_loss_heads"] = np.clip(
|
| 149 |
+
rng.poisson(1000, n_samples) * (severity / 3) * burden_mod, 0, 500000
|
| 150 |
+
).astype(int)
|
| 151 |
+
|
| 152 |
+
data["infrastructure_damage_usd"] = np.clip(
|
| 153 |
+
data["affected_area_km2"] * rng.uniform(5000, 50000, n_samples) *
|
| 154 |
+
(severity / 5), 100000, 10000000000
|
| 155 |
+
).astype(int)
|
| 156 |
+
|
| 157 |
+
data["total_economic_damage_usd"] = (
|
| 158 |
+
data["crop_loss_value_usd"] +
|
| 159 |
+
data["infrastructure_damage_usd"] +
|
| 160 |
+
data["housing_destroyed"] * rng.uniform(5000, 20000, n_samples)
|
| 161 |
+
).astype(int)
|
| 162 |
+
|
| 163 |
+
data["damage_gdp_pct"] = np.clip(
|
| 164 |
+
data["total_economic_damage_usd"] / 1e9 * rng.uniform(0.5, 2, n_samples), 0.1, 25
|
| 165 |
+
).round(2)
|
| 166 |
+
|
| 167 |
+
data["early_warning_issued"] = rng.choice([0, 1], size=n_samples, p=[0.3, 0.7])
|
| 168 |
+
data["warning_lead_time_hours"] = np.where(
|
| 169 |
+
data["early_warning_issued"] == 1,
|
| 170 |
+
np.clip(rng.exponential(48, n_samples), 1, 168).astype(int),
|
| 171 |
+
0
|
| 172 |
+
)
|
| 173 |
+
|
| 174 |
+
data["emergency_response_activated"] = rng.choice([0, 1], size=n_samples, p=[0.25, 0.75])
|
| 175 |
+
data["response_time_hours"] = np.where(
|
| 176 |
+
data["emergency_response_activated"] == 1,
|
| 177 |
+
np.clip(rng.exponential(36, n_samples), 2, 120).astype(int),
|
| 178 |
+
0
|
| 179 |
+
)
|
| 180 |
+
|
| 181 |
+
data["international_aid_requested"] = rng.choice([0, 1], size=n_samples, p=[0.6, 0.4])
|
| 182 |
+
data["international_aid_received_usd"] = np.where(
|
| 183 |
+
data["international_aid_requested"] == 1,
|
| 184 |
+
np.clip(data["total_economic_damage_usd"] * rng.uniform(0.02, 0.15, n_samples),
|
| 185 |
+
100000, 500000000).astype(int),
|
| 186 |
+
0
|
| 187 |
+
)
|
| 188 |
+
|
| 189 |
+
data["recovery_duration_months"] = np.clip(
|
| 190 |
+
(severity * 3 + rng.integers(3, 12, n_samples)) *
|
| 191 |
+
(1 - data["international_aid_received_usd"] / (data["total_economic_damage_usd"] + 1) * 0.3),
|
| 192 |
+
1, 84
|
| 193 |
+
).astype(int)
|
| 194 |
+
|
| 195 |
+
data["recovery_progress_pct"] = np.clip(
|
| 196 |
+
100 - (severity * 5) + rng.integers(-10, 20, n_samples), 10, 100
|
| 197 |
+
).astype(int)
|
| 198 |
+
|
| 199 |
+
data["long_term_displacement_risk"] = np.clip(
|
| 200 |
+
data["population_displaced"] / (data["population_affected"] + 1) *
|
| 201 |
+
(1 - data["recovery_progress_pct"] / 150), 0, 1
|
| 202 |
+
).round(3)
|
| 203 |
+
|
| 204 |
+
return pd.DataFrame(data)
|
| 205 |
+
|
| 206 |
+
def main():
|
| 207 |
+
output_dir = Path(__file__).parent
|
| 208 |
+
|
| 209 |
+
scenarios = [
|
| 210 |
+
("low_burden", 4000, 42),
|
| 211 |
+
("moderate_burden", 5000, 43),
|
| 212 |
+
("high_burden", 6000, 44),
|
| 213 |
+
]
|
| 214 |
+
|
| 215 |
+
for scenario, n, seed in scenarios:
|
| 216 |
+
df = generate_dataset(scenario, n, seed)
|
| 217 |
+
output_file = output_dir / f"drought_flood_impact_africa_{scenario}.csv"
|
| 218 |
+
df.to_csv(output_file, index=False)
|
| 219 |
+
print(f"Generated {output_file}: {len(df)} records")
|
| 220 |
+
|
| 221 |
+
if __name__ == "__main__":
|
| 222 |
+
main()
|