
This repository contains a Google Earth Engine (GEE) script developed to extract spatially explicit rainfall anomaly indicators at Demographic and Health Survey (DHS) cluster locations for Sierra Leone. The script is a modified version of an earlier repository that included lagged exposure windows. In this version, all lag periods have been removed. Climate variables are extracted for the survey year only (2008, 2013, and 2019).
The script integrates daily Climate Hazards Group InfraRed Precipitation with Stations (CHIRPS) precipitation data to construct a set of rainfall indicators for each survey year. Extreme thresholds are defined using both absolute cutoffs (for example, rainfall above 10 mm for heavy rain days and above 20 mm for very heavy rain days) and anomaly measures derived from a long-term baseline period spanning 1990 to 2020. The baseline is computed using annual precipitation totals across that 31-year period, from which a median and standard deviation are derived. These are used to calculate absolute, standardised, and percentage anomalies for each survey year.
The following rainfall indicators are extracted for each survey year:
The script also extracts a set of geographic and socioeconomic control variables at each cluster: elevation, terrain slope, distance to the coastline, travel time to urban centres, and population density. Spatial discontinuity variables are included, specifically terrain aspect, a windward indicator based on southwest monsoon direction, and a monsoon exposure intensity index.
Soil quality variables are drawn from SoilGrids ISRIC at the 0–5 cm depth layer and include sand content, clay content, soil organic carbon, soil pH, and a composite soil quality index. Market access variables are derived from the Global Roads Inventory Project version 4 (GRIP4) Africa dataset and include distance to any road, distance to major roads (highway, primary, or secondary), and a road density index. Historical infrastructure variables are sourced from the Defence Meteorological Satellite Program Operational Linescan System (DMSP-OLS) nighttime lights archive and include stable lights in 1992, mean nighttime light intensity in the five years prior to each survey, the change in nighttime lights since 1992, cumulative nighttime lights from 1992 to the survey year, and distance to colonial-era roads (GRIP4 road types 1 and 2).
All climate and geographic variables are spatially aggregated within a 10 km buffer around each DHS cluster centroid, using the median reducer at a 5 km spatial scale. This buffer accounts for the standard random displacement applied to DHS cluster coordinates and captures local exposure conditions.
The final output is a harmonised, cluster-level CSV dataset structured for econometric analysis of climate impacts on household welfare, with direct applicability to gender-disaggregated studies in data-scarce and post-conflict settings.
The script was developed with the assistance of artificial intelligence tools and subsequently reviewed, modified, and fully supervised by the author. All methodological decisions, variable definitions, and analytical logic were designed and validated by the author.