
Process EM-DAT Flood and Tropical-Cyclone Events Into Country-Week Panels
Source:R/process_EMDAT_data.R
process_EMDAT_data.RdReads the most recent EM-DAT public-extract xlsx file in
PATHS$DATA_EMDAT_RAW, filters to (a) flood events and (b)
tropical-cyclone / storm-surge events in MOSAIC AFRO countries, expands
each event across the ISO-8601 weeks it spans, and writes two complete
country-week panels of hazard-occurrence covariates:
PATHS$DATA_EMDAT/floods_country_weekly.csv and
PATHS$DATA_EMDAT/cyclones_country_weekly.csv.
Arguments
- PATHS
A list of paths generated by
get_paths(). Must include:DATA_EMDAT_RAW: Path to
MOSAIC-data/raw/EMDAT.DATA_EMDAT: Path to the processed output directory (
MOSAIC-data/processed/EMDAT/weekly).
Value
Invisibly returns a named character vector with the paths to the
two written CSVs (flood and cyclone). Each CSV contains
one row per (iso_code, year, week) for every ISO-week between
date_start (default 2000-01-03) and the latest week covered by
any event of that hazard in the raw extract, restricted to
iso_codes_mosaic. Flood columns:
- iso_code
ISO3 country code.
- year
ISO-8601 year of the week.
- week
ISO-8601 week number (1-53).
- date_start
Monday of the ISO-week.
- date_stop
Sunday of the ISO-week.
- emdat_flood_active
1 if any flood event overlaps the week, else 0.
- emdat_flood_new
Number of flood events that start in this week.
- emdat_flood_affected
log1pof summedTotal Affectedacross overlapping events (NAs treated as 0).- emdat_flood_deaths
log1pof summedTotal Deathsacross overlapping events (NAs treated as 0).
The cyclone CSV mirrors this schema with emdat_cyclone_active,
emdat_cyclone_new, emdat_cyclone_affected, and
emdat_cyclone_deaths.
Details
The flood label is unchanged (Disaster Type == "Flood"). The
cyclone label is a SEPARATE series built from Disaster Type ==
"Storm" restricted to
Disaster Subtype %in% c("Tropical cyclone", "Storm surge") – the crisply-dated, water-producing storm
events (49 events / ~74 active weeks in the 2026-05 extract). Storm
(General), Severe weather, Lightning/Thunderstorms, Tornado, Hail, and
Blizzard/Winter storm are deliberately EXCLUDED: they are not reliably
water-producing and would dilute the cyclone signal. Tropical cyclones
were previously silently dropped by the flood-only filter, neutering the
downstream flood GAM's wind smooth; the separate cyclone series feeds a
dedicated wind/coastal GAM (impute_cyclone_probability).
EM-DAT records carry frequent missing day-of-month and occasional missing end-month values. Imputation rules:
Missing
Start DayorEnd Day-> 15.Missing
End Month->Start Month.Missing
End Year->Start Year.If the resulting
end_dateis earlier thanstart_date(data-entry artifact), it is reset tostart_date.
Each event is expanded to the unique set of ISO-8601 (year, week) pairs
touched by the daily date range start_date:end_date. The panel
grid is the full Cartesian product of iso_codes_mosaic and all
ISO-weeks from date_start through the latest event end-week; cells
with no flood activity carry zeros, so a downstream left-join against
the suitability table does not need to impute missingness.
EM-DAT only records events meeting CRED's inclusion thresholds (>=10 deaths, >=100 affected, or formal emergency declaration), so this covariate captures major flood occurrences rather than continuous flood intensity. The richer continuous signal lives in the OpenMeteo precipitation/anomaly covariates.