Code and data links for Schwarzwald and Lenssen (2022), published at PNAS.
All code needed to replicate Schwarzwald and Lenssen is saved in the code/ directory above. To make the code work locally:
- Create a new environment using the provided
iv_impact_env.yamlfile (using the commandconda env create -f environment.yml) - Set all paths to data in the
dir_list.csvfile:obs: where observational data (ERA-INTERIM, in this case) are stored. The code will look for files in a sub-directory named after the data product (i.e.,ERA-INTERIM/).mod: where climate model data (CMIP5, LEs, in this case) are stored. The code will look for files in sub-directories named after each climate model (i.e.,CESM1-CAM5-LE).proc: where processed climate data (climate projections, etc.) will be saved. The code will save files in sub-directories named after the historical data product (i.e.,ERA-INTERIM/), since all calculations are done on projections of that historical data product. Will be generated by the code if this path doesn't exist.impact: where files for projected climate impacts are saved. The code will save files in sub-directories named after the historical data product (i.e.,ERA-INTERIM/), since all calculations are done on projections of that historical data product. Will be generated by the code if this path doesn't exist.aux: where certain auxiliary files are saved. Will be generated by the code if this path doesn't exist.geo: where county-level shapefiles are stored, includingUScounties_proc.shp, the generated shapefile that includes all historical county-level impact variables.pop: where population, GDP per capita, and corn yield data are stored.figs: where figures are saved. Will be generated by the code if this path doesn't exist.
- Run through the code step-by-step using
master_run.ipynbto generate results and figures.
NB: the code directory also includes create_data_counties.ipynb which details how mortality, GDP, and corn yields were assigned to a single county file. This is just for reference; the county file (UScounties_proc.shp) has already been generated and is available at the data link below.
The base data needed to replicate this study are available at this permanent location. All other files can be generated from these data using the code above.
The Google Drive link contains:
climate_raw: All raw climate data used in this study. Data has been downloaded from the ESGF or the Large Ensemble Archive, and preprocessed by stitching together historical and future climate runs into single files. The path to this directory should be used for bothobsandmodindir_list.csv.geo_data: The raw and processed US county shapefiles used in this study.UScounties_proc.shphas been pre-generated; otherwise it can be regenerated through the raw county shapefile in this document and the files inpop_datausing thecreate_data_counties.ipynbnotebook. The path to this directory should be used forgeoindir_list.csv.pop_data: The raw mortality, GDP, and corn yield databases used in this study. See main text for data citations. These are used to generateUScounties_proc.shp(which is also included). The path to this directory should be used forpopindir_list.csv.