Example #2
-August, 2024
+November 2024
Source:vignettes/articles/Example2.Rmd
Example2.Rmd
Step 1. Install FrEDI
R packageInstalling & Running FrEDI page.
Load package
-## Warning: package 'tidyverse' was built under R version 4.4.1
-## Warning: package 'ggplot2' was built under R version 4.4.1
-## Warning: package 'tibble' was built under R version 4.4.1
-## Warning: package 'tidyr' was built under R version 4.4.1
-## Warning: package 'readr' was built under R version 4.4.1
-## Warning: package 'purrr' was built under R version 4.4.1
-## Warning: package 'dplyr' was built under R version 4.4.1
-## Warning: package 'stringr' was built under R version 4.4.1
-## Warning: package 'forcats' was built under R version 4.4.1
-## Warning: package 'lubridate' was built under R version 4.4.1
+require(FrEDI)
After successfully installing
FrEDI
, documentation for FrEDI
functions
can be accessed in the same way as for other R
@@ -155,9 +145,11 @@
Step 1. Install FrEDI
R package into an
-R
console, where functionName is the name of one
-of the functions in FrEDI
(e.g.,
-help("aggregate_impacts", package="FrEDI")
).
+R
console, where *functionName*
is the name of
+one of the functions in FrEDI
(e.g.,
+help("aggregate_impacts", package="FrEDI")
). Alternatively,
+use the syntax ?FrEDI::*functionName*
(e.g.,
+?FrEDI::run_fredi_sv()
).
If FrEDI
has been installed, users can also search for
function-specific documentation in RStudio through the Help
window. Move the focus to the Help window using the
@@ -174,29 +166,50 @@
Step 2. Set FrEDI_SV
Runtime parameters
-# To run FrEDI_SV for more than one scenario, the code below can be
-# adapted into a loop to format the inputs for each scenario.
+
+### To run FrEDI_SV for more than one scenario, the code below can be
+### adapted into a loop to format the inputs for each scenario.
-#***********************************************
-#1. Specify & Format Input Trajectories (temperature, population, U.S. GDP)
+###***********************************************
+### 1. Specify & Format Input Trajectories (temperature, population, U.S. GDP)
-## Input Files
+### Input Files
+### Population input file
+### - Purpose: Specify the population trajectory to use as an input.
+### - Requires columns year, region, state, postal, and pop
+### - Default: if null, uses default population trajectory
+popInputFile <- NULL
+
+### * Temperature input file
+### - Description: csv file with time series of temperature relative to 1986-2005 average
+### - (units: degC, values: >=0)
+### - Data must start in 2000 or earlier and can be global or CONUS
+### - If global, must convert to CONUS temperature using the import_inputs() helper function
+### - Contains columns year, temp_C, scenario
tempInputFile <- NULL
-# Description: csv file with time series of temperature relative to 1986-2005 average
-# (units: degC, values: >=0)
-# data must start in 2000 or earlier and can be global or CONUS
-# If global --> must convert to CONUS temperature using the import_inputs() helper function
-# column 1 = 'year', column 2 = 'temp_C'
-temptypeflag <- 'global'
-# Description: Use this to specify whether the input temperature is global or CONUS
-# import_inputs() will convert to global to CONUS temperature
-# Options: global (input is global T), conus (input is CONUS T)
+### * Temperature type flag
+### - Description: Use this to specify whether the input temperature is global or CONUS
+### - import_inputs() will convert to global to CONUS temperature
+### - Options: global (input is global T), conus (input is CONUS T)
+### - Default: defaults to "conus"
+temptypeflag <- "global"
+### * Module flag
+### - Description: Use this to specify for which module to import inputs
+### - Options: fredi/methane/sv
+### - Default: Defaults to "fredi" if NULL
+moduleflag <- "sv"
-## Use the import_inputs() helper function to format the input trajectories for use in FrEDI
-inputs_list <- import_inputs(tempfile = tempInputFile)
+### Use the import_inputs() helper function to format the input trajectories for use in FrEDI
+inputs_list <- import_inputs(inputsList = list(
+ pop = popInputFile,
+ temp = tempInputFile
+ ),
+ module = moduleflag
+)
+inputs_list |> glimpse()
+## list()
If no input files are specified, run_fredi_sv()
will use
default temperature and U.S. regional population projections. In this
case, run_fredi_sv()
will calculate annual projected sea
@@ -211,43 +224,24 @@
Step 2. Set FrEDI_SV
Runtime parameters
-# Calculate the run_fredi_sv() results for a single impact sector
-
-# NOTE: the run_fredi_sv() module takes a few minutes to run because
-# the damages are calculated at the Census tract level and then
-# aggregated to the regional level
+
+### Calculate the run_fredi_sv() results for a single impact sector
-# take formatted temperature vector from the output of the
-# import_inputs() helper function
- temp_input <- inputs_list$tempInput
+### NOTE: the run_fredi_sv() module takes a few minutes to run because
+### the damages are calculated at the Census tract level and then
+### aggregated to the regional level
-# To see all available sectors, run:
-# FrEDI::get_sv_sectorInfo()
+### To see all available sectors, run: FrEDI::get_sv_sectorInfo()
-# Specify a specific sector
-sectorFlag = "Air Quality - Premature Mortality"
- # Purpose:
- # Specify the SV sector to calculate (can only run one sector at once)
- # Options: run FrEDI::get_sv_sectorInfo() to get a list of the
- # possible sectors
-driverFlag <- temp_input
- # Purpose:
- # Specify the temperature trajectory (up to 4) to use as an input.
- # Temperature needs to be in degrees C, *CONUS* temperature, relative
- # to the 1986-2005 average baseline
- # column 1 = 'year','column 2 = 'scenario', column 3 = 'temp_C'
- # NOTE: if temperature is in global degrees, use the
- # FrEDI::convertTemps() helper function to convert from global to CONUS
-popFlag <- NULL
- # Purpose:
- # Specify the population trajectory to use as an input.
- # column 1 = 'year', column 2 = 'region', column 3 = 'state', column 4 = 'postal', column 5 = 'state_pop'
- # default = if null, uses default population trajectory
-silentFlag = TRUE
- # Purpose:
- # Specify the level of messaging desired
- # Options: TRUE/FALSE
+### Sector Flag: Specify a specific sector
+### - Purpose: Specify the SV sector to calculate (can only run one sector at once)
+### - Options: Run FrEDI::get_sv_sectorInfo() to get a list of the possible sectors
+sectorFlag <- "Air Quality - Premature Mortality"
+
+### Silent Flag
+### - Purpose: Specify the level of messaging desired
+### - Options: TRUE/FALSE
+silentFlag <- TRUE
Step 3. Run FrEDI_SV
@@ -260,20 +254,23 @@ Step 3. Run FrEDI_SV
run_fredi(), as SV damage calculations are
conducted at finer spatial scales (e.g., U.S. Census tract vs. regional
level).
-
-#Run FrEDI using inputs and parameters set in Step #2
+
+### Run FrEDI using inputs and parameters set in Step 2
+output_sv <- run_fredi_sv(
+ sector = sectorFlag,
+ inputsList = inputs_list,
+ silent = silentFlag
+)
-output_df <- run_fredi_sv(sector = sectorFlag,
- driverInput = driverFlag,
- popInput = popFlag,
- silent = silentFlag)
+### Glimpse results
+output_sv |> glimpse()
-# Option: write output
-## Write Full Dataframe to CSV (or feather)
-# write.csv(output_df, './output/example_output.csv')
+### Option: write output
+### Write Full Dataframe to CSV (or feather)
+# write.csv(output_sv, './output/example_output.csv')
-#First five lines of output dataframe
-#output_df[1:5,]
+### First five lines of output dataframe
+# output_sv[1:5,]
Step 4. Analyze FrEDI_SV
@@ -294,11 +291,11 @@ Step 4. Analyze FrEDI_SV
diff --git a/docs/articles/References.html b/docs/articles/References.html
index b5ddb777..c4069184 100644
--- a/docs/articles/References.html
+++ b/docs/articles/References.html
@@ -28,7 +28,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -136,7 +136,7 @@ Example Applications
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/authors.html b/docs/authors.html
index e4588032..033f8515 100644
--- a/docs/authors.html
+++ b/docs/authors.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.1
+ 4.2.0
@@ -106,13 +106,13 @@ Citation
Hartin C, McDuffie E, Sarofim M, Noiva K (2024).
FrEDI: The Framework for Evaluating Damages and Impacts (FrEDI).
-R package version 4.1.1, https://epa.gov/cira/FrEDI/, https://github.com/USEPA/FrEDI/, https://usepa.github.io/FrEDI.
+R package version 4.2.0, https://epa.gov/cira/FrEDI/, https://github.com/USEPA/FrEDI/, https://usepa.github.io/FrEDI.
@Manual{,
title = {FrEDI: The Framework for Evaluating Damages and Impacts (FrEDI)},
author = {Corinne Hartin and Erin McDuffie and Marcus Sarofim and Karen Noiva},
year = {2024},
- note = {R package version 4.1.1, https://epa.gov/cira/FrEDI/, https://github.com/USEPA/FrEDI/},
+ note = {R package version 4.2.0, https://epa.gov/cira/FrEDI/, https://github.com/USEPA/FrEDI/},
url = {https://usepa.github.io/FrEDI},
}
diff --git a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyC0ITw.woff2 b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyC0ITw.woff2
index 6478b9ad..f4675de1 100644
Binary files a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyC0ITw.woff2 and b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyC0ITw.woff2 differ
diff --git a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCAIT5lu.woff2 b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCAIT5lu.woff2
index dee82d4b..7ac6ae08 100644
Binary files a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCAIT5lu.woff2 and b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCAIT5lu.woff2 differ
diff --git a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCIIT5lu.woff2 b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCIIT5lu.woff2
index b5664780..3d4f643a 100644
Binary files a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCIIT5lu.woff2 and b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCIIT5lu.woff2 differ
diff --git a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCMIT5lu.woff2 b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCMIT5lu.woff2
index e0d65386..753e47ca 100644
Binary files a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCMIT5lu.woff2 and b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCMIT5lu.woff2 differ
diff --git a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCkIT5lu.woff2 b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCkIT5lu.woff2
index 1005b7c8..49dbbaa5 100644
Binary files a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCkIT5lu.woff2 and b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCkIT5lu.woff2 differ
diff --git a/docs/index.html b/docs/index.html
index 10c20e37..293d84d1 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -5,14 +5,14 @@
-
+
The Framework for Evaluating Damages and Impacts (FrEDI) • FrEDI
-
+
Default outputs of run_fredi() A dataframe containing the default outputs of run_fredi() — defaultResults • FrEDI
- Skip to contents
-
-
-
-
-
- Default outputs of run_fredi()
A dataframe containing the default outputs of run_fredi()
- Source: R/data.R
- defaultResults.Rd
-
-
-
- Default outputs of run_fredi()
-A dataframe containing the default outputs of run_fredi()
-
-
-
-
-
- Format
- A data frame with 1,501,500 rows and 20 columns:
- sector
-Name of the associated sector.
-
-- variant
-Name of the associated variant or adaptation (values are sector-specific).
-
-- impactYear
-Name of the impact year ("2010", "2090", "N/A", or "Interpolation").
-
-- impactType
-Name of the impact type ("all" or sector-specific values).
-
-- region
-Name of the associated region ("Midwest", "Northeast", "Northern Plains", "Northwest", "Southeast", "Southern Plains", "Southwest", or "National Total").
-
-- state
-Name of the associated state (or District of Columbia): "Alabama", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "District of Columbia", "Florida", "Georgia", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming". For the "National Total" region, state = "All"
. For sectors with only has region-level data, state = "N/A"
.
-
-- postal
-Postal code abbreviation of the associated state (e.g., postal="AL"
for state="Alabama"
). The postal code abbreviation for the District of Columbia is "DC"
. For the "National Total" region, postal = "US"
. For sectors with only has region-level data, postal = "N/A"
.
-
-- model_type
-Type of model used to calculate impacts --- either "GCM" (for "Global Climate Model") or "SLR" for ("Sea Level Rise")
-
-- model
-Name of the GCM ("Average", "CanESM2", "CCSM4", "GCM Ensemble", "GFDL-CM3", "GISS-E2-R", "HadGEM2-ES", "MIROC5", "MRI-CGCM3") or SLR model ("Interpolation")
-
-- sectorprimary
-A 0
or 1
value indicating whether the sector is a primary CIRA sector (and whether it should be included when summing across sectors). sectorprimary=1
if a primary sector and sectorprimary=0
if not.
-
-- includeaggregate
-A 0
or 1
value indicating whether the variant is the primary variant for the sector (and whether it should be included when summing across sectors). includeaggregate=1
if the variant is a primary variant and includeaggregate=0
if not).
-
-- driverType
-Associated driver type ("Temperature" or "GMSL (SLR)").
-
-- driverUnit
-Unit for the associated driver type ("degrees Celsius" for temperature and "cm" for sea level rise).
-
-- driverValue
-Value for the associated driver type (in "degrees Celsius" for temperature and in "cm" for sea level rise).
-
-- gdp_usd
-National gross domestic product (GDP) for associated year in 2015 USD (U.S. dollars).
-
-- national_pop
-National population for associated year.
-
-- gdp_per_cap
-National GDP per capita for associated year in 2015 USD (U.S. dollars) per capita.
-
-- state_pop
-Population for the associated state (for state-level data) or region (for region-only data).
-
-- annual_impacts
-Annual impacts for associated sector, variant, impact type, impact year, region, state, model type, model, and year.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/reference/gcamScenarios.html b/docs/reference/gcamScenarios.html
index ba6c38a6..70dbc6e2 100644
--- a/docs/reference/gcamScenarios.html
+++ b/docs/reference/gcamScenarios.html
@@ -1,5 +1,5 @@
-Six driver scenarios that can be passed as inputs to run_fredi() and run_fredi_sv() — gcamScenarios • FrEDI Six driver scenarios that can be passed as inputs to run_fredi() and run_fredi_sv() — gcamScenarios • FrEDI
@@ -10,7 +10,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -70,7 +70,7 @@
- A dataframe containing six driver scenarios that can be passed as inputs to run_fredi()
and run_fredi_sv()
. This data frame has four columns -- year
, temp_C
, slr_cm
, and scenario
-- respectively containing:
+ gcamScenarios
is a data frame object containing six driver scenarios that can be passed as inputs to run_fredi()
and run_fredi_sv()
. This data frame has five columns -- year
, temp_C_global
, temp_C_conus
, slr_cm
, scenario
, and model
:
@@ -80,17 +80,23 @@ Usage
Format
- A data frame with 546 rows and 4 columns:
- year
+ A data frame with 606 rows and 6 columns:
- year
Year
-- temp_C
-Global temperature (in degrees Celsius) for the associated year and scenario
+- temp_C_global
+Global temperatures, in degrees Celsius, for the associated year and scenario
-- slr_cm
-Global Mean Sea Level Rise (in centimeters) for the associated year and scenario
+- temp_C_conus
+Temperatures for the contiguous U.S. (CONUS), in degrees Celsius, for the associated year and scenario (converted from global temperatures using convertTemps(from="global"))
-- scenario
-Associated scenario identifier
+- slr_cm
+Global Mean Sea Level Rise (GMSL or SLR), in centimeters, for the associated year and scenario (calculated from global temperatures using temps2slr()
)
+
+- scenario
+Associated scenario identifier (e.g., "ECS_3.0_REF"
)
+
+- model
+A string ("Hector_GCAM_v5.3"
) identifying the model (Hector, with GCAM v5.3) used in generating the global temperatures associated with each scenario
@@ -101,23 +107,32 @@ Source<
Details
-- year
+- year
The Common Era (CE) year associated with the observation.
-- temp_C
-Global temperature (i.e., degrees of warming above the baseline year of 1995) in degrees Celsius, for the associated year and scenario.
+- temp_C_global
+Global temperature (i.e., degrees of warming above the baseline year of 1995), in degrees Celsius, for the associated year and scenario.
+
+- temp_C_conus
+Temperatures (i.e., degrees of warming above the baseline year of 1995) for the contiguous U.S. (CONUS), in degrees Celsius, for the associated year and scenario (calculated from global temperatures using convertTemps(from="global")).
+
+- slr_cm
+Global Mean Sea Level Rise (GMSL or SLR), in centimeters, for the associated year and scenario (calculated from global temperatures using temps2slr()
).
-- slr_cm
-Global Mean Sea Level Rise (i.e., SLR) in centimeters for the associated year and scenario.
+- scenario
+Associated scenario identifier (e.g., "ECS_3.0_REF"
).
-- scenario
-Associated scenario identifier.
+- model
+A string ("Hector_GCAM_v5.3"
) identifying the model (Hector, with GCAM v5.3) used in generating the global temperatures associated with each scenario.
-
The scenarios in this dataframe were created using Hector, an open-source, reduced-form global carbon-cycle climate model (Hartin et al., 2015) to model temperatures associated with emissions scenarios from the Global Change Analysis Model v5.3 (GCAM). The Global Change Analysis Model v5.3 (GCAM) is an open source model that represents the linkages between energy, water, land, climate and economic systems (Calvin et al., 2019). Scenario identifiers in the scenario
column of gcamScenarios()
have the string "Hector_GCAM_v5.3_ECS_"
as a prefix, followed by the average warming temperature and the suffix "_REF"
(e.g., "Hector_GCAM_v5.3_ECS_3.0_REF"
for the default scenario for run_fredi()
and run_fredi_sv()
.
-These six temperature scenarios represent global temperatures; however, run_fredi()
and run_fredi_sv()
require temperature scenarios for the contiguous U.S. (CONUS). Therefore, to use the gcamScenarios
with run_fredi()
or run_fredi_sv()
, users must first convert temperatures in the temp_C
column to CONUS temperatures via the convertTemps function -- with argument from = "global"
(e.g., gcamScenarios |> mutate(temp_C = temp_C |> FrEDI::convertTemps(from = "global"))
).
-The GCAM scenarios can be passed directly to the SV module via the driverInput
argument (e.g., run_fredi_sv(driverInput = gcamScenarios)
), since run_fredi_sv()
is designed to run multiple scenarios. In contrast, run_fredi()
is intended to be run with a single scenario; gcamScenarios
should be subset to a specific scenario before passing the temperature scenario to run_fredi()
(e.g., run_fredi(list(tempInput=gcamScenarios |> dplyr::filter(scenario=="Hector_GCAM_v5.3_ECS_3.0_REF")))
to use the default scenario).
-Calvin, K., Patel, P., Clarke, L., et al. 2019. GCAM v5.1: representing the linkages between energy, water, land, climate, and economic systems, Geosci. Model Dev., 12:677–698. https://doi.org/10.5194/gmd-12-677-2019.
+
The scenarios in this data frame were created using Hector with GCAM v5.3:
Hector is an open-source, reduced-form global carbon-cycle climate model (Hartin et al., 2015) used to model temperatures associated with emissions scenarios from the Global Change Analysis Model v5.3 (GCAM).
+GCAM v5.3 -- i.e., the Global Change Analysis Model v5.3 -- is an open source model that represents the linkages between energy, water, land, climate and economic systems (Calvin et al., 2019).
+
Scenario identifiers in the scenario
column of gcamScenarios()
have the string "ECS_3.0_REF_"
as a prefix, followed by a suffix indicating an emissions intensity associated with the scenario (e.g., "20"
) -- for instance, the default scenario for run_fredi()
and run_fredi_sv()
is "ECS_3.0_REF"
. Other scenarios include "ECS_3.0_REF_20"
, "ECS_3.0_REF_30"
, "ECS_3.0_REF_50"
, "ECS_3.0_REF_70"
, and "ECS_3.0_REF_90"
.
+Users can use the scenarios in gcamScenarios
as inputs to FrEDI or the FrEDI SV Module:
Users can filter the gcamScenarios
data frame to any of these six scenarios, which can then be passed directly to the run_fredi()
function via a named element (temp
and/or slr
) in a list passed to the inputsList
argument -- e.g., run_fredi(inputsList=list(temp=gcamScenarios |> filter(scenario=="ECS_3.0_REF")))
will run using the default temperature scenario.
+Any or all of the GCAM scenarios can be passed directly to the FrEDI SV module via the run_fredi_sv()
function via a named list element (temp
and/or slr
) in a list passed to the inputsList
argument -- e.g., run_fredi_sv(inputsList=list(temp=gcamScenarios))
will run the SV module for all the GCAM scenarios provided in gcamScenarios
.
+gcamScenarios
can also be combined with other provided scenarios (gdpDefault
, popDefault
) in function calls (e.g., run_fredi(inputsList=list(temp=gcamScenarios |> filter(scenario=="ECS_3.0_REF"), gdp=gdpDefault, pop=popDefault))
) or user-provided data frames. For more information, see documentation for run_fredi()
, FrEDI:run_fredi_sv()
, FrEDI:run_fredi_methane()
, and import_inputs()
.
+
Calvin, K., Patel, P., Clarke, L., et al. 2019. GCAM v5.1: representing the linkages between energy, water, land, climate, and economic systems, Geosci. Model Dev., 12:677–698. https://doi.org/10.5194/gmd-12-677-2019.
Hartin, C.A., Patel, P., Schwarber, A., Link, R.P. and Bond-Lamberty, B.P., 2015. A simple object-oriented and open-source model for scientific and policy analyses of the global climate system–Hector v1. 0. Geoscientific Model Development, 8(4), pp.939-955.
@@ -126,11 +141,11 @@ Details
diff --git a/docs/reference/get_sectorInfo.html b/docs/reference/get_sectorInfo.html
index ab27e1e6..27908ede 100644
--- a/docs/reference/get_sectorInfo.html
+++ b/docs/reference/get_sectorInfo.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -142,102 +142,102 @@ Examples
### Return a dataframe of all of the sectors in FrEDI (sector names and additional information)
get_sectorInfo(description=T, gcmOnly=T)
-#> sector include model_type byState
-#> 3 ATS Temperature-Related Mortality 1 GCM 1
-#> 2 Asphalt Roads 1 GCM 1
-#> 4 CIL Agriculture 1 GCM 1
-#> 5 CIL Crime 1 GCM 1
-#> 6 CIL Temperature-Related Mortality 1 GCM 1
-#> 1 Climate-Driven Changes in Air Quality 1 GCM 1
-#> 8 Electricity Demand and Supply 1 GCM 1
-#> 9 Electricity Transmission and Distribution 1 GCM 1
-#> 10 Extreme Temperature 1 GCM 1
-#> 12 Inland Flooding 1 GCM 1
-#> 13 Labor 1 GCM 1
-#> 14 Marine Fisheries 1 GCM 1
-#> 16 Rail 1 GCM 1
-#> 17 Roads 1 GCM 1
-#> 18 Southwest Dust 1 GCM 1
-#> 15 Suicide 1 GCM 1
-#> 19 Urban Drainage 1 GCM 1
-#> 20 Valley Fever 1 GCM 1
-#> 21 Vibriosis 1 GCM 1
-#> 22 Water Quality 1 GCM 1
-#> 23 Wildfire 1 GCM 1
-#> 24 Wind Damage 1 GCM 1
-#> 25 Winter Recreation 1 GCM 1
+#> sector include model_type
+#> 1 ATS Temperature-Related Mortality 1 GCM
+#> 2 Asphalt Roads 1 GCM
+#> 3 CIL Agriculture 1 GCM
+#> 4 CIL Crime 1 GCM
+#> 5 CIL Temperature-Related Mortality 1 GCM
+#> 6 Climate-Driven Changes in Air Quality 1 GCM
+#> 7 Electricity Demand and Supply 1 GCM
+#> 8 Electricity Transmission and Distribution 1 GCM
+#> 9 Extreme Temperature 1 GCM
+#> 10 Inland Flooding 1 GCM
+#> 11 Labor 1 GCM
+#> 12 Marine Fisheries 1 GCM
+#> 13 Rail 1 GCM
+#> 14 Roads 1 GCM
+#> 15 Southwest Dust 1 GCM
+#> 16 Suicide 1 GCM
+#> 17 Urban Drainage 1 GCM
+#> 18 Valley Fever 1 GCM
+#> 19 Vibriosis 1 GCM
+#> 20 Water Quality 1 GCM
+#> 21 Wildfire 1 GCM
+#> 22 Wind Damage 1 GCM
+#> 23 Winter Recreation 1 GCM
#> variants
-#> 3 Mean, Low Confidence Interval, High Confidence Interval
+#> 1 Mean, Low Confidence Interval, High Confidence Interval
#> 2 N/A
-#> 4 With CO2 Fertilization, Without CO2 Fertilization
-#> 5 N/A
-#> 6 Median, Low Confidence Interval, High Confidence Interval
-#> 1 2011 Emissions, 2040 Emissions
-#> 8 N/A
-#> 9 No Additional Adaptation, Proactive Adaptation, Reactive Adaptation
-#> 10 Adaptation, No Additional Adaptation
+#> 3 With CO2 Fertilization, Without CO2 Fertilization
+#> 4 N/A
+#> 5 Median, Low Confidence Interval, High Confidence Interval
+#> 6 2011 Emissions, 2040 Emissions
+#> 7 N/A
+#> 8 No Additional Adaptation, Proactive Adaptation, Reactive Adaptation
+#> 9 Adaptation, No Additional Adaptation
+#> 10 N/A
+#> 11 N/A
#> 12 N/A
-#> 13 N/A
-#> 14 N/A
-#> 16 No Additional Adaptation, Proactive Adaptation, Reactive Adaptation
-#> 17 No Additional Adaptation, Proactive Adaptation, Reactive Adaptation
-#> 18 N/A
+#> 13 No Additional Adaptation, Proactive Adaptation, Reactive Adaptation
+#> 14 No Additional Adaptation, Proactive Adaptation, Reactive Adaptation
#> 15 N/A
+#> 16 N/A
+#> 17 N/A
+#> 18 N/A
#> 19 N/A
#> 20 N/A
#> 21 N/A
#> 22 N/A
#> 23 N/A
-#> 24 N/A
-#> 25 N/A
#> impactYears
-#> 3 N/A
-#> 2 N/A
-#> 4 N/A
-#> 5 N/A
-#> 6 N/A
-#> 1 N/A
-#> 8 N/A
-#> 9 N/A
-#> 10 2010, 2090
-#> 12 N/A
-#> 13 N/A
-#> 14 N/A
-#> 16 N/A
-#> 17 N/A
-#> 18 2010, 2090
-#> 15 N/A
-#> 19 N/A
-#> 20 N/A
-#> 21 N/A
-#> 22 N/A
-#> 23 N/A
-#> 24 N/A
-#> 25 2010, 2090
+#> 1 NA
+#> 2 NA
+#> 3 NA
+#> 4 NA
+#> 5 NA
+#> 6 NA
+#> 7 NA
+#> 8 NA
+#> 9 2010, 2090
+#> 10 NA
+#> 11 NA
+#> 12 NA
+#> 13 NA
+#> 14 NA
+#> 15 2010, 2090
+#> 16 NA
+#> 17 NA
+#> 18 NA
+#> 19 NA
+#> 20 NA
+#> 21 NA
+#> 22 NA
+#> 23 2010, 2090
#> impactTypes
-#> 3 N/A
+#> 1 N/A
#> 2 N/A
-#> 4 Cotton, Maize, Soybean, Wheat
-#> 5 Property, Violent
-#> 6 N/A
-#> 1 Ozone, PM2.5
+#> 3 Cotton, Maize, Soybean, Wheat
+#> 4 Property, Violent
+#> 5 N/A
+#> 6 Ozone, PM2.5
+#> 7 N/A
#> 8 N/A
-#> 9 N/A
-#> 10 Cold, Hot
+#> 9 Cold, Hot
+#> 10 N/A
+#> 11 N/A
#> 12 N/A
#> 13 N/A
#> 14 N/A
+#> 15 Acute Myocardial Infarction, All Cardiovascular, All Mortality, All Respiratory, Asthma ER
#> 16 N/A
#> 17 N/A
-#> 18 Acute Myocardial Infarction, All Cardiovascular, All Mortality, All Respiratory, Asthma ER
-#> 15 N/A
-#> 19 N/A
-#> 20 Lost Wages, Morbidity, Mortality
-#> 21 Direct Medical Cost, Lost Days, Mortality
+#> 18 Lost Wages, Morbidity, Mortality
+#> 19 Direct Medical Cost, Lost Days, Mortality
+#> 20 N/A
+#> 21 Morbidity, Mortality, Response Costs
#> 22 N/A
-#> 23 Morbidity, Mortality, Response Costs
-#> 24 N/A
-#> 25 Alpine Skiing, Cross-Country Skiing, Snowmobiling
+#> 23 Alpine Skiing, Cross-Country Skiing, Snowmobiling
### Return a character vector with only the names of the temperature-driven sectors:
get_sectorInfo(gcmOnly=T)
@@ -267,14 +267,12 @@ Examples
### Run FrEDI for only the temperature-driven sectors and view results:
df_x <- run_fredi(sectorList=get_sectorInfo(gcmOnly=T))
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from defaults...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -286,11 +284,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/get_sv_sectorInfo.html b/docs/reference/get_sv_sectorInfo.html
index 0f5fa8f1..a486c04e 100644
--- a/docs/reference/get_sv_sectorInfo.html
+++ b/docs/reference/get_sv_sectorInfo.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -168,11 +168,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/import_inputs.html b/docs/reference/import_inputs.html
index 79a35d77..7c5a1903 100644
--- a/docs/reference/import_inputs.html
+++ b/docs/reference/import_inputs.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -76,33 +76,29 @@
Usage
import_inputs(
- tempfile = NULL,
- slrfile = NULL,
- gdpfile = NULL,
- popfile = NULL,
+ inputsList = list(gdp = NULL, pop = NULL, temp = NULL, slr = NULL, ch4 = NULL, nox =
+ NULL, o3 = NULL),
temptype = "conus",
- popArea = "state"
+ popArea = "state",
+ module = "fredi"
)
Arguments
- - tempfile=NULL
-A character string indicating the location of a CSV file containing a custom temperature scenario. The first column in the CSV should be named "year"
and contain years associated with the temperature estimates; the second column (named "temp_C"
) should contain values for temperatures (i.e., degrees of warming relative to a baseline year of 1995), in degrees Celsius. The temperature scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
-
-
-- slrfile=NULL
-A character string indicating the location of a CSV file containing a custom sea level rise scenario. The first column in the CSV should be named "year"
and contain years associated with the sea level rise estimates; second column should be named "slr_cm"
and contain values for global mean sea level rise (GMSL), in centimeters, above a baseline year of 2000. The SLR scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
-
-
-- gdpfile=NULL
-A character string indicating the location of a CSV file containing a custom scenario for U.S. gross domestic product (GDP). The first column in the CSV should be named "year"
and contains years associated with the GDP estimates; the second column (named "gdp_usd"
) should contain values for U.S. GDP in 2015 U.S. dollars (2015$ USD). The GDP scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
). Values for GDP in column "gdp_usd"
must be greater than or equal to zero.
-
-
-- popfile=NULL
-A character string indicating the location of a CSV file containing a custom population scenario for states and NCA regions. The first column should be named "year"
and contain years in the interval 2010 to 2300. The second column should be called "pop"
and contain population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument (for more information, see the popArea
argument, below.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year. If popArea = "national"
, only the year
and pop
columns are required.
+ - inputsList=list(gdp=NULL, pop=NULL, temp=NULL, slr=NULL, ch4=NULL, nox=NULL)
+A named list containing file paths to CSV files containing scenarios:
gdp A character string indicating the location of a CSV file containing a custom scenario for U.S. gross domestic product (GDP), for use with run_fredi()
or run_fredi_methane()
. The first column in the CSV should be named "year"
and contains years associated with the GDP estimates; the second column (named "gdp_usd"
) should contain values for U.S. GDP in 2015 U.S. dollars (2015$ USD). The GDP scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
or run_fredi_methane()
). Values for GDP in column "gdp_usd"
must be greater than or equal to zero.
+pop A character string indicating the location of a CSV file containing a custom population scenario for states and NCA regions, for use with run_fredi()
, run_fredi_sv()
, or run_fredi_methane()
. The first column should be named "year"
and contain years in the interval 2010 to 2300. The second column should be called "pop"
and contain population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument (for more information, see the popArea
argument, below.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year. If popArea = "national"
, only the year
and pop
columns are required.
If popArea = "state"
, the file must contain estimates for all CONUS states -- i.e., all states except Alaska and Hawaii must be present in the input file (estimates for Alaska and Hawaii are optional). If popArea = "regional"
, the file must contain estimates for all seven NCA regions.
-The population scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
). Values for population in column "pop"
must be greater than or equal to zero.
+The population scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
or run_fredi_methane()
). Values for population in column "pop"
must be greater than or equal to zero.
+
+temp A character string indicating the location of a CSV file containing a custom temperature scenario, for use with run_fredi()
or run_fredi_sv()
. The first column in the CSV should be named "year"
and contain years associated with the temperature estimates; the second column (named "temp_C"
) should contain values for temperatures (i.e., degrees of warming relative to a baseline era of 1986-2005), in degrees Celsius. The temperature scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
+slr A character string indicating the location of a CSV file containing a custom sea level rise scenario, for use with run_fredi()
or run_fredi_sv()
. The first column in the CSV should be named "year"
and contain years associated with the sea level rise estimates; the second column should be named "slr_cm"
and contain values for global mean sea level rise (GMSL), in centimeters, above a baseline year of 2000. The SLR scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
+o3 A character string indicating the location of a CSV file containing a custom scenario for changes in U.S. state-level ozone concentrations (relative to a 1986-2005 baseline era). The input ozone scenario requires changes in annual state-level ozone concentrations, by GCM model, in parts per trillion by volume (pptv) relative to a 1986-2005 baseline era. In other words, the input ozone scenario requires ozone concentrations specific to the state, GCM model, and year of the analysis.
The o3
input requires a data frame object with six columns with names "region"
, "state"
, "postal"
, "model"
, "year"
, and "O3_pptv"
containing the region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively), the state name, the two-character postal code abbreviation for the state, the GCM model name ("CanESM2"
, "GFDL-CM3"
, "GISS-E2-R"
, "HadGEM2-ES"
, and/or "MIROC5"
), the year, and the change in ozone concentration (in pptv) relative to a 1986-2005 baseline era.
+Ozone inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by the maxYear
argument).
+
+ch4 A character string indicating the location of a CSV file containing a custom scenario for changes in U.S. methane concentrations (relative to a 1986-2005 baseline era), at the national level, for use with run_fredi_methane()
. The first column in the CSV should be named "year"
and contain years associated with the national methane estimates; the second column should be named "CH4_ppbv"
and contain values for methane. The methane scenario must start in 2020 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi_methane()
).
+nox A character string indicating the location of a CSV file containing a custom scenario for U.S. NOx emission values, at the national level. The first column in the CSV should be named "year"
and contain years associated with the national NOx estimates; the second column should be named "Mt"
and contain values for NOx emissions, in megatons per year (Mt). The NOx scenario must start in 2020 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi_methane()
).
@@ -121,29 +117,41 @@ Value
import_inputs()
returns a list of named elements containing data frames with custom scenarios for temperature, GMSL, GDP, and regional population, respectively:
-List Index Description tempInput
Data frame containing a custom temperature scenario imported from the CSV file specified by tempfile
, with missing values removed. tempInput
has two columns with names "year"
and "temp_C"
, containing the year and CONUS temperatures in degrees Celsius, respectively. slrInput
Data frame containing a custom GMSL scenario imported from the CSV file specified by slrfile
, with missing values removed. slrInput
has two columns with names "year"
, and "slr_cm"
, containing the year and global mean sea level rise (GMSL) in centimeters, respectively. gdpInput
Data frame containing a custom GDP scenario imported from the CSV file specified by gdpfile
, with missing values removed. gdpInput
has two columns with names "year"
, and "gdp_usd"
, containing the year and the national GDP, respectively. popInput
Data frame containing a custom temperature scenario imported from the CSV file specified by popfile
, with missing values removed. popInput
has three columns with names "year"
, "region"
, "state"
, "postal"
, and "state_pop"
, containing the year, the NCA region name, and the state, the postal code abbreviation (e.g., postal = "ME"
for state = "Maine"
), and the state population, respectively.
+List Index Description gdp
Data frame containing a custom GDP scenario imported from the CSV file specified by inputsList$gdp
, with missing values removed. gdp
has two columns with names "year"
, and "gdp_usd"
, containing the year and the national GDP, respectively. pop
Data frame containing a custom temperature scenario imported from the CSV file specified by inputsList$pop
, with missing values removed. popInput
has three columns with names "year"
, "region"
, "state"
, "postal"
, and "pop"
, containing the year, the NCA region name, and the state, the postal code abbreviation (e.g., postal = "ME"
for state = "Maine"
), and the state population, respectively. temp
Data frame containing a custom temperature scenario imported from the CSV file specified by inputsList$temp
, with missing values removed. temp
has two columns with names "year"
and "temp_C"
, containing the year and CONUS temperatures in degrees Celsius, respectively. slr
Data frame containing a custom GMSL scenario imported from the CSV file specified by inputsList$slr
, with missing values removed. slr
has two columns with names "year"
, and "slr_cm"
, containing the year and global mean sea level rise (GMSL) in centimeters, respectively. o3
Data frame containing a custom scenario with changes in ozone concentrations imported from the CSV file specified by inputsList$temp
, with missing values removed. o3
has six columns with names "region"
, "state"
, "postal"
, "model"
, "year"
, and "O3_pptv"
containing the region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively), the state name, the two-character postal code abbreviation for the state, the GCM model name ("CanESM2"
, "GFDL-CM3"
, "GISS-E2-R"
, "HadGEM2-ES"
, and/or "MIROC5"
), the year, and the change in ozone concentration (in pptv) relative to a 1986-2005 baseline era. ch4
Data frame containing a custom scenario with changes in methane concentrations imported from the CSV file specified by inputsList$slr
, with missing values removed. ch4
has two columns with names "year"
, and "CH4_ppbv"
, containing the year and Change in U.S. methane concentrations, in parts per billion by volume (ppbv) relative to a 1995-2006 baseline era, respectively. nox
Data frame containing a custom NOx emissions scenario imported from the CSV file specified by inputsList$nox
, with missing values removed. nox
has two columns with names "year"
and "NOx_Mt"
, containing the year and U.S. national-level NOx emissions (in Mt), respectively.
Details
- This function enables users to import data on custom scenarios for use with temperature binning. Users specify path names to CSV files containing temperature, global mean sea level rise (GMSL), population, and gross domestic product (GDP) scenarios (tempfile
, slrfile
, gdpfile
, and popfile
, respectively). import_inputs()
reads in and formats any specified files as data frames and returns a list of data frames for imported scenarios.
-The CSV files should contain estimates aligned with the requirements of the run_fredi()
or ``
Temperature Scenario. The file specified by tempfile
must have two columns -- "year"
and "temp_C"
-- respectively containing the years associated with the temperature estimates and the temperatures (i.e., degrees of warming) in degrees Celsius relative to a baseline year of 1995 (i.e., the central year of a 1986-2005 reference period).
If values in "temp_C"
have global rather than CONUS-specific temperatures, users should specify temptype = "global"
when running import_inputs()
, and import_inputs()
will convert the temperatures to CONUS using convertTemps (with argument from = "global"
).
-Temperature inputs to run_fredi()
must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-
-SLR Scenario. The file specified by slrfile
must have two columns -- "year"
and "slr_cm"
-- respectively containing the years associated with the GMSL estimates and GMSL estimates, in centimeters, above a 2000 baseline year.
GMSL heights must be greater than or equal to zero.
-The SLR scenario must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-
-GDP Scenario. The file specified by gdpfile
must have two columns -- "year"
and "gdp_usd"
-- respectively containing the years associated with the GDP estimates and the estimates for U.S. GDP, in 2015$.
GDP values must be greater than or equal to zero.
+ This function enables users to import data on custom scenarios for use with temperature binning. Users provide a named list specifying path names to CSV files containing scenarios for gross domestic product (GDP) (for use with run_fredi()
or run_fredi_methane()
); population (for use with run_fredi()
, run_fredi_sv()
, or run_fredi_methane()
); temperature and/or global mean sea level rise (GMSL) (for use with run_fredi()
or run_fredi_sv()
); or methane or NOx (for use with run_fredi_methane()
). import_inputs()
reads in and formats any specified files as data frames and returns a list of data frames for imported scenarios.
+The CSV files should contain estimates aligned with the requirements of the run_fredi()
or ``
GDP Scenario. The file specified by inputsList$gdp
must have two columns -- "year"
and "gdp_usd"
-- respectively containing the years associated with the GDP estimates and the estimates for U.S. GDP, in 2015$.
GDP values must be greater than or equal to zero.
The GDP scenario must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-Population Scenario. The file specified by popfile
population must have at least two columns -- "year"
and "pop"
-- respectively containing the years associated with the population estimates and the population estimates. requires state-level population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year. If popArea = "national"
, only the year
and pop
columns are required.
+Population Scenario. The file specified by inputsList$pop
population must have at least two columns -- "year"
and "pop"
-- respectively containing the years associated with the population estimates and the population estimates. requires state-level population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year (one of "Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively). If popArea = "national"
, only the year
and pop
columns are required.
If popArea = "state"
, the file must contain estimates for all CONUS states -- i.e., all states except Alaska and Hawaii must be present in the input file (estimates for Alaska and Hawaii are optional). If popArea = "regional"
, the file must contain estimates for all seven NCA regions.
The population scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
Population values must be greater than or equal to zero.
Population estimates must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-
run_fredi()
requires a population scenario at the state level. If the population scenario is supplied to import_inputs()
at a geographical scale above the state level (i.e., if popArea = "national"
, popArea = "area"
, or popArea = "regional"
), import_inputs()
will calculate state-level estimates from the provided data:
If popArea = "national"
, import_inputs()
will use historical U.S. Census data for the period 2010--2023 to allocate total national population to CONUS and non-CONUS regions (i.e., Alaska and Hawaii); U.S. Census values from 2023 are applied in allocations for years after 2023. import_inputs()
then uses ICLUS data and projections for the period 2010--2100 to allocate CONUS population to specific NCA regions; ICLUS values from 2100 are applied in allocations for years after 2100.
+Temperature Scenario. The file specified by inputsList$temp
must have two columns -- "year"
and "temp_C"
-- respectively containing the years associated with the temperature estimates and the temperatures (i.e., degrees of warming) in degrees Celsius relative to a baseline year of 1995 (i.e., the central year of a 1986-2005 reference period).
If values in "temp_C"
have global rather than CONUS-specific temperatures, users should specify temptype = "global"
when running import_inputs()
, and import_inputs()
will convert the temperatures to CONUS using convertTemps (with argument from = "global"
).
+Temperature inputs to run_fredi()
must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
+
+SLR Scenario. The file specified by inputsList$slr
must have two columns -- "year"
and "slr_cm"
-- respectively containing the years associated with the GMSL estimates and GMSL estimates, in centimeters, above a 2000 baseline year.
GMSL heights must be greater than or equal to zero.
+The SLR scenario must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
+
+Ozone Scenario. The input ozone scenario requires changes in annual state-level ozone concentrations, by GCM model, in parts per trillion by volume (pptv) relative to a 1986-2005 baseline era. In other words, the input ozone scenario requires ozone concentrations specific to the state, GCM model, and year of the analysis.
o3
requires a data frame object with six columns with names "region"
, "state"
, "postal"
, "model"
, "year"
, and "O3_pptv"
containing the region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively), the state name, the two-character postal code abbreviation for the state, the GCM model name ("CanESM2"
, "GFDL-CM3"
, "GISS-E2-R"
, "HadGEM2-ES"
, and/or "MIROC5"
), the year, and the change in ozone concentration (in pptv) relative to a 1986-2005 baseline era.
+Ozone inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+If inputs are specified for ozone and methane or NOx (i.e., !is.null(inputsList$o3) & (!is.null(inputsList$ch4) | !is.null(inputsList$nox))
), run_fredi_methane()
will use the ozone scenario in preference of the methane and NOx scenario.
+
+Methane Scenario. The input methane scenario requires changes in annual methane concentrations, at the national level, in parts per billion by volume (ppbv) relative to a 1986-2005 baseline era.
ch4
requires a data frame object with two columns with names "year"
and "CH4_ppbv"
containing the year and the change in methane concentration (in ppbv) relative to a 1986-2005 baseline era.
+Methane inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+run_fredi_methane()
will override a user-supplied methane scenario with a user-supplied ozone scenario; in other words, run_fredi_methane()
will use the ozone scenario in preference of the methane and NOx scenario.
+
+NOx Scenario. The input NOx scenario requires annual NOx emissions in the US, at the national level, in Megatons (MT) relative to a 1986-2005 baseline.
nox
requires a data frame object with two columns with names "year"
and "NOx_Mt"
containing the year and the change in NOx concentration (in Mt) relative to a 1986-2005 baseline era.
+NOx inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+run_fredi_methane()
will override a user-supplied methane scenario with a user-supplied ozone scenario; in other words, run_fredi_methane()
will use the ozone scenario in preference of the methane and NOx scenario.
+
+
run_fredi()
, run_fredi_sv()
, and run_fredi_methane()
each require a population scenario at the state level. If the population scenario is supplied to import_inputs()
at a geographical scale above the state level (i.e., if popArea = "national"
, popArea = "area"
, or popArea = "regional"
), import_inputs()
will calculate state-level estimates from the provided data:
If popArea = "national"
, import_inputs()
will use historical U.S. Census data for the period 2010--2023 to allocate total national population to CONUS and non-CONUS regions (i.e., Alaska and Hawaii); U.S. Census values from 2023 are applied in allocations for years after 2023. import_inputs()
then uses ICLUS data and projections for the period 2010--2100 to allocate CONUS population to specific NCA regions; ICLUS values from 2100 are applied in allocations for years after 2100.
If popArea = "national"
or popArea = "regional"
, import_inputs()
uses ICLUS data and projections for the period 2010--2100 to allocate population for each NCA region to the associated states; ICLUS values from 2100 are applied in allocations for years after 2100.
import_inputs()
outputs a list of data frame objects that can be passed to the main FREDI function run_fredi()
using the inputList
argument. For example, specify run_fredi(inputsList = x)
to generate impacts for a custom scenario x
(where x
is a list of data frames such as that output from import_inputs()
) (see run_fredi()
).
-All inputs to import_inputs()
are optional. If the user does not specify a file path for tempfile
, slrfile
, gdpfile
, or popfile
(or if there is are any errors reading in inputs from a file path), import_inputs()
outputs a list with a NULL
value for the associated list element. After reading in data from the specified CSV files, import_inputs()
performs basic checks and will also return a NULL
value for a particular list element if any of the checks fail.
+All inputs to import_inputs()
are optional. If the user does not specify particular named elements (or if there is are any errors reading in inputs from a file path), import_inputs()
outputs a list with a NULL
value for the associated list element. After reading in data from the specified CSV files, import_inputs()
performs basic checks and will also return a NULL
value for a particular list element if any of the checks fail.
When using import_inputs()
with run_fredi()
, run_fredi()
defaults back to the default scenarios for any elements of the inputs list that are NULL
or missing. In other words, running run_fredi(inputsList = list())
returns the same outputs as running run_fredi()
(see run_fredi()
).
@@ -162,8 +170,8 @@ Examples
### View example scenario names
scenariosPath |> list.files()
-#> [1] "GCAM_scenario.csv" "State ICLUS Population.csv"
-#> [3] "slr_from_GCAM.csv"
+#> [1] "gcamDefault.csv" "gcamScenarios.csv" "gdpDefault.csv"
+#> [4] "popDefault.csv"
### SLR Scenario File Name
slrInputFile <- scenariosPath |> file.path("slr_from_gcam.csv")
@@ -172,40 +180,28 @@ ExamplespopInputFile <- scenariosPath |> file.path("State ICLUS Population.csv")
### Import inputs
-example_inputsList <- import_inputs(slrfile=slrInputFile, popfile=popInputFile, popArea="state")
+example_inputsList <- import_inputs(inputsList=list(slr=slrInputFile, pop=popInputFile), popArea="state")
#>
#> In import_inputs():
#> Loading data...
#> User specified slrfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/slr_from_gcam.csv...
-#> Data loaded.
+#> File does not exist! Returning a null data frame for slr input.
#> User specified popfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/State ICLUS Population.csv...
-#> Data loaded.
+#> File does not exist! Returning a null data frame for pop input.
#>
#> Checking input values...
#>
-#> Checking input values for slr inputs...
-#> Values passed.
-#>
-#> Checking input values for pop inputs...
-#> Column "pop" not found in popfile data!
-#> Looking for columns with matches to the string "pop"...1 match found!
-#> Using column "state_pop", and renaming to "state_pop"...
-#> Values passed.
-#>
#> Finished.
### Use imports with FREDI:
df_x <- run_fredi(inputsList=example_inputsList)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from user inputs...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from user inputs...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -216,11 +212,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/index.html b/docs/reference/index.html
index d9dfde11..08aa75d4 100644
--- a/docs/reference/index.html
+++ b/docs/reference/index.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.1
+ 4.2.0
@@ -82,7 +82,7 @@ All functionsaggregate_impacts()
- Summarize and aggregate impacts from run_fredi()
(calculate national totals, average across models, sum impact types, and interpolate between impact year estimates)
+ Summarize and aggregate impacts from run_fredi()
(calculate national totals, average across models, sum impact types, and interpolate between impact year estimates)
-
convertTemps()
@@ -90,14 +90,14 @@ All functionsdefaultResults
+ gcamScenarios
- - Default outputs of
run_fredi()
A dataframe containing the default outputs of run_fredi()
+ - Six driver scenarios that can be passed as inputs to
run_fredi()
and run_fredi_sv()
-
-
gcamScenarios
+ gdpDefault
- - Six driver scenarios that can be passed as inputs to
run_fredi()
and run_fredi_sv()
+ - Scenario with values for U.S. Gross Domestic Product (GDP), which can be passed as an input to
run_fredi()
or run_fredi_methane()
.
-
get_sectorInfo()
@@ -107,7 +107,7 @@ All functionsget_sv_sectorInfo()
- - Retrieve a character vector of sectors available in the FrEDI Social Vulnerability (SV) module (run_fredi_sv) or a data frame with SV sectors and additional information.
+ - Retrieve a character vector of sectors available in the FrEDI Social Vulnerability (SV) module (run_fredi_sv) or a data frame with SV sectors and additional information.
-
import_inputs()
@@ -115,9 +115,9 @@ All functionspopScenario
+ popDefault
- - Population scenario to use as an input to
run_fredi()
and run_fredi_sv()
+ - U.S. state population scenario, which can be passed as an input to
run_fredi()
, run_fredi_sv()
, and/or FrEDI:run_fredi_methane()
.
-
run_fredi()
@@ -125,6 +125,11 @@ All functionsrun_fredi_methane()
+
+ - Project annual average impacts from methane, NOx, and ozone.
+
-
+
run_fredi_sv()
- Calculate climate change impacts on socially vulnerable (SV) populations throughout the 21st century for available sectors
diff --git a/docs/reference/popScenario.html b/docs/reference/popScenario.html
deleted file mode 100644
index cad31b4a..00000000
--- a/docs/reference/popScenario.html
+++ /dev/null
@@ -1,131 +0,0 @@
-
-Population scenario to use as an input to run_fredi() and run_fredi_sv() — popScenario • FrEDI
- Skip to contents
-
-
-
-
-
- Population scenario to use as an input to run_fredi()
and run_fredi_sv()
- Source: R/data.R
- popScenario.Rd
-
-
-
- A dataframe containing a population scenario to be passed as an input to run_fredi()
and run_fredi_sv()
.
-
-
-
-
-
- Format
- A data frame with 14,259 rows and 5 columns:
- year
-Year
-
-- region
-Region of U.S. ("Midwest", "Northeast", "Northern Plains", "Northwest", "Southeast", "Southern Plains", and "Southwest")
-
-- state
-One of 48 contiguous U.S. states or the District of Columbia
-
-- postal
-Postal code abbreviation associated with the state
-
-- state_pop
-State population for associated region and year
-
-
-
-
-
- Details
- This dataframe contains population projections at the state level from the Integrated Climate and Land Use Scenarios version 2 (ICLUSv2) model (Bierwagen et al, 2010; EPA 2017) under the Median variant projection of United Nations (2015).
-Bierwagen, B., D. M. Theobald, C. R. Pyke, A. Choate, P. Groth, J. V. Thomas, and P. Morefield. 2010. “National housing and impervious surface scenarios for integrated climate impact assessments.” Proc. Natl. Acad. Sci. 107 (49): 20887–20892. https://doi.org/10.1073/pnas.1002096107.
-EPA. 2017. Multi-Model Framework for Quantitative Sectoral Impacts Analysis: A technical report for the Fourth National Climate Assessment. U.S. Environmental Protection Agency, EPA 430-R-17-001.
-United Nations. 2015. World population prospects: The 2015 revision. New York: United Nations, Department of Economic and Social Affairs, Population Division.
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/reference/run_fredi.html b/docs/reference/run_fredi.html
index 09824b88..c5388b5f 100644
--- a/docs/reference/run_fredi.html
+++ b/docs/reference/run_fredi.html
@@ -12,7 +12,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -79,7 +79,7 @@
Usage
run_fredi(
- inputsList = list(tempInput = NULL, slrInput = NULL, gdpInput = NULL, popInput = NULL),
+ inputsList = list(temp = NULL, slr = NULL, gdp = NULL, pop = NULL),
sectorList = NULL,
aggLevels = c("national", "modelaverage", "impactyear", "impacttype"),
elasticity = 1,
@@ -93,8 +93,8 @@ Usage
Arguments
- - inputsList=NULL
-A list of named elements named elements (names(inputsList) = c("tempInput", "slrInput", "gdpInput", "popInput")
), each containing data frames of custom temperature, global mean sea level rise (GMSL), gross domestic product (GDP), and/or state-level population trajectories, respectively, over a continuous period in the range 2010 to 2300. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population and GDP scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
+ - inputsList=list(gdp=NULL, pop=NULL, temp=NULL, slr=NULL)
+A list with named elements (gdp
, pop
, temp
, and/or slr
), each containing data frames of custom scenarios for gross domestic product (GDP), state-level population, temperature, and/or global mean sea level rise (GMSL) trajectories, respectively, over a continuous period. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population and GDP scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
- sectorList=NULL
@@ -144,40 +144,40 @@ Value
Details
This function allows users to project annual average climate change impacts through 2300 (2010-2300) for available sectors. run_fredi()
is the main function in the FrEDI R package, described elsewhere (See https://epa.gov/cira/FrEDI for more information).
-Users can specify an optional list of custom scenarios with inputsList
(for more information on the format of inputs, see import_inputs()
). The function import_inputs()
can be used to importing custom scenarios from CSV files. import_inputs()
returns a list with elements tempInput
, slrInput
, gdpInput
, and popInput
, with each containing a data frame with a custom scenario for temperature, GMSL, GDP, and state-level population, respectively. If a user imports scenarios using import_inputs()
, they can pass the outputs of import_inputs()
directly to the run_fredi()
argument inputsList
. Note that the documentation for import_inputs()
can also provide additional guidance and specification on the formats for each scenario type.
-If inputsList = NULL
, run_fredi()
uses defaults for temperature, SLR, GDP, and population. Otherwise, run_fredi()
looks for a list object passed to the argument inputsList
. Within that list, run_fredi()
looks for list elements tempInput
, slrInput
, gdpInput
, and popInput
containing data frames with custom scenarios for temperature, GMSL, GDP, and state population, respectively. run_fredi()
will default back to the default scenarios for any list elements that empty or NULL
(in other words, running run_fredi(inputsList = list())
returns the same outputs as running run_fredi()
).
Temperature Inputs. The input temperature scenario requires CONUS temperatures in degrees Celsius relative to 1995 (degrees of warming relative to the baseline year--i.e., the central year of the 1986-2005 baseline). CONUS temperature values must be greater than or equal to zero degrees Celsius.
Users can convert global temperatures to CONUS temperatures using convertTemps(from = "global")
(or by specifying import_inputs(temptype = "global")
when using import_inputs()
to import a temperature scenario from a CSV file).
-tempInput
requires a data frame object with two columns with names "year"
, and "temp_C"
containing the year and CONUS temperatures in degrees Celsius, respectively.
-Temperature inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for temperature (i.e., inputsList = list(tempInput = NULL)
, run_fredi()
uses a default temperature scenario.
-
-SLR Inputs. The input SLR scenario requires values for changes in global mean sea level rise (GMSL) heights in centimeters (cm). GMSL heights must be greater than or equal to zero.
slrInput
requires a data frame object with two columns with names "year"
, "slr_cm"
containing the year and global mean sea level rise (GMSL) in centimeters, respectively.
-SLR inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for SLR (i.e., inputsList = list(slrInput = NULL)
, run_fredi()
first converts the input or default CONUS temperature scenario to global temperatures (using convertTemps()
) and then converts the global temperatures to a global mean sea level rise (GMSL) height in centimeters (using temps2slr()
).
-
-GDP Inputs. The input scenario for gross domestic product (GDP) requires national GDP values in 2015$. GDP values must be greater than or equal to zero.
gdpInput
requires a data frame object with two columns with names "year"
, and "gdp_usd"
containing the year and the national GDP, respectively. GDP values must be greater than or equal to zero.
+Users can specify an optional list of custom scenarios with inputsList
(for more information on the format of inputs, see import_inputs()
). The function import_inputs()
can be used to importing custom scenarios from CSV files. import_inputs()
returns a list with named elements gdp
, pop
, temp
, and slr
, with each containing a data frame with a custom scenario for GDP, state-level population, temperature, and/or GMSL respectively. If a user imports scenarios using import_inputs()
, they can pass the outputs of import_inputs()
directly to the run_fredi()
argument inputsList
. Note that the documentation for import_inputs()
can also provide additional guidance and specification on the formats for each scenario type.
+Otherwise, run_fredi()
looks for a list object passed to the argument inputsList
. Within that list, run_fredi()
looks for named list elements -- gdp
, pop
, temp
, and/or slr
-- each containing a data frame with a custom scenario for GDP, state population, temperature, and/or GMSL, respectively. If inputsList = NULL
or inputsList = list()
(default), run_fredi()
uses default trajectories for GDP, population, temperature, and SLR (see gdpDefault, popDefault, and gcamScenarios for more information). run_fredi()
will default back to the default scenarios for any list elements that empty or NULL
(in other words, running run_fredi(inputsList = list())
returns the same outputs as running run_fredi()
).
GDP Inputs. The input scenario for gross domestic product (GDP) requires national GDP values in 2015$. GDP values must be greater than or equal to zero.
gdp
requires a data frame object with two columns with names "year"
, and "gdp_usd"
containing the year and the national GDP, respectively. GDP values must be greater than or equal to zero.
GDP inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for GDP (i.e., inputsList = list(gdpInput = NULL)
, run_fredi()
uses a default GDP scenario.
+If the user does not specify an input scenario for GDP (i.e., inputsList = list(gdp = NULL)
, run_fredi()
uses a default GDP scenario.
-Population Inputs. The input population scenario requires state-level population values. Population values must be greater than or equal to zero.
popInput
requires a data frame object with five columns with names "region"
, "state"
, "postal"
, "year"
, and "state"
containing the year, the NCA region name, the state name, the postal code abbreviation for the state, and the state population, respectively.
+Population Inputs. The input population scenario requires state-level population values. Population values must be greater than or equal to zero.
pop
requires a data frame object with five columns with names "region"
, "state"
, "postal"
, "year"
, and "pop"
containing the year, the NCA region name (one of "Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
), the state name, the postal code abbreviation for the state, and the state population, respectively.
Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for population (i.e., inputsList = list(popInput = NULL)
, run_fredi()
uses a default population scenario.
+If the user does not specify an input scenario for population (i.e., inputsList = list(pop = NULL)
, run_fredi()
uses a default population scenario.
+
+Temperature Inputs. The input temperature scenario requires CONUS temperatures in degrees Celsius relative to 1995 (degrees of warming relative to the baseline year--i.e., the central year of the 1986-2005 baseline). CONUS temperature values must be greater than or equal to zero degrees Celsius.
Users can convert global temperatures to CONUS temperatures using convertTemps(from = "global")
(or by specifying import_inputs(temptype = "global")
when using import_inputs()
to import a temperature scenario from a CSV file).
+temp
requires a data frame object with two columns with names "year"
, and "temp_C"
containing the year and CONUS temperatures in degrees Celsius, respectively.
+Temperature inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+If the user does not specify an input scenario for temperature (i.e., inputsList = list(temp = NULL)
, run_fredi()
uses a default temperature scenario.
+
+SLR Inputs. The input SLR scenario requires values for changes in global mean sea level rise (GMSL) heights in centimeters (cm). GMSL heights must be greater than or equal to zero.
slr
requires a data frame object with two columns with names "year"
, "slr_cm"
containing the year and global mean sea level rise (GMSL) in centimeters, respectively.
+SLR inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+If the user does not specify an input scenario for SLR (i.e., inputsList = list(slr = NULL)
, run_fredi()
first converts the input or default CONUS temperature scenario to global temperatures (using convertTemps()
) and then converts the global temperatures to a global mean sea level rise (GMSL) height in centimeters (using temps2slr()
).
-
run_fredi()
linearly interpolates missing annual values for all input scenarios using non-missing values (each scenario requires at least two non-missing values as detailed above for each scenario type). After interpolation of the input scenarios, run_fredi()
subsets the input scenarios to values within the analysis period.
Temperatures are interpolated using 1995 as the baseline year (i.e., the central year of the 1986-2005 baseline) and GMSL is interpolated using 2000 as the baseline year. In other words, temperature (in degrees Celsius) is set to zero for the year 1995, whereas GMSL is set to zero for the year 2000. The interpolated temperature and GMSL scenarios are combined into a column called driverValue
, along with additional columns for year, the driver unit (column "driverUnit"
, with driverUnit = "degrees Celsius"
and driverUnit = "cm"
for temperature- and SLR-driven sectors, respectively), and the associated model type (column "model_type"
, with model_type = "GCM"
and model_type = "SLR"
for temperature- and SLR-driven sectors, respectively
-run_fredi()
calculations national population from state-level values and then calculates GDP per capita from values for GDP and national population. Values for state population, national population, national GDP (in 2015$), and national per capita GDP (in 2015$/capita) are provided in the results data frame in columns "state_pop"
, "national_pop"
, "gdp_usd"
, and "gdp_percap"
, respectively.
+
run_fredi()
linearly interpolates missing annual values for all input scenarios using non-missing values (each scenario requires at least two non-missing values as detailed above for each scenario type). After interpolation of the input scenarios, run_fredi()
subsets the input scenarios to values within the analysis period.
Temperatures are interpolated using 1995 as the baseline year (i.e., the central year of the 1986-2005 baseline) and GMSL is interpolated using 2000 as the baseline year. In other words, temperature (in degrees Celsius) is set to zero for the year 1995, whereas GMSL is set to zero for the year 2000. The interpolated temperature and GMSL scenarios are combined into a column called driverValue
, along with additional columns for year, the driver unit (column "driverUnit"
, with driverUnit = "degrees Celsius"
and driverUnit = "cm"
for temperature- and SLR-driven sectors, respectively), and the associated model type (column "model_type"
, with model_type = "GCM"
and model_type = "SLR"
for temperature- and SLR-driven sectors, respectively.
+run_fredi()
calculates national population from state-level values and then calculates GDP per capita from values for GDP and national population. Values for state population, national population, national GDP (in 2015$), and national per capita GDP (in 2015$/capita) are provided in the results data frame in columns "pop"
, "national_pop"
, "gdp_usd"
, and "gdp_percap"
, respectively.
By default, run_fredi()
will calculate impacts for all sectors included in the tool. Alternatively, users can pass a character vector specifying a single sector or a subset of sectors using the sectorList
argument. To see a list of sectors included within FrEDI, run get_sectorInfo()
. If sectorList = NULL
(default), all sectors are included.
By default, run_fredi()
calculates impacts starting in the year 2010 and ending in 2100. Specify an alternative end year for the analysis using the maxYear
argument. maxYear
has a default value of 2100
and minimum and maximum values of 2011
and 2300
, respectively. Alternatively, users can set argument thru2300 = TRUE
to override the maxYear
argument and set maxYear = 2300
. Note that the default scenarios included within FrEDI stop in the year 2100; users must provide custom input scenarios out to the desired end year and specify a maxYear >= 2100
(and maxYear <= 2300
) in order to return non-missing values for years after 2100.
Annual impacts for each sector, variant, impact type, and impact year combination included in the model are calculated by multiplying scaled climate impacts by a physical scalar and economic scalars and multipliers. Some sectors use Value of a Statistical Life (VSL) to adjust the value non-linearly over time. run_fredi()
uses a default value of elasticity = 1
to adjust VSL for applicable sectors and impacts (the default value of elasticity = 1
keeps VSL constant over time). A custom elasticity can be passed to the elasticity
argument. Applicable sectors and impacts are *Climate-Driven Changes in Air Quality (all impact types), ATS Temperature-Related Mortality (impactType = "N/A"
; i.e., all impact types), CIL Temperature-Related Mortality, Extreme Temperature (all impact types), Suicide (impactType = "N/A"
; i.e., all impact types), Southwest Dust (impactType = "All Mortality"
), Valley Fever (impactType = "Mortality"
), Vibriosis (impactType = "N/A"
; i.e., all impact types), and Wildfire (impactType = "Mortality"
).
run_fredi()
aggregates or summarizes results to level(s) of aggregation specified by the user (passed to aggLevels
) using the post-processing helper function aggregate_impacts()
. Users can specify all aggregation levels at once by specifying aggLevels = "all"
(default) or no aggregation levels (aggLevels = "none"
). Users can specify a single aggregation level or multiple aggregation levels by passing a single character string or character vector to aggLevels
. Options for aggregation include calculating national totals (aggLevels = "national"
), averaging across model types and models (aggLevels = "modelaverage"
), summing over all impact types (aggLevels = "impacttype"
), and interpolating between impact year estimates (aggLevels = "impactYear"
).
-If the user specifies aggLevels = "none"
, run_fredi()
returns a data frame with columns: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, "state_pop"
, "year"
, "physical_impacts"
, and "annual_impacts"
.
Columns "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, and "model"
all contain observation identifiers (sector name, variant, impact type, impact year, region, state, state postal code abbreviation, model type, and model, respectively).
+If the user specifies aggLevels = "none"
, run_fredi()
returns a data frame with columns: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, "pop"
, "year"
, "physical_impacts"
, and "annual_impacts"
.
Columns "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, and "model"
all contain observation identifiers (sector name, variant, impact type, impact year, region, state, state postal code abbreviation, model type, and model, respectively).
Columns "sectorprimary"
and "includeaggregate"
contain values that provide information about how to treat sectors and when aggregating over sectors (e.g., summing impacts across sectors). Note that FrEDI does not currently provide functionality to aggregate over sectors; this information is provided for user convenience.
Column "sectorprimary"
contains values indicating which variant to use as the primary one for each sector: sectorprimary = 1
for primary variants and sectorprimary = 0
for non-primary variants. When aggregating impacts over sectors, users should filter the outputs of run_fredi()
to variants with sectorprimary == 1
.
Column "includeaggregate"
contains values that provide information about how to treat sectors when aggregating over sectors (e.g., summing impacts across sectors). Sectors that have a value of includeaggregate == 0
should be dropped when aggregating results over sectors, to avoid potential double-counting of impacts for similar sectors. For instance, sectors ATS Temperature-Related Mortality, CIL Temperature-Related Mortality, and Extreme Temperature have values for temperature-related mortality. To avoid double counting, outputs of run_fredi()
should be filtered to values for which includeaggregate > 0
. Sectors with a value of includeaggregate > 0
can be included when aggregating over sectors; most sectors with a value of includeaggregate > 0
will have a value of includeaggregate = 1
. Values of includeaggregate > 1
flag additional information about sectors; currently, only the Suicide sector has a value of includeaggregate > 1
, with a value of includeaggregate = 2
. This flag indicates that the impacts from Suicide can be included when summing values across sectors, but may have some overlap with impacts from ATS Temperature-Related Mortality. For more information about the potential overlap between impacts for ATS Temperature-Related Mortality and Suicide, visit the technical documentation at https://epa.gov/cira/FrEDI/,
Columns "driverType"
, "driverUnit"
, and "driverValue"
contain information about the temperature and SLR scenarios.
-Columns "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "state_pop"
contain information about the GDP and population scenarios.
+Columns "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "pop"
contain information about the GDP and population scenarios.
Columns "physicalmeasure"
and "physical_impacts"
contain information about physical impacts.
Column "annual_impacts"
contains information on the economic value associated with annual impacts.
If the user specifies aggLevels = "all"
or other combinations of aggregation levels, run_fredi()
passes the results data frame and the aggLevels
argument to the aggregate_impacts()
function. aggregate_impacts()
then performs the following calculations, using the default grouping columns for the aggregate_impacts()
: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, and "year"
(note that the "variant"
column referred to below contains information about the variant name (or “N/A”
), as applicable).
-Aggregation Level Description impactyear
To aggregate over impact years, aggregate_impacts()
first separates results for sectors with only one impact year estimate (i.e., impactYear = "N/A"
) from from observations with multiple impact year estimates (i.e., sectors with results for both impactYear = "2010"
and impactYear = "2090"
). For these sectors with multiple impact years, physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
) are linearly interpolated between impact year estimates. For any model run years above 2090, annual results for sectors with multiple impact years return the 2090 estimate. The interpolated values are then row-bound to the results for sectors with a single impact year estimate, and column impactYear
set to impactYear = "Interpolation"
for all values. If "impactyear"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
aggregates over impact years before performing other types of aggregation. modelaverage
To aggregate over models for temperature-driven sectors, aggregate_impacts()
averages physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all GCM models present in the data. aggregate_impacts()
drops the column "model"
from the grouping columns when averaging over models. Averages exclude observations with missing values. However, If all values within a grouping are missing, the model average is set to NA
. The values in column "model"
are set to "Average"
for model averages and the model averages data frame is then row-bound to the main results data frame. For SLR-driven sectors, there is no need for additional model aggregation; these values already have model = "Interpolation"
. If "modelaverage"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years (if "impactyear"
present in aggLevels
or if aggLevels = "all"
) before aggregating over models. national
To aggregate values to the national level, aggregate_impacts()
sums physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all states present in the data. aggregate_impacts()
drops the columns "region"
, "state"
, and "postal"
when summing over states and regions. Years which have missing column data for all regions return as NA
. Values for columns "region"
, "state"
, and "postal"
are set to "National Total"
, All
, and US
, respectively. The data frame with national totals is then row-bound to the main results data frame. If "national"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years and/or models (if "impactyear"
and/or "modelaverage"
are present in aggLevels
or if aggLevels = "all"
) before aggregating over models. impacttype
To aggregate values over impact types, aggregate_impacts()
sums annual impacts (column "annual_impacts"
) across all impact types for each sector. aggregate_impacts()
drops the column "impactType"
and "physicalmeasure"
from the grouping columns when summing over impact types. Years which have missing column data for all impact types return as NA
. All values in column "impactType"
are set to "all"
. Aggregating over impact types, drops columns related to physical impacts (i.e., columns "physicalmeasure"
and "physical_impacts"
). These columns are dropped since aggregating over impact types for some sectors requires summing costs over different types of physical impacts, so reporting the physical impacts would be nonsensical.
After aggregating values, aggregate_impacts()
joins the data frame of impacts with information about "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "state_pop"
.
+Aggregation Level Description impactyear
To aggregate over impact years, aggregate_impacts()
first separates results for sectors with only one impact year estimate (i.e., impactYear = "N/A"
) from from observations with multiple impact year estimates (i.e., sectors with results for both impactYear = "2010"
and impactYear = "2090"
). For these sectors with multiple impact years, physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
) are linearly interpolated between impact year estimates. For any model run years above 2090, annual results for sectors with multiple impact years return the 2090 estimate. The interpolated values are then row-bound to the results for sectors with a single impact year estimate, and column impactYear
set to impactYear = "Interpolation"
for all values. If "impactyear"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
aggregates over impact years before performing other types of aggregation. modelaverage
To aggregate over models for temperature-driven sectors, aggregate_impacts()
averages physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all GCM models present in the data. aggregate_impacts()
drops the column "model"
from the grouping columns when averaging over models. Averages exclude observations with missing values. However, If all values within a grouping are missing, the model average is set to NA
. The values in column "model"
are set to "Average"
for model averages and the model averages data frame is then row-bound to the main results data frame. For SLR-driven sectors, there is no need for additional model aggregation; these values already have model = "Interpolation"
. If "modelaverage"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years (if "impactyear"
present in aggLevels
or if aggLevels = "all"
) before aggregating over models. national
To aggregate values to the national level, aggregate_impacts()
sums physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all states present in the data. aggregate_impacts()
drops the columns "region"
, "state"
, and "postal"
when summing over states and regions. Years which have missing column data for all regions return as NA
. Values for columns "region"
, "state"
, and "postal"
are set to "National Total"
, All
, and US
, respectively. The data frame with national totals is then row-bound to the main results data frame. If "national"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years and/or models (if "impactyear"
and/or "modelaverage"
are present in aggLevels
or if aggLevels = "all"
) before aggregating over models. impacttype
To aggregate values over impact types, aggregate_impacts()
sums annual impacts (column "annual_impacts"
) across all impact types for each sector. aggregate_impacts()
drops the column "impactType"
and "physicalmeasure"
from the grouping columns when summing over impact types. Years which have missing column data for all impact types return as NA
. All values in column "impactType"
are set to "all"
. Aggregating over impact types, drops columns related to physical impacts (i.e., columns "physicalmeasure"
and "physical_impacts"
). These columns are dropped since aggregating over impact types for some sectors requires summing costs over different types of physical impacts, so reporting the physical impacts would be nonsensical.
After aggregating values, aggregate_impacts()
joins the data frame of impacts with information about "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "pop"
.
If outputList = FALSE
(default), run_fredi()
returns a data frame of annual average impacts over the analysis period, for each sector, variant, impact type, impact year, region, state, model type ("GCM"
or "SLR"
), and model. If outputList = TRUE
, in addition to the data frame of impacts, run_fredi()
returns a list object containing information about values for function arguments, driver scenarios, and population and GDP scenarios.
@@ -190,16 +190,15 @@ Examples### Load FrEDI
require(FrEDI)
-### Run function with defaults (same as `defaultResults` dataset)
+### Run function with defaults
run1 <- run_fredi()
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from defaults...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -207,62 +206,71 @@ Examplesdata("gcamScenarios")
gcamScenarios |> glimpse()
#> Rows: 606
-#> Columns: 4
-#> $ year <int> 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2…
-#> $ temp_C <dbl> 0.1269649, 0.1575513, 0.1858310, 0.2101611, 0.2306551, 0.2444…
-#> $ slr_cm <dbl> 0.0000000, 0.2727356, 0.5552278, 0.8458496, 1.1430287, 1.4440…
-#> $ scenario <chr> "Hector_GCAM_v5.3_ECS_3.0_REF", "Hector_GCAM_v5.3_ECS_3.0_REF…
+#> Columns: 6
+#> $ year <int> 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20…
+#> $ temp_C_conus <dbl> 0.1804171, 0.2238804, 0.2640659, 0.2986389, 0.3277609, 0…
+#> $ temp_C_global <dbl> 0.1269649, 0.1575513, 0.1858310, 0.2101611, 0.2306551, 0…
+#> $ slr_cm <dbl> 0.0000000, 0.2727356, 0.5552278, 0.8458496, 1.1430287, 1…
+#> $ scenario <chr> "ECS_3.0_REF", "ECS_3.0_REF", "ECS_3.0_REF", "ECS_3.0_RE…
+#> $ model <chr> "Hector_GCAM_v5.3", "Hector_GCAM_v5.3", "Hector_GCAM_v5.…
### Load population scenario and glimpse data
-data(popScenario)
-popScenario |> glimpse()
+data("popDefault")
+popDefault |> glimpse()
#> Rows: 14,259
#> Columns: 5
-#> $ year <dbl> 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, …
#> $ region <chr> "Southeast", "Southeast", "Southeast", "Southeast", "Southea…
#> $ state <chr> "Alabama", "Alabama", "Alabama", "Alabama", "Alabama", "Alab…
#> $ postal <chr> "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", …
+#> $ year <int> 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, …
#> $ state_pop <dbl> 4779736, 4823623, 4867509, 4911396, 4955282, 4999169, 503604…
### Subset climate scenario
-temps1 <- gcamScenarios |> filter(scenario=="Hector_GCAM_v5.3_ECS_3.0_ref")
-temps1 <- temps1 |> mutate(temp_C = temp_C_global |> convertTemps(from="global"))
-#> Error in mutate(temps1, temp_C = convertTemps(temp_C_global, from = "global")): ℹ In argument: `temp_C = convertTemps(temp_C_global, from = "global")`.
-#> Caused by error:
-#> ! object 'temp_C_global' not found
-temps1 <- temps1 |> select(year, temp_C)
+temps1 <- gcamScenarios |> filter(scenario=="ECS_3.0_ref")
+temps1 <- temps1 |> select(year, temp_C_conus)
### Run custom scenario
-run2 <- run_fredi(inputsList=list(tempInput=temps1, popInput=popScenario))
-#> Checking input values...
-#> Creating temperature scenario from user inputs...
-#> Error in map(regions0, function(region_i) { df_i <- filter(data, region == region_i) x_i <- df_i[["year"]] y_i <- df_i[[column0]] new_i <- approx(x = x_i, y = y_i, xout = years, rule = rule, method = method) new_i <- as_tibble(new_i) new_i <- rename_at(new_i, c(cols0), ~cols1) new_i <- mutate(new_i, region = region_i) return(new_i)}): ℹ In index: 1.
-#> Caused by error in `approx()`:
-#> ! need at least two non-NA values to interpolate
+run2 <- run_fredi(inputsList=list(temp=temps1, pop=popDefault))
+#> Checking scenarios...
+#>
+#> Checking input values for pop inputs...
+#> Column "pop" not found in popfile data!
+#> Looking for columns with matches to the string "pop"...1 match found!
+#> Using column "", and renaming to "pop"...
+#> Data is missing the following required columns: state_pop!
+#> Dropping pop inputs from outputs.
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
+#>
+#> Finished.
### Load scenarios from file:
scenariosPath <- system.file(package="FrEDI") |> file.path("extdata","scenarios")
scenariosPath |> list.files()
-#> [1] "GCAM_scenario.csv" "State ICLUS Population.csv"
-#> [3] "slr_from_GCAM.csv"
+#> [1] "gcamDefault.csv" "gcamScenarios.csv" "gdpDefault.csv"
+#> [4] "popDefault.csv"
### SLR Scenario File Name
-slrInputFile <- scenariosPath |> file.path("slr_from_GCAM.csv")
+slrInputFile <- scenariosPath |> file.path("gcamDefault.csv")
### Population Scenario File Name
-popInputFile <- scenariosPath |> file.path("State ICLUS Population.csv")
+popInputFile <- scenariosPath |> file.path("popDefault.csv")
### Import inputs
-x_inputs <- import_inputs(slrfile=slrInputFile, popfile=popInputFile, popArea="state")
+x_inputs <- import_inputs(inputsList=list(slr=slrInputFile, pop=popInputFile), popArea="state")
#>
#> In import_inputs():
#> Loading data...
#> User specified slrfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/slr_from_GCAM.csv...
+#> Importing data from C:/Users/knoiva/AppData/Local/R/win-library/4.4/FrEDI/extdata/scenarios/gcamDefault.csv...
#> Data loaded.
#> User specified popfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/State ICLUS Population.csv...
+#> Importing data from C:/Users/knoiva/AppData/Local/R/win-library/4.4/FrEDI/extdata/scenarios/popDefault.csv...
#> Data loaded.
#>
#> Checking input values...
@@ -271,23 +279,37 @@ Examples#> Values passed.
#>
#> Checking input values for pop inputs...
-#> Column "pop" not found in popfile data!
-#> Looking for columns with matches to the string "pop"...1 match found!
-#> Using column "state_pop", and renaming to "state_pop"...
+#> Checking that all states, etc. are present...
+#>
+#> Checking inputs for unique regions, states...
+#> All regions present...
+#> All states present...
#> Values passed.
#>
#> Finished.
### Run custom scenarios
run3 <- run_fredi(inputsList=x_inputs)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
+#> Checking scenarios...
+#>
+#> Checking input values for slr inputs...
+#> Values passed.
+#>
+#> Checking input values for pop inputs...
+#> Checking that all states, etc. are present...
+#>
+#> Checking inputs for unique regions, states...
+#> All regions present...
+#> All states present...
+#> Values passed.
#> Creating SLR scenario from user inputs...
-#> No GDP scenario provided...Using default GDP scenario...
#> Creating population scenario from user inputs...
-#> Updating scalars...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -321,32 +343,37 @@ Examples
### Run for a single sector, with default inputs, no aggregation, and elasticity=1:
run4 <- run_fredi(sectorList="ATS Temperature-Related Mortality", aggLevels="none", elasticity=1)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from defaults...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
#> Formatting results...
#>
#> Finished.
### Set end year for analysis to 2110 -- messages user and returns a null value since default scenarios only have values out to 2100
run5 <- run_fredi(maxYear=2110)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Temperature scenario must have at least one non-missing value in or after the year 2110...
+#> Checking scenarios...
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
#>
-#> Exiting...
+#> Finished.
### Set end year for analysis to 2300 -- messages user and returns a null value since default scenarios only have values out to 2100)
run6 <- run_fredi(thru2300=TRUE)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Temperature scenario must have at least one non-missing value in or after the year 2300...
+#> Checking scenarios...
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
#>
-#> Exiting...
+#> Finished.
@@ -358,11 +385,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/run_fredi_sv.html b/docs/reference/run_fredi_sv.html
index 082f5c36..f234cad7 100644
--- a/docs/reference/run_fredi_sv.html
+++ b/docs/reference/run_fredi_sv.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -77,8 +77,7 @@
Usage
run_fredi_sv(
sector = NULL,
- driverInput = NULL,
- popInput = NULL,
+ inputsList = list(pop = NULL, temp = NULL, slr = NULL),
silent = TRUE,
.testing = FALSE
)
@@ -90,22 +89,22 @@ Argumentsget_sv_sectorInfo() for a list of available sectors).
-- driverInput
-A data frame of up to four custom scenarios for drivers (temperature or global mean sea level rise). driverInput
requires a data frame with columns of "year"
and "scenario"
. The data frame must also include a third column: "temp_C"
for temperature-driven sectors (containing temperature values in degrees Celsius of warming for the contiguous U.S.) or "slr_cm"
for sea level rise (SLR)-driven sectors (containing values for global mean sea level rise in centimeters). Run get_sv_sectorInfo(gcmOnly=TRUE)
to see temperature-driven sectors in the SV module and get_sv_sectorInfo(slrOnly=TRUE)
to see SLR-driven scenarios. Users can also pass a data frame with all four columns ("year"
, "scenario"
, "temp_C"
, and "slr_cm"
), in which case run_fredi_sv()
determines whether to use the "temp_C"
or "slr_cm"
column as the driver trajectory based on the specified sector. Driver inputs for all scenarios should start in the year 2000 or earlier. All scenarios must include at least two non-missing values (especially values before or at 2000 and at or after 2100). If any required columns are missing, run_fredi_sv()
will use the default temperature or sea level rise scenario from run_fredi()
. If the data frame passed to driverInput
has more than four unique scenarios, run_fredi_sv()
will only run the first four scenarios.
+- silent
+A logical (TRUE/FALSE
) value indicating the level of messaging desired by the user (defaults to silent=TRUE
)
-- popInput
-The input population scenario requires a data frame object with a single scenario of state-level population values.
The population scenario must have five columns with names "year"
, "region"
, "state"
, "postal"
, and "state_pop"
containing the year, the NCA region name, the state name, the postal code abbreviation (e.g., "ME" for "Maine") for the state, and the state population, respectively.
-popInput
only accepts a a single scenario, in contrast to driverInput
. In other words, run_fredi_sv()
uses the same population scenario for any and all driver scenarios passed to driverInput
.
-If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario.
+- inputsList=list(pop=NULL, temp=NULL, slr=NULL)
+A list with named elements (pop
, temp
, and/or slr
), each containing data frames of custom scenarios for state-level population, temperature, and/or global mean sea level rise (GMSL) trajectories, respectively, over a continuous period. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
pop. The input population scenario requires a data frame object with a single scenario of population values for each of the 48 U.S. states and the District of Columbia comprising the contiguous U.S. (CONUS).
The population scenario must have five columns with names "region"
, "state"
, "postal"
, "year"
, and "_pop"
containing the NCA region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
), the state name, the two-letter postal code abbreviation for the state (e.g., "ME"
for Maine), the year, and the state population, respectively.
+The input population scenario can only contain a single scenario, in contrast to values for temperature or SLR inputs. In other words, run_fredi_sv()
uses the same population scenario when running any and all of the temperature or SLR scenarios passed to run_fredi_sv()
.
+If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario (see documentation for popScenario).
Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (2100).
Population values must be greater than or equal to zero.
+
+temp or slr. The input temperature or SLR scenario should be a data frame containing one or more custom scenarios. These inputs should be formulated similarly to those for run_fredi()
and import_inputs()
, with an additional column (scenario
) indicating the unique scenario identifier. Temperature and/or SLR input scenarios must have at least one non-missing value in the year 2000 or earlier and at least one non-missing value in or after the final analysis year (2100).
temp. Temperature inputs are used by run_fredi_sv()
with temperature-driven sectors; run get_sv_sectorInfo(gcmOnly=TRUE)
to get a list of the temperature-driven sectors available for the SV module. Temperature inputs require a data frame with columns of year
, temp_C
, and scenario
, respectively containing the year associated with an observation, temperature values for CONUS in degrees Celsius of warming relative to a 1995 baseline (where 1995 is the central year of a 1986-2005 baseline period -- i.e., values should start at zero in the year 1995), and a unique scenario identifier. If no temperature scenario is specified (i.e., inputsList$temp
is NULL
) when running a temperature-driven sector, run_fredi_sv()
will use a default temperature scenario (see FrEDI:gcamScenarios).
+slr. SLR inputs are used by run_fredi_sv()
with sea level rise-driven sectors; run get_sv_sectorInfo(slrOnly=TRUE)
to get a list of the SLR-driven sectors available for the SV module. SLR inputs require a data frame with columns of year
, slr_cm
, and scenario
, respectively containing the global mean sea level rise in centimeters relative to a 2000 baseline (i.e., values should start at zero in the year 2000), and a unique scenario identifier. If no SLR scenario is specified (i.e., inputsList$slr
is NULL
) when running a temperature-driven sector: if a user has supplied a temperature scenario (i.e., inputsList$temp
is not NULL
), run_fredi_sv()
will calculate sea level rise values from the temperature inputs using the temps2slr()
function; if no temperature scenario is provided, run_fredi_sv
will use a default SLR scenario (see FrEDI:gcamScenarios).
+
-
-- silent
-A logical (TRUE/FALSE
) value indicating the level of messaging desired by the user (defaults to silent=TRUE
).
-
Value
@@ -117,17 +116,8 @@ Value
Details
run_fredi_sv()
projects annual climate change impacts for socially vulnerable (SV) populations throughout the 21st century (2010-2100) for available sectors, using default or user-specified population, temperature, and sea level rise (SLR) trajectories. run_fredi_sv()
is the main function for the FrEDI Social Vulnerability (SV) module in the FrEDI R package, described elsewhere (See https://epa.gov/cira/FrEDI for more information). The SV module extends the FrEDI framework to socially vulnerable populations using data underlying a 2021 U.S. Environmental Protection Agency (EPA) report on Climate Change and Social Vulnerability in the United States.
Users can run run_fredi_sv()
to generate annual physical impacts for SV groups for individual sectors. When running run_fredi_sv()
, users must specify one of the sectors in the SV module; use get_sv_sectorInfo()
for a list of available sectors.
-run_fredi_sv()
can be run with default population and climate (temperature and SLR) trajectories or use run_fredi_sv()
to run custom scenarios. Running run_fredi_sv()
with custom climate scenarios requires passing a data frame of scenarios to the driverInput
argument. run_fredi_sv()
can also be run with a custom population scenario by passing a data frame of regional population trajectories to the popInput
argument; unlike climate scenarios, run_fredi_sv()
will only run a single scenario at a time.
driverInput
can take a data frame containing up to four custom scenarios for drivers (temperature or global mean sea level rise). driverInput
requires a data frame with columns of "year"
and "scenario"
. The data frame must also include a third column: "temp_C"
for temperature-driven sectors (containing temperature values in degrees Celsius of warming for the contiguous U.S.) or "slr_cm"
for sea level rise (SLR)-driven sectors (containing values for global mean sea level rise in centimeters). Run get_sv_sectorInfo(gcmOnly = TRUE)
to see temperature-driven sectors in the SV module and get_sv_sectorInfo(slrOnly = TRUE)
to see SLR-driven scenarios. Users can also pass a data frame with all four columns ("year"
, "scenario"
, "temp_C"
, and "slr_cm"
), in which case run_fredi_sv()
determines whether to use the "temp_C"
or "slr_cm"
column as the driver trajectory based on the specified sector. If any required columns are missing, run_fredi_sv()
will use the default temperature or sea level rise scenario from run_fredi()
. If the data frame passed to driverInput
has more than four unique scenarios, run_fredi_sv()
will only run the first four scenarios.
Temperature inputs must be temperature change in degrees Celsius for the contiguous U.S. (use convertTemps()
to convert global temperatures to CONUS temperatures before passing to driverInput
) relative to a 1995 baseline (where 1995 is the central year of a 1986-2005 baseline period; values should start at zero in the year 1995).
-Sea level rise inputs must be in centimeters relative to a 2000 baseline (i.e., values should start at zero in the year 2000). Driver inputs for all scenarios should start in the year 2000 or earlier. All scenarios must include at least two non-missing values (especially values before or at 2000 and at or after 2100).
-
-The input population scenario requires a data frame object with a single scenario of state-level population values.
The population scenario must have five columns with names "year"
, "region"
, "state"
, "postal"
, and "state_pop"
containing the year, the NCA region name, the state name, the postal code abbreviation (e.g., "ME" for "Maine") for the state, and the state population, respectively.
-popInput
only accepts a a single scenario, in contrast to driverInput
. In other words, run_fredi_sv()
uses the same population scenario for any and all driver scenarios passed to driverInput
.
-If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario.
-Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (2100).
-Population values must be greater than or equal to zero.
-The default regional population scenario is drawn from the Integrated Climate and Land Use Scenarios version 2 (ICLUSv2) model (Bierwagen et al, 2010; EPA 2017) under the Median variant projection of United Nations (United Nations, 2015). Note that the FrEDI SV default population scenario differs from the default population scenario used by run_fredi()
.
-
-
The output of run_fredi_sv()
is an R data frame object containing average annual physical impacts for socially vulnerable groups, at the NCA region level and five-year increments.
+run_fredi_sv()
can be run with default population and climate (temperature and SLR) trajectories or use run_fredi_sv()
to run custom scenarios. Running run_fredi_sv()
with custom climate scenarios requires passing a data frame of scenarios to the driverInput
argument. run_fredi_sv()
can also be run with a custom population scenario by passing a data frame of regional population trajectories to the popInput
argument; unlike climate scenarios, run_fredi_sv()
will only run a single scenario at a time.
+The output of run_fredi_sv()
is an R data frame object containing average annual physical impacts for socially vulnerable groups, at the NCA region level and five-year increments.
References
@@ -141,163 +131,18 @@ References
Examples
- ### Run SV Module with defaults without specifying sector
-df_sv <- run_fredi_sv()
-#> [1] "Please select a sector: "
-#> [1] "1. Air Quality - Childhood Asthma"
-#> [1] "2. Air Quality - Premature Mortality"
-#> [1] "3. Labor"
-#> [1] "4. Extreme Temperature"
-#> [1] "5. Roads"
-#> [1] "6. Transportation Impacts from High Tide Flooding"
-#> [1] "7. Coastal Properties"
-#> Warning: type 29 is unimplemented in 'type2char'
-#> Error in readline(prompt = sector_msg3): INTEGER() can only be applied to a 'integer', not a 'unknown type #29'
-
-### Return a character vector with the names of all of the sectors in the FrEDI SV Module:
-get_sv_sectorInfo()
-#> [1] "Air Quality - Childhood Asthma"
-#> [2] "Air Quality - Premature Mortality"
-#> [3] "Coastal Properties"
-#> [4] "Extreme Temperature"
-#> [5] "Labor"
-#> [6] "Roads"
-#> [7] "Transportation Impacts from High Tide Flooding"
-
-### Return a data frame of all of the sectors in the FrEDI SV Module (sector names and additional information)
-get_sv_sectorInfo(description=T)
-#> sector modelType driverUnit
-#> 1 Air Quality - Childhood Asthma GCM degrees Celsius
-#> 2 Air Quality - Premature Mortality GCM degrees Celsius
-#> 3 Coastal Properties SLR cm
-#> 4 Extreme Temperature GCM degrees Celsius
-#> 5 Labor GCM degrees Celsius
-#> 6 Roads GCM degrees Celsius
-#> 7 Transportation Impacts from High Tide Flooding SLR cm
-#> impactUnit
-#> 1 Childhood asthma cases
-#> 2 Premature Mortality
-#> 3 Individuals threatened with total property loss
-#> 4 Mortality
-#> 5 Hours of labor lost
-#> 6 Hours of delay
-#> 7 Hours of delay
-#> variants
-#> 1 N/A
-#> 2 N/A
-#> 3 Without Adaptation, With Adaptation
-#> 4 N/A
-#> 5 N/A
-#> 6 No Adaptation, Proactive Adaptation
-#> 7 Without Adaptation, With Adaptation
-
-### Run SV Module with defaults for "Coastal Properties" without saving
-df_sv <- run_fredi_sv(sector="Coastal Properties")
-#> Running FrEDI SV for sector 'Coastal Properties':
-#>
-#> Preparing driver scenario...
-#> Using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#>
-#> Preparing population scenario...
-#> Using default population scenario...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Coastal Properties", variant="Without Adaptation", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#>
-#> Calculating impacts for sector="Coastal Properties", variant="With Adaptation", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-### Run SV Module with defaults for "Extreme Temperature" without saving
-df_sv <- run_fredi_sv(sector="Extreme Temperature")
-#> Running FrEDI SV for sector 'Extreme Temperature':
-#>
-#> Preparing driver scenario...
-#> Using default temperature scenario...
-#>
-#> Preparing population scenario...
-#> Using default population scenario...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-### Load temperature scenarios
-load(gcamScenarios)
-#> Error in load(gcamScenarios): bad 'file' argument
-
-### Load population scenario
-load(popScenario)
-#> Error in load(popScenario): bad 'file' argument
-
-### Run SV Module for "Extreme Temperature" with custom population and temperature scenarios
-df_sv <- run_fredi_sv(sector = "Extreme Temperature", driverInput = gcamScenarios, popInput = popScenario)
-#> Running FrEDI SV for sector 'Extreme Temperature':
-#> Checking `driverInput` values...
-#> Checking scenarios in `driverInput`...
-#> Warning: `driverInput` has more than four distinct scenarios!
-#> Only the first four scenarios will be used...
-#> Checking `driverInput` values for temperature scenario...
-#> All temperature scenario columns present...
-#> Checking `popInput` values...
-#> All population scenario columns present in `popInput`...
-#>
-#> Preparing driver scenario...
-#> Using temperature scenario from user inputs...
-#>
-#> Preparing population scenario...
-#> Creating population scenario from user inputs...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_20"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_30"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_50"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-
+
FrEDI
has been installed, users can also search for
function-specific documentation in RStudio through the Help
window. Move the focus to the Help window using the
@@ -174,29 +166,50 @@ FrEDI_SV
Runtime parameters
-# To run FrEDI_SV for more than one scenario, the code below can be
-# adapted into a loop to format the inputs for each scenario.
+
+### To run FrEDI_SV for more than one scenario, the code below can be
+### adapted into a loop to format the inputs for each scenario.
-#***********************************************
-#1. Specify & Format Input Trajectories (temperature, population, U.S. GDP)
+###***********************************************
+### 1. Specify & Format Input Trajectories (temperature, population, U.S. GDP)
-## Input Files
+### Input Files
+### Population input file
+### - Purpose: Specify the population trajectory to use as an input.
+### - Requires columns year, region, state, postal, and pop
+### - Default: if null, uses default population trajectory
+popInputFile <- NULL
+
+### * Temperature input file
+### - Description: csv file with time series of temperature relative to 1986-2005 average
+### - (units: degC, values: >=0)
+### - Data must start in 2000 or earlier and can be global or CONUS
+### - If global, must convert to CONUS temperature using the import_inputs() helper function
+### - Contains columns year, temp_C, scenario
tempInputFile <- NULL
-# Description: csv file with time series of temperature relative to 1986-2005 average
-# (units: degC, values: >=0)
-# data must start in 2000 or earlier and can be global or CONUS
-# If global --> must convert to CONUS temperature using the import_inputs() helper function
-# column 1 = 'year', column 2 = 'temp_C'
-temptypeflag <- 'global'
-# Description: Use this to specify whether the input temperature is global or CONUS
-# import_inputs() will convert to global to CONUS temperature
-# Options: global (input is global T), conus (input is CONUS T)
+### * Temperature type flag
+### - Description: Use this to specify whether the input temperature is global or CONUS
+### - import_inputs() will convert to global to CONUS temperature
+### - Options: global (input is global T), conus (input is CONUS T)
+### - Default: defaults to "conus"
+temptypeflag <- "global"
+### * Module flag
+### - Description: Use this to specify for which module to import inputs
+### - Options: fredi/methane/sv
+### - Default: Defaults to "fredi" if NULL
+moduleflag <- "sv"
-## Use the import_inputs() helper function to format the input trajectories for use in FrEDI
-inputs_list <- import_inputs(tempfile = tempInputFile)
+### Use the import_inputs() helper function to format the input trajectories for use in FrEDI
+inputs_list <- import_inputs(inputsList = list(
+ pop = popInputFile,
+ temp = tempInputFile
+ ),
+ module = moduleflag
+)
+inputs_list |> glimpse()
+## list()
If no input files are specified, run_fredi_sv()
will use
default temperature and U.S. regional population projections. In this
case, run_fredi_sv()
will calculate annual projected sea
@@ -211,43 +224,24 @@
Step 2. Set FrEDI_SV
Runtime parameters
-# Calculate the run_fredi_sv() results for a single impact sector
-
-# NOTE: the run_fredi_sv() module takes a few minutes to run because
-# the damages are calculated at the Census tract level and then
-# aggregated to the regional level
+
+### Calculate the run_fredi_sv() results for a single impact sector
-# take formatted temperature vector from the output of the
-# import_inputs() helper function
- temp_input <- inputs_list$tempInput
+### NOTE: the run_fredi_sv() module takes a few minutes to run because
+### the damages are calculated at the Census tract level and then
+### aggregated to the regional level
-# To see all available sectors, run:
-# FrEDI::get_sv_sectorInfo()
+### To see all available sectors, run: FrEDI::get_sv_sectorInfo()
-# Specify a specific sector
-sectorFlag = "Air Quality - Premature Mortality"
- # Purpose:
- # Specify the SV sector to calculate (can only run one sector at once)
- # Options: run FrEDI::get_sv_sectorInfo() to get a list of the
- # possible sectors
-driverFlag <- temp_input
- # Purpose:
- # Specify the temperature trajectory (up to 4) to use as an input.
- # Temperature needs to be in degrees C, *CONUS* temperature, relative
- # to the 1986-2005 average baseline
- # column 1 = 'year','column 2 = 'scenario', column 3 = 'temp_C'
- # NOTE: if temperature is in global degrees, use the
- # FrEDI::convertTemps() helper function to convert from global to CONUS
-popFlag <- NULL
- # Purpose:
- # Specify the population trajectory to use as an input.
- # column 1 = 'year', column 2 = 'region', column 3 = 'state', column 4 = 'postal', column 5 = 'state_pop'
- # default = if null, uses default population trajectory
-silentFlag = TRUE
- # Purpose:
- # Specify the level of messaging desired
- # Options: TRUE/FALSE
+### Sector Flag: Specify a specific sector
+### - Purpose: Specify the SV sector to calculate (can only run one sector at once)
+### - Options: Run FrEDI::get_sv_sectorInfo() to get a list of the possible sectors
+sectorFlag <- "Air Quality - Premature Mortality"
+
+### Silent Flag
+### - Purpose: Specify the level of messaging desired
+### - Options: TRUE/FALSE
+silentFlag <- TRUE
Step 3. Run FrEDI_SV
@@ -260,20 +254,23 @@ Step 3. Run FrEDI_SV
run_fredi(), as SV damage calculations are
conducted at finer spatial scales (e.g., U.S. Census tract vs. regional
level).
-
-#Run FrEDI using inputs and parameters set in Step #2
+
+### Run FrEDI using inputs and parameters set in Step 2
+output_sv <- run_fredi_sv(
+ sector = sectorFlag,
+ inputsList = inputs_list,
+ silent = silentFlag
+)
-output_df <- run_fredi_sv(sector = sectorFlag,
- driverInput = driverFlag,
- popInput = popFlag,
- silent = silentFlag)
+### Glimpse results
+output_sv |> glimpse()
-# Option: write output
-## Write Full Dataframe to CSV (or feather)
-# write.csv(output_df, './output/example_output.csv')
+### Option: write output
+### Write Full Dataframe to CSV (or feather)
+# write.csv(output_sv, './output/example_output.csv')
-#First five lines of output dataframe
-#output_df[1:5,]
+### First five lines of output dataframe
+# output_sv[1:5,]
Step 4. Analyze FrEDI_SV
@@ -294,11 +291,11 @@ Step 4. Analyze FrEDI_SV
diff --git a/docs/articles/References.html b/docs/articles/References.html
index b5ddb777..c4069184 100644
--- a/docs/articles/References.html
+++ b/docs/articles/References.html
@@ -28,7 +28,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -136,7 +136,7 @@ Example Applications
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/authors.html b/docs/authors.html
index e4588032..033f8515 100644
--- a/docs/authors.html
+++ b/docs/authors.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.1
+ 4.2.0
@@ -106,13 +106,13 @@ Citation
Hartin C, McDuffie E, Sarofim M, Noiva K (2024).
FrEDI: The Framework for Evaluating Damages and Impacts (FrEDI).
-R package version 4.1.1, https://epa.gov/cira/FrEDI/, https://github.com/USEPA/FrEDI/, https://usepa.github.io/FrEDI.
+R package version 4.2.0, https://epa.gov/cira/FrEDI/, https://github.com/USEPA/FrEDI/, https://usepa.github.io/FrEDI.
@Manual{,
title = {FrEDI: The Framework for Evaluating Damages and Impacts (FrEDI)},
author = {Corinne Hartin and Erin McDuffie and Marcus Sarofim and Karen Noiva},
year = {2024},
- note = {R package version 4.1.1, https://epa.gov/cira/FrEDI/, https://github.com/USEPA/FrEDI/},
+ note = {R package version 4.2.0, https://epa.gov/cira/FrEDI/, https://github.com/USEPA/FrEDI/},
url = {https://usepa.github.io/FrEDI},
}
diff --git a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyC0ITw.woff2 b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyC0ITw.woff2
index 6478b9ad..f4675de1 100644
Binary files a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyC0ITw.woff2 and b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyC0ITw.woff2 differ
diff --git a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCAIT5lu.woff2 b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCAIT5lu.woff2
index dee82d4b..7ac6ae08 100644
Binary files a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCAIT5lu.woff2 and b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCAIT5lu.woff2 differ
diff --git a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCIIT5lu.woff2 b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCIIT5lu.woff2
index b5664780..3d4f643a 100644
Binary files a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCIIT5lu.woff2 and b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCIIT5lu.woff2 differ
diff --git a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCMIT5lu.woff2 b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCMIT5lu.woff2
index e0d65386..753e47ca 100644
Binary files a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCMIT5lu.woff2 and b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCMIT5lu.woff2 differ
diff --git a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCkIT5lu.woff2 b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCkIT5lu.woff2
index 1005b7c8..49dbbaa5 100644
Binary files a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCkIT5lu.woff2 and b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCkIT5lu.woff2 differ
diff --git a/docs/index.html b/docs/index.html
index 10c20e37..293d84d1 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -5,14 +5,14 @@
-
+
The Framework for Evaluating Damages and Impacts (FrEDI) • FrEDI
-
+
Default outputs of run_fredi() A dataframe containing the default outputs of run_fredi() — defaultResults • FrEDI
- Skip to contents
-
-
-
-
-
- Default outputs of run_fredi()
A dataframe containing the default outputs of run_fredi()
- Source: R/data.R
- defaultResults.Rd
-
-
-
- Default outputs of run_fredi()
-A dataframe containing the default outputs of run_fredi()
-
-
-
-
-
- Format
- A data frame with 1,501,500 rows and 20 columns:
- sector
-Name of the associated sector.
-
-- variant
-Name of the associated variant or adaptation (values are sector-specific).
-
-- impactYear
-Name of the impact year ("2010", "2090", "N/A", or "Interpolation").
-
-- impactType
-Name of the impact type ("all" or sector-specific values).
-
-- region
-Name of the associated region ("Midwest", "Northeast", "Northern Plains", "Northwest", "Southeast", "Southern Plains", "Southwest", or "National Total").
-
-- state
-Name of the associated state (or District of Columbia): "Alabama", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "District of Columbia", "Florida", "Georgia", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming". For the "National Total" region, state = "All"
. For sectors with only has region-level data, state = "N/A"
.
-
-- postal
-Postal code abbreviation of the associated state (e.g., postal="AL"
for state="Alabama"
). The postal code abbreviation for the District of Columbia is "DC"
. For the "National Total" region, postal = "US"
. For sectors with only has region-level data, postal = "N/A"
.
-
-- model_type
-Type of model used to calculate impacts --- either "GCM" (for "Global Climate Model") or "SLR" for ("Sea Level Rise")
-
-- model
-Name of the GCM ("Average", "CanESM2", "CCSM4", "GCM Ensemble", "GFDL-CM3", "GISS-E2-R", "HadGEM2-ES", "MIROC5", "MRI-CGCM3") or SLR model ("Interpolation")
-
-- sectorprimary
-A 0
or 1
value indicating whether the sector is a primary CIRA sector (and whether it should be included when summing across sectors). sectorprimary=1
if a primary sector and sectorprimary=0
if not.
-
-- includeaggregate
-A 0
or 1
value indicating whether the variant is the primary variant for the sector (and whether it should be included when summing across sectors). includeaggregate=1
if the variant is a primary variant and includeaggregate=0
if not).
-
-- driverType
-Associated driver type ("Temperature" or "GMSL (SLR)").
-
-- driverUnit
-Unit for the associated driver type ("degrees Celsius" for temperature and "cm" for sea level rise).
-
-- driverValue
-Value for the associated driver type (in "degrees Celsius" for temperature and in "cm" for sea level rise).
-
-- gdp_usd
-National gross domestic product (GDP) for associated year in 2015 USD (U.S. dollars).
-
-- national_pop
-National population for associated year.
-
-- gdp_per_cap
-National GDP per capita for associated year in 2015 USD (U.S. dollars) per capita.
-
-- state_pop
-Population for the associated state (for state-level data) or region (for region-only data).
-
-- annual_impacts
-Annual impacts for associated sector, variant, impact type, impact year, region, state, model type, model, and year.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/reference/gcamScenarios.html b/docs/reference/gcamScenarios.html
index ba6c38a6..70dbc6e2 100644
--- a/docs/reference/gcamScenarios.html
+++ b/docs/reference/gcamScenarios.html
@@ -1,5 +1,5 @@
-Six driver scenarios that can be passed as inputs to run_fredi() and run_fredi_sv() — gcamScenarios • FrEDI Six driver scenarios that can be passed as inputs to run_fredi() and run_fredi_sv() — gcamScenarios • FrEDI
@@ -10,7 +10,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -70,7 +70,7 @@
- A dataframe containing six driver scenarios that can be passed as inputs to run_fredi()
and run_fredi_sv()
. This data frame has four columns -- year
, temp_C
, slr_cm
, and scenario
-- respectively containing:
+ gcamScenarios
is a data frame object containing six driver scenarios that can be passed as inputs to run_fredi()
and run_fredi_sv()
. This data frame has five columns -- year
, temp_C_global
, temp_C_conus
, slr_cm
, scenario
, and model
:
@@ -80,17 +80,23 @@ Usage
Format
- A data frame with 546 rows and 4 columns:
- year
+ A data frame with 606 rows and 6 columns:
- year
Year
-- temp_C
-Global temperature (in degrees Celsius) for the associated year and scenario
+- temp_C_global
+Global temperatures, in degrees Celsius, for the associated year and scenario
-- slr_cm
-Global Mean Sea Level Rise (in centimeters) for the associated year and scenario
+- temp_C_conus
+Temperatures for the contiguous U.S. (CONUS), in degrees Celsius, for the associated year and scenario (converted from global temperatures using convertTemps(from="global"))
-- scenario
-Associated scenario identifier
+- slr_cm
+Global Mean Sea Level Rise (GMSL or SLR), in centimeters, for the associated year and scenario (calculated from global temperatures using temps2slr()
)
+
+- scenario
+Associated scenario identifier (e.g., "ECS_3.0_REF"
)
+
+- model
+A string ("Hector_GCAM_v5.3"
) identifying the model (Hector, with GCAM v5.3) used in generating the global temperatures associated with each scenario
@@ -101,23 +107,32 @@ Source<
Details
-- year
+- year
The Common Era (CE) year associated with the observation.
-- temp_C
-Global temperature (i.e., degrees of warming above the baseline year of 1995) in degrees Celsius, for the associated year and scenario.
+- temp_C_global
+Global temperature (i.e., degrees of warming above the baseline year of 1995), in degrees Celsius, for the associated year and scenario.
+
+- temp_C_conus
+Temperatures (i.e., degrees of warming above the baseline year of 1995) for the contiguous U.S. (CONUS), in degrees Celsius, for the associated year and scenario (calculated from global temperatures using convertTemps(from="global")).
+
+- slr_cm
+Global Mean Sea Level Rise (GMSL or SLR), in centimeters, for the associated year and scenario (calculated from global temperatures using temps2slr()
).
-- slr_cm
-Global Mean Sea Level Rise (i.e., SLR) in centimeters for the associated year and scenario.
+- scenario
+Associated scenario identifier (e.g., "ECS_3.0_REF"
).
-- scenario
-Associated scenario identifier.
+- model
+A string ("Hector_GCAM_v5.3"
) identifying the model (Hector, with GCAM v5.3) used in generating the global temperatures associated with each scenario.
-
The scenarios in this dataframe were created using Hector, an open-source, reduced-form global carbon-cycle climate model (Hartin et al., 2015) to model temperatures associated with emissions scenarios from the Global Change Analysis Model v5.3 (GCAM). The Global Change Analysis Model v5.3 (GCAM) is an open source model that represents the linkages between energy, water, land, climate and economic systems (Calvin et al., 2019). Scenario identifiers in the scenario
column of gcamScenarios()
have the string "Hector_GCAM_v5.3_ECS_"
as a prefix, followed by the average warming temperature and the suffix "_REF"
(e.g., "Hector_GCAM_v5.3_ECS_3.0_REF"
for the default scenario for run_fredi()
and run_fredi_sv()
.
-These six temperature scenarios represent global temperatures; however, run_fredi()
and run_fredi_sv()
require temperature scenarios for the contiguous U.S. (CONUS). Therefore, to use the gcamScenarios
with run_fredi()
or run_fredi_sv()
, users must first convert temperatures in the temp_C
column to CONUS temperatures via the convertTemps function -- with argument from = "global"
(e.g., gcamScenarios |> mutate(temp_C = temp_C |> FrEDI::convertTemps(from = "global"))
).
-The GCAM scenarios can be passed directly to the SV module via the driverInput
argument (e.g., run_fredi_sv(driverInput = gcamScenarios)
), since run_fredi_sv()
is designed to run multiple scenarios. In contrast, run_fredi()
is intended to be run with a single scenario; gcamScenarios
should be subset to a specific scenario before passing the temperature scenario to run_fredi()
(e.g., run_fredi(list(tempInput=gcamScenarios |> dplyr::filter(scenario=="Hector_GCAM_v5.3_ECS_3.0_REF")))
to use the default scenario).
-Calvin, K., Patel, P., Clarke, L., et al. 2019. GCAM v5.1: representing the linkages between energy, water, land, climate, and economic systems, Geosci. Model Dev., 12:677–698. https://doi.org/10.5194/gmd-12-677-2019.
+
The scenarios in this data frame were created using Hector with GCAM v5.3:
Hector is an open-source, reduced-form global carbon-cycle climate model (Hartin et al., 2015) used to model temperatures associated with emissions scenarios from the Global Change Analysis Model v5.3 (GCAM).
+GCAM v5.3 -- i.e., the Global Change Analysis Model v5.3 -- is an open source model that represents the linkages between energy, water, land, climate and economic systems (Calvin et al., 2019).
+
Scenario identifiers in the scenario
column of gcamScenarios()
have the string "ECS_3.0_REF_"
as a prefix, followed by a suffix indicating an emissions intensity associated with the scenario (e.g., "20"
) -- for instance, the default scenario for run_fredi()
and run_fredi_sv()
is "ECS_3.0_REF"
. Other scenarios include "ECS_3.0_REF_20"
, "ECS_3.0_REF_30"
, "ECS_3.0_REF_50"
, "ECS_3.0_REF_70"
, and "ECS_3.0_REF_90"
.
+Users can use the scenarios in gcamScenarios
as inputs to FrEDI or the FrEDI SV Module:
Users can filter the gcamScenarios
data frame to any of these six scenarios, which can then be passed directly to the run_fredi()
function via a named element (temp
and/or slr
) in a list passed to the inputsList
argument -- e.g., run_fredi(inputsList=list(temp=gcamScenarios |> filter(scenario=="ECS_3.0_REF")))
will run using the default temperature scenario.
+Any or all of the GCAM scenarios can be passed directly to the FrEDI SV module via the run_fredi_sv()
function via a named list element (temp
and/or slr
) in a list passed to the inputsList
argument -- e.g., run_fredi_sv(inputsList=list(temp=gcamScenarios))
will run the SV module for all the GCAM scenarios provided in gcamScenarios
.
+gcamScenarios
can also be combined with other provided scenarios (gdpDefault
, popDefault
) in function calls (e.g., run_fredi(inputsList=list(temp=gcamScenarios |> filter(scenario=="ECS_3.0_REF"), gdp=gdpDefault, pop=popDefault))
) or user-provided data frames. For more information, see documentation for run_fredi()
, FrEDI:run_fredi_sv()
, FrEDI:run_fredi_methane()
, and import_inputs()
.
+
Calvin, K., Patel, P., Clarke, L., et al. 2019. GCAM v5.1: representing the linkages between energy, water, land, climate, and economic systems, Geosci. Model Dev., 12:677–698. https://doi.org/10.5194/gmd-12-677-2019.
Hartin, C.A., Patel, P., Schwarber, A., Link, R.P. and Bond-Lamberty, B.P., 2015. A simple object-oriented and open-source model for scientific and policy analyses of the global climate system–Hector v1. 0. Geoscientific Model Development, 8(4), pp.939-955.
@@ -126,11 +141,11 @@ Details
diff --git a/docs/reference/get_sectorInfo.html b/docs/reference/get_sectorInfo.html
index ab27e1e6..27908ede 100644
--- a/docs/reference/get_sectorInfo.html
+++ b/docs/reference/get_sectorInfo.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -142,102 +142,102 @@ Examples
### Return a dataframe of all of the sectors in FrEDI (sector names and additional information)
get_sectorInfo(description=T, gcmOnly=T)
-#> sector include model_type byState
-#> 3 ATS Temperature-Related Mortality 1 GCM 1
-#> 2 Asphalt Roads 1 GCM 1
-#> 4 CIL Agriculture 1 GCM 1
-#> 5 CIL Crime 1 GCM 1
-#> 6 CIL Temperature-Related Mortality 1 GCM 1
-#> 1 Climate-Driven Changes in Air Quality 1 GCM 1
-#> 8 Electricity Demand and Supply 1 GCM 1
-#> 9 Electricity Transmission and Distribution 1 GCM 1
-#> 10 Extreme Temperature 1 GCM 1
-#> 12 Inland Flooding 1 GCM 1
-#> 13 Labor 1 GCM 1
-#> 14 Marine Fisheries 1 GCM 1
-#> 16 Rail 1 GCM 1
-#> 17 Roads 1 GCM 1
-#> 18 Southwest Dust 1 GCM 1
-#> 15 Suicide 1 GCM 1
-#> 19 Urban Drainage 1 GCM 1
-#> 20 Valley Fever 1 GCM 1
-#> 21 Vibriosis 1 GCM 1
-#> 22 Water Quality 1 GCM 1
-#> 23 Wildfire 1 GCM 1
-#> 24 Wind Damage 1 GCM 1
-#> 25 Winter Recreation 1 GCM 1
+#> sector include model_type
+#> 1 ATS Temperature-Related Mortality 1 GCM
+#> 2 Asphalt Roads 1 GCM
+#> 3 CIL Agriculture 1 GCM
+#> 4 CIL Crime 1 GCM
+#> 5 CIL Temperature-Related Mortality 1 GCM
+#> 6 Climate-Driven Changes in Air Quality 1 GCM
+#> 7 Electricity Demand and Supply 1 GCM
+#> 8 Electricity Transmission and Distribution 1 GCM
+#> 9 Extreme Temperature 1 GCM
+#> 10 Inland Flooding 1 GCM
+#> 11 Labor 1 GCM
+#> 12 Marine Fisheries 1 GCM
+#> 13 Rail 1 GCM
+#> 14 Roads 1 GCM
+#> 15 Southwest Dust 1 GCM
+#> 16 Suicide 1 GCM
+#> 17 Urban Drainage 1 GCM
+#> 18 Valley Fever 1 GCM
+#> 19 Vibriosis 1 GCM
+#> 20 Water Quality 1 GCM
+#> 21 Wildfire 1 GCM
+#> 22 Wind Damage 1 GCM
+#> 23 Winter Recreation 1 GCM
#> variants
-#> 3 Mean, Low Confidence Interval, High Confidence Interval
+#> 1 Mean, Low Confidence Interval, High Confidence Interval
#> 2 N/A
-#> 4 With CO2 Fertilization, Without CO2 Fertilization
-#> 5 N/A
-#> 6 Median, Low Confidence Interval, High Confidence Interval
-#> 1 2011 Emissions, 2040 Emissions
-#> 8 N/A
-#> 9 No Additional Adaptation, Proactive Adaptation, Reactive Adaptation
-#> 10 Adaptation, No Additional Adaptation
+#> 3 With CO2 Fertilization, Without CO2 Fertilization
+#> 4 N/A
+#> 5 Median, Low Confidence Interval, High Confidence Interval
+#> 6 2011 Emissions, 2040 Emissions
+#> 7 N/A
+#> 8 No Additional Adaptation, Proactive Adaptation, Reactive Adaptation
+#> 9 Adaptation, No Additional Adaptation
+#> 10 N/A
+#> 11 N/A
#> 12 N/A
-#> 13 N/A
-#> 14 N/A
-#> 16 No Additional Adaptation, Proactive Adaptation, Reactive Adaptation
-#> 17 No Additional Adaptation, Proactive Adaptation, Reactive Adaptation
-#> 18 N/A
+#> 13 No Additional Adaptation, Proactive Adaptation, Reactive Adaptation
+#> 14 No Additional Adaptation, Proactive Adaptation, Reactive Adaptation
#> 15 N/A
+#> 16 N/A
+#> 17 N/A
+#> 18 N/A
#> 19 N/A
#> 20 N/A
#> 21 N/A
#> 22 N/A
#> 23 N/A
-#> 24 N/A
-#> 25 N/A
#> impactYears
-#> 3 N/A
-#> 2 N/A
-#> 4 N/A
-#> 5 N/A
-#> 6 N/A
-#> 1 N/A
-#> 8 N/A
-#> 9 N/A
-#> 10 2010, 2090
-#> 12 N/A
-#> 13 N/A
-#> 14 N/A
-#> 16 N/A
-#> 17 N/A
-#> 18 2010, 2090
-#> 15 N/A
-#> 19 N/A
-#> 20 N/A
-#> 21 N/A
-#> 22 N/A
-#> 23 N/A
-#> 24 N/A
-#> 25 2010, 2090
+#> 1 NA
+#> 2 NA
+#> 3 NA
+#> 4 NA
+#> 5 NA
+#> 6 NA
+#> 7 NA
+#> 8 NA
+#> 9 2010, 2090
+#> 10 NA
+#> 11 NA
+#> 12 NA
+#> 13 NA
+#> 14 NA
+#> 15 2010, 2090
+#> 16 NA
+#> 17 NA
+#> 18 NA
+#> 19 NA
+#> 20 NA
+#> 21 NA
+#> 22 NA
+#> 23 2010, 2090
#> impactTypes
-#> 3 N/A
+#> 1 N/A
#> 2 N/A
-#> 4 Cotton, Maize, Soybean, Wheat
-#> 5 Property, Violent
-#> 6 N/A
-#> 1 Ozone, PM2.5
+#> 3 Cotton, Maize, Soybean, Wheat
+#> 4 Property, Violent
+#> 5 N/A
+#> 6 Ozone, PM2.5
+#> 7 N/A
#> 8 N/A
-#> 9 N/A
-#> 10 Cold, Hot
+#> 9 Cold, Hot
+#> 10 N/A
+#> 11 N/A
#> 12 N/A
#> 13 N/A
#> 14 N/A
+#> 15 Acute Myocardial Infarction, All Cardiovascular, All Mortality, All Respiratory, Asthma ER
#> 16 N/A
#> 17 N/A
-#> 18 Acute Myocardial Infarction, All Cardiovascular, All Mortality, All Respiratory, Asthma ER
-#> 15 N/A
-#> 19 N/A
-#> 20 Lost Wages, Morbidity, Mortality
-#> 21 Direct Medical Cost, Lost Days, Mortality
+#> 18 Lost Wages, Morbidity, Mortality
+#> 19 Direct Medical Cost, Lost Days, Mortality
+#> 20 N/A
+#> 21 Morbidity, Mortality, Response Costs
#> 22 N/A
-#> 23 Morbidity, Mortality, Response Costs
-#> 24 N/A
-#> 25 Alpine Skiing, Cross-Country Skiing, Snowmobiling
+#> 23 Alpine Skiing, Cross-Country Skiing, Snowmobiling
### Return a character vector with only the names of the temperature-driven sectors:
get_sectorInfo(gcmOnly=T)
@@ -267,14 +267,12 @@ Examples
### Run FrEDI for only the temperature-driven sectors and view results:
df_x <- run_fredi(sectorList=get_sectorInfo(gcmOnly=T))
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from defaults...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -286,11 +284,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/get_sv_sectorInfo.html b/docs/reference/get_sv_sectorInfo.html
index 0f5fa8f1..a486c04e 100644
--- a/docs/reference/get_sv_sectorInfo.html
+++ b/docs/reference/get_sv_sectorInfo.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -168,11 +168,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/import_inputs.html b/docs/reference/import_inputs.html
index 79a35d77..7c5a1903 100644
--- a/docs/reference/import_inputs.html
+++ b/docs/reference/import_inputs.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -76,33 +76,29 @@
Usage
import_inputs(
- tempfile = NULL,
- slrfile = NULL,
- gdpfile = NULL,
- popfile = NULL,
+ inputsList = list(gdp = NULL, pop = NULL, temp = NULL, slr = NULL, ch4 = NULL, nox =
+ NULL, o3 = NULL),
temptype = "conus",
- popArea = "state"
+ popArea = "state",
+ module = "fredi"
)
Arguments
- - tempfile=NULL
-A character string indicating the location of a CSV file containing a custom temperature scenario. The first column in the CSV should be named "year"
and contain years associated with the temperature estimates; the second column (named "temp_C"
) should contain values for temperatures (i.e., degrees of warming relative to a baseline year of 1995), in degrees Celsius. The temperature scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
-
-
-- slrfile=NULL
-A character string indicating the location of a CSV file containing a custom sea level rise scenario. The first column in the CSV should be named "year"
and contain years associated with the sea level rise estimates; second column should be named "slr_cm"
and contain values for global mean sea level rise (GMSL), in centimeters, above a baseline year of 2000. The SLR scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
-
-
-- gdpfile=NULL
-A character string indicating the location of a CSV file containing a custom scenario for U.S. gross domestic product (GDP). The first column in the CSV should be named "year"
and contains years associated with the GDP estimates; the second column (named "gdp_usd"
) should contain values for U.S. GDP in 2015 U.S. dollars (2015$ USD). The GDP scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
). Values for GDP in column "gdp_usd"
must be greater than or equal to zero.
-
-
-- popfile=NULL
-A character string indicating the location of a CSV file containing a custom population scenario for states and NCA regions. The first column should be named "year"
and contain years in the interval 2010 to 2300. The second column should be called "pop"
and contain population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument (for more information, see the popArea
argument, below.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year. If popArea = "national"
, only the year
and pop
columns are required.
+ - inputsList=list(gdp=NULL, pop=NULL, temp=NULL, slr=NULL, ch4=NULL, nox=NULL)
+A named list containing file paths to CSV files containing scenarios:
gdp A character string indicating the location of a CSV file containing a custom scenario for U.S. gross domestic product (GDP), for use with run_fredi()
or run_fredi_methane()
. The first column in the CSV should be named "year"
and contains years associated with the GDP estimates; the second column (named "gdp_usd"
) should contain values for U.S. GDP in 2015 U.S. dollars (2015$ USD). The GDP scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
or run_fredi_methane()
). Values for GDP in column "gdp_usd"
must be greater than or equal to zero.
+pop A character string indicating the location of a CSV file containing a custom population scenario for states and NCA regions, for use with run_fredi()
, run_fredi_sv()
, or run_fredi_methane()
. The first column should be named "year"
and contain years in the interval 2010 to 2300. The second column should be called "pop"
and contain population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument (for more information, see the popArea
argument, below.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year. If popArea = "national"
, only the year
and pop
columns are required.
If popArea = "state"
, the file must contain estimates for all CONUS states -- i.e., all states except Alaska and Hawaii must be present in the input file (estimates for Alaska and Hawaii are optional). If popArea = "regional"
, the file must contain estimates for all seven NCA regions.
-The population scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
). Values for population in column "pop"
must be greater than or equal to zero.
+The population scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
or run_fredi_methane()
). Values for population in column "pop"
must be greater than or equal to zero.
+
+temp A character string indicating the location of a CSV file containing a custom temperature scenario, for use with run_fredi()
or run_fredi_sv()
. The first column in the CSV should be named "year"
and contain years associated with the temperature estimates; the second column (named "temp_C"
) should contain values for temperatures (i.e., degrees of warming relative to a baseline era of 1986-2005), in degrees Celsius. The temperature scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
+slr A character string indicating the location of a CSV file containing a custom sea level rise scenario, for use with run_fredi()
or run_fredi_sv()
. The first column in the CSV should be named "year"
and contain years associated with the sea level rise estimates; the second column should be named "slr_cm"
and contain values for global mean sea level rise (GMSL), in centimeters, above a baseline year of 2000. The SLR scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
+o3 A character string indicating the location of a CSV file containing a custom scenario for changes in U.S. state-level ozone concentrations (relative to a 1986-2005 baseline era). The input ozone scenario requires changes in annual state-level ozone concentrations, by GCM model, in parts per trillion by volume (pptv) relative to a 1986-2005 baseline era. In other words, the input ozone scenario requires ozone concentrations specific to the state, GCM model, and year of the analysis.
The o3
input requires a data frame object with six columns with names "region"
, "state"
, "postal"
, "model"
, "year"
, and "O3_pptv"
containing the region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively), the state name, the two-character postal code abbreviation for the state, the GCM model name ("CanESM2"
, "GFDL-CM3"
, "GISS-E2-R"
, "HadGEM2-ES"
, and/or "MIROC5"
), the year, and the change in ozone concentration (in pptv) relative to a 1986-2005 baseline era.
+Ozone inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by the maxYear
argument).
+
+ch4 A character string indicating the location of a CSV file containing a custom scenario for changes in U.S. methane concentrations (relative to a 1986-2005 baseline era), at the national level, for use with run_fredi_methane()
. The first column in the CSV should be named "year"
and contain years associated with the national methane estimates; the second column should be named "CH4_ppbv"
and contain values for methane. The methane scenario must start in 2020 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi_methane()
).
+nox A character string indicating the location of a CSV file containing a custom scenario for U.S. NOx emission values, at the national level. The first column in the CSV should be named "year"
and contain years associated with the national NOx estimates; the second column should be named "Mt"
and contain values for NOx emissions, in megatons per year (Mt). The NOx scenario must start in 2020 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi_methane()
).
@@ -121,29 +117,41 @@ Value
import_inputs()
returns a list of named elements containing data frames with custom scenarios for temperature, GMSL, GDP, and regional population, respectively:
-List Index Description tempInput
Data frame containing a custom temperature scenario imported from the CSV file specified by tempfile
, with missing values removed. tempInput
has two columns with names "year"
and "temp_C"
, containing the year and CONUS temperatures in degrees Celsius, respectively. slrInput
Data frame containing a custom GMSL scenario imported from the CSV file specified by slrfile
, with missing values removed. slrInput
has two columns with names "year"
, and "slr_cm"
, containing the year and global mean sea level rise (GMSL) in centimeters, respectively. gdpInput
Data frame containing a custom GDP scenario imported from the CSV file specified by gdpfile
, with missing values removed. gdpInput
has two columns with names "year"
, and "gdp_usd"
, containing the year and the national GDP, respectively. popInput
Data frame containing a custom temperature scenario imported from the CSV file specified by popfile
, with missing values removed. popInput
has three columns with names "year"
, "region"
, "state"
, "postal"
, and "state_pop"
, containing the year, the NCA region name, and the state, the postal code abbreviation (e.g., postal = "ME"
for state = "Maine"
), and the state population, respectively.
+List Index Description gdp
Data frame containing a custom GDP scenario imported from the CSV file specified by inputsList$gdp
, with missing values removed. gdp
has two columns with names "year"
, and "gdp_usd"
, containing the year and the national GDP, respectively. pop
Data frame containing a custom temperature scenario imported from the CSV file specified by inputsList$pop
, with missing values removed. popInput
has three columns with names "year"
, "region"
, "state"
, "postal"
, and "pop"
, containing the year, the NCA region name, and the state, the postal code abbreviation (e.g., postal = "ME"
for state = "Maine"
), and the state population, respectively. temp
Data frame containing a custom temperature scenario imported from the CSV file specified by inputsList$temp
, with missing values removed. temp
has two columns with names "year"
and "temp_C"
, containing the year and CONUS temperatures in degrees Celsius, respectively. slr
Data frame containing a custom GMSL scenario imported from the CSV file specified by inputsList$slr
, with missing values removed. slr
has two columns with names "year"
, and "slr_cm"
, containing the year and global mean sea level rise (GMSL) in centimeters, respectively. o3
Data frame containing a custom scenario with changes in ozone concentrations imported from the CSV file specified by inputsList$temp
, with missing values removed. o3
has six columns with names "region"
, "state"
, "postal"
, "model"
, "year"
, and "O3_pptv"
containing the region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively), the state name, the two-character postal code abbreviation for the state, the GCM model name ("CanESM2"
, "GFDL-CM3"
, "GISS-E2-R"
, "HadGEM2-ES"
, and/or "MIROC5"
), the year, and the change in ozone concentration (in pptv) relative to a 1986-2005 baseline era. ch4
Data frame containing a custom scenario with changes in methane concentrations imported from the CSV file specified by inputsList$slr
, with missing values removed. ch4
has two columns with names "year"
, and "CH4_ppbv"
, containing the year and Change in U.S. methane concentrations, in parts per billion by volume (ppbv) relative to a 1995-2006 baseline era, respectively. nox
Data frame containing a custom NOx emissions scenario imported from the CSV file specified by inputsList$nox
, with missing values removed. nox
has two columns with names "year"
and "NOx_Mt"
, containing the year and U.S. national-level NOx emissions (in Mt), respectively.
Details
- This function enables users to import data on custom scenarios for use with temperature binning. Users specify path names to CSV files containing temperature, global mean sea level rise (GMSL), population, and gross domestic product (GDP) scenarios (tempfile
, slrfile
, gdpfile
, and popfile
, respectively). import_inputs()
reads in and formats any specified files as data frames and returns a list of data frames for imported scenarios.
-The CSV files should contain estimates aligned with the requirements of the run_fredi()
or ``
Temperature Scenario. The file specified by tempfile
must have two columns -- "year"
and "temp_C"
-- respectively containing the years associated with the temperature estimates and the temperatures (i.e., degrees of warming) in degrees Celsius relative to a baseline year of 1995 (i.e., the central year of a 1986-2005 reference period).
If values in "temp_C"
have global rather than CONUS-specific temperatures, users should specify temptype = "global"
when running import_inputs()
, and import_inputs()
will convert the temperatures to CONUS using convertTemps (with argument from = "global"
).
-Temperature inputs to run_fredi()
must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-
-SLR Scenario. The file specified by slrfile
must have two columns -- "year"
and "slr_cm"
-- respectively containing the years associated with the GMSL estimates and GMSL estimates, in centimeters, above a 2000 baseline year.
GMSL heights must be greater than or equal to zero.
-The SLR scenario must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-
-GDP Scenario. The file specified by gdpfile
must have two columns -- "year"
and "gdp_usd"
-- respectively containing the years associated with the GDP estimates and the estimates for U.S. GDP, in 2015$.
GDP values must be greater than or equal to zero.
+ This function enables users to import data on custom scenarios for use with temperature binning. Users provide a named list specifying path names to CSV files containing scenarios for gross domestic product (GDP) (for use with run_fredi()
or run_fredi_methane()
); population (for use with run_fredi()
, run_fredi_sv()
, or run_fredi_methane()
); temperature and/or global mean sea level rise (GMSL) (for use with run_fredi()
or run_fredi_sv()
); or methane or NOx (for use with run_fredi_methane()
). import_inputs()
reads in and formats any specified files as data frames and returns a list of data frames for imported scenarios.
+The CSV files should contain estimates aligned with the requirements of the run_fredi()
or ``
GDP Scenario. The file specified by inputsList$gdp
must have two columns -- "year"
and "gdp_usd"
-- respectively containing the years associated with the GDP estimates and the estimates for U.S. GDP, in 2015$.
GDP values must be greater than or equal to zero.
The GDP scenario must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-Population Scenario. The file specified by popfile
population must have at least two columns -- "year"
and "pop"
-- respectively containing the years associated with the population estimates and the population estimates. requires state-level population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year. If popArea = "national"
, only the year
and pop
columns are required.
+Population Scenario. The file specified by inputsList$pop
population must have at least two columns -- "year"
and "pop"
-- respectively containing the years associated with the population estimates and the population estimates. requires state-level population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year (one of "Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively). If popArea = "national"
, only the year
and pop
columns are required.
If popArea = "state"
, the file must contain estimates for all CONUS states -- i.e., all states except Alaska and Hawaii must be present in the input file (estimates for Alaska and Hawaii are optional). If popArea = "regional"
, the file must contain estimates for all seven NCA regions.
The population scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
Population values must be greater than or equal to zero.
Population estimates must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-
run_fredi()
requires a population scenario at the state level. If the population scenario is supplied to import_inputs()
at a geographical scale above the state level (i.e., if popArea = "national"
, popArea = "area"
, or popArea = "regional"
), import_inputs()
will calculate state-level estimates from the provided data:
If popArea = "national"
, import_inputs()
will use historical U.S. Census data for the period 2010--2023 to allocate total national population to CONUS and non-CONUS regions (i.e., Alaska and Hawaii); U.S. Census values from 2023 are applied in allocations for years after 2023. import_inputs()
then uses ICLUS data and projections for the period 2010--2100 to allocate CONUS population to specific NCA regions; ICLUS values from 2100 are applied in allocations for years after 2100.
+Temperature Scenario. The file specified by inputsList$temp
must have two columns -- "year"
and "temp_C"
-- respectively containing the years associated with the temperature estimates and the temperatures (i.e., degrees of warming) in degrees Celsius relative to a baseline year of 1995 (i.e., the central year of a 1986-2005 reference period).
If values in "temp_C"
have global rather than CONUS-specific temperatures, users should specify temptype = "global"
when running import_inputs()
, and import_inputs()
will convert the temperatures to CONUS using convertTemps (with argument from = "global"
).
+Temperature inputs to run_fredi()
must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
+
+SLR Scenario. The file specified by inputsList$slr
must have two columns -- "year"
and "slr_cm"
-- respectively containing the years associated with the GMSL estimates and GMSL estimates, in centimeters, above a 2000 baseline year.
GMSL heights must be greater than or equal to zero.
+The SLR scenario must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
+
+Ozone Scenario. The input ozone scenario requires changes in annual state-level ozone concentrations, by GCM model, in parts per trillion by volume (pptv) relative to a 1986-2005 baseline era. In other words, the input ozone scenario requires ozone concentrations specific to the state, GCM model, and year of the analysis.
o3
requires a data frame object with six columns with names "region"
, "state"
, "postal"
, "model"
, "year"
, and "O3_pptv"
containing the region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively), the state name, the two-character postal code abbreviation for the state, the GCM model name ("CanESM2"
, "GFDL-CM3"
, "GISS-E2-R"
, "HadGEM2-ES"
, and/or "MIROC5"
), the year, and the change in ozone concentration (in pptv) relative to a 1986-2005 baseline era.
+Ozone inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+If inputs are specified for ozone and methane or NOx (i.e., !is.null(inputsList$o3) & (!is.null(inputsList$ch4) | !is.null(inputsList$nox))
), run_fredi_methane()
will use the ozone scenario in preference of the methane and NOx scenario.
+
+Methane Scenario. The input methane scenario requires changes in annual methane concentrations, at the national level, in parts per billion by volume (ppbv) relative to a 1986-2005 baseline era.
ch4
requires a data frame object with two columns with names "year"
and "CH4_ppbv"
containing the year and the change in methane concentration (in ppbv) relative to a 1986-2005 baseline era.
+Methane inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+run_fredi_methane()
will override a user-supplied methane scenario with a user-supplied ozone scenario; in other words, run_fredi_methane()
will use the ozone scenario in preference of the methane and NOx scenario.
+
+NOx Scenario. The input NOx scenario requires annual NOx emissions in the US, at the national level, in Megatons (MT) relative to a 1986-2005 baseline.
nox
requires a data frame object with two columns with names "year"
and "NOx_Mt"
containing the year and the change in NOx concentration (in Mt) relative to a 1986-2005 baseline era.
+NOx inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+run_fredi_methane()
will override a user-supplied methane scenario with a user-supplied ozone scenario; in other words, run_fredi_methane()
will use the ozone scenario in preference of the methane and NOx scenario.
+
+
run_fredi()
, run_fredi_sv()
, and run_fredi_methane()
each require a population scenario at the state level. If the population scenario is supplied to import_inputs()
at a geographical scale above the state level (i.e., if popArea = "national"
, popArea = "area"
, or popArea = "regional"
), import_inputs()
will calculate state-level estimates from the provided data:
If popArea = "national"
, import_inputs()
will use historical U.S. Census data for the period 2010--2023 to allocate total national population to CONUS and non-CONUS regions (i.e., Alaska and Hawaii); U.S. Census values from 2023 are applied in allocations for years after 2023. import_inputs()
then uses ICLUS data and projections for the period 2010--2100 to allocate CONUS population to specific NCA regions; ICLUS values from 2100 are applied in allocations for years after 2100.
If popArea = "national"
or popArea = "regional"
, import_inputs()
uses ICLUS data and projections for the period 2010--2100 to allocate population for each NCA region to the associated states; ICLUS values from 2100 are applied in allocations for years after 2100.
import_inputs()
outputs a list of data frame objects that can be passed to the main FREDI function run_fredi()
using the inputList
argument. For example, specify run_fredi(inputsList = x)
to generate impacts for a custom scenario x
(where x
is a list of data frames such as that output from import_inputs()
) (see run_fredi()
).
-All inputs to import_inputs()
are optional. If the user does not specify a file path for tempfile
, slrfile
, gdpfile
, or popfile
(or if there is are any errors reading in inputs from a file path), import_inputs()
outputs a list with a NULL
value for the associated list element. After reading in data from the specified CSV files, import_inputs()
performs basic checks and will also return a NULL
value for a particular list element if any of the checks fail.
+All inputs to import_inputs()
are optional. If the user does not specify particular named elements (or if there is are any errors reading in inputs from a file path), import_inputs()
outputs a list with a NULL
value for the associated list element. After reading in data from the specified CSV files, import_inputs()
performs basic checks and will also return a NULL
value for a particular list element if any of the checks fail.
When using import_inputs()
with run_fredi()
, run_fredi()
defaults back to the default scenarios for any elements of the inputs list that are NULL
or missing. In other words, running run_fredi(inputsList = list())
returns the same outputs as running run_fredi()
(see run_fredi()
).
@@ -162,8 +170,8 @@ Examples
### View example scenario names
scenariosPath |> list.files()
-#> [1] "GCAM_scenario.csv" "State ICLUS Population.csv"
-#> [3] "slr_from_GCAM.csv"
+#> [1] "gcamDefault.csv" "gcamScenarios.csv" "gdpDefault.csv"
+#> [4] "popDefault.csv"
### SLR Scenario File Name
slrInputFile <- scenariosPath |> file.path("slr_from_gcam.csv")
@@ -172,40 +180,28 @@ ExamplespopInputFile <- scenariosPath |> file.path("State ICLUS Population.csv")
### Import inputs
-example_inputsList <- import_inputs(slrfile=slrInputFile, popfile=popInputFile, popArea="state")
+example_inputsList <- import_inputs(inputsList=list(slr=slrInputFile, pop=popInputFile), popArea="state")
#>
#> In import_inputs():
#> Loading data...
#> User specified slrfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/slr_from_gcam.csv...
-#> Data loaded.
+#> File does not exist! Returning a null data frame for slr input.
#> User specified popfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/State ICLUS Population.csv...
-#> Data loaded.
+#> File does not exist! Returning a null data frame for pop input.
#>
#> Checking input values...
#>
-#> Checking input values for slr inputs...
-#> Values passed.
-#>
-#> Checking input values for pop inputs...
-#> Column "pop" not found in popfile data!
-#> Looking for columns with matches to the string "pop"...1 match found!
-#> Using column "state_pop", and renaming to "state_pop"...
-#> Values passed.
-#>
#> Finished.
### Use imports with FREDI:
df_x <- run_fredi(inputsList=example_inputsList)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from user inputs...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from user inputs...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -216,11 +212,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/index.html b/docs/reference/index.html
index d9dfde11..08aa75d4 100644
--- a/docs/reference/index.html
+++ b/docs/reference/index.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.1
+ 4.2.0
@@ -82,7 +82,7 @@ All functionsaggregate_impacts()
- Summarize and aggregate impacts from run_fredi()
(calculate national totals, average across models, sum impact types, and interpolate between impact year estimates)
+ Summarize and aggregate impacts from run_fredi()
(calculate national totals, average across models, sum impact types, and interpolate between impact year estimates)
-
convertTemps()
@@ -90,14 +90,14 @@ All functionsdefaultResults
+ gcamScenarios
- - Default outputs of
run_fredi()
A dataframe containing the default outputs of run_fredi()
+ - Six driver scenarios that can be passed as inputs to
run_fredi()
and run_fredi_sv()
-
-
gcamScenarios
+ gdpDefault
- - Six driver scenarios that can be passed as inputs to
run_fredi()
and run_fredi_sv()
+ - Scenario with values for U.S. Gross Domestic Product (GDP), which can be passed as an input to
run_fredi()
or run_fredi_methane()
.
-
get_sectorInfo()
@@ -107,7 +107,7 @@ All functionsget_sv_sectorInfo()
- - Retrieve a character vector of sectors available in the FrEDI Social Vulnerability (SV) module (run_fredi_sv) or a data frame with SV sectors and additional information.
+ - Retrieve a character vector of sectors available in the FrEDI Social Vulnerability (SV) module (run_fredi_sv) or a data frame with SV sectors and additional information.
-
import_inputs()
@@ -115,9 +115,9 @@ All functionspopScenario
+ popDefault
- - Population scenario to use as an input to
run_fredi()
and run_fredi_sv()
+ - U.S. state population scenario, which can be passed as an input to
run_fredi()
, run_fredi_sv()
, and/or FrEDI:run_fredi_methane()
.
-
run_fredi()
@@ -125,6 +125,11 @@ All functionsrun_fredi_methane()
+
+ - Project annual average impacts from methane, NOx, and ozone.
+
-
+
run_fredi_sv()
- Calculate climate change impacts on socially vulnerable (SV) populations throughout the 21st century for available sectors
diff --git a/docs/reference/popScenario.html b/docs/reference/popScenario.html
deleted file mode 100644
index cad31b4a..00000000
--- a/docs/reference/popScenario.html
+++ /dev/null
@@ -1,131 +0,0 @@
-
-Population scenario to use as an input to run_fredi() and run_fredi_sv() — popScenario • FrEDI
- Skip to contents
-
-
-
-
-
- Population scenario to use as an input to run_fredi()
and run_fredi_sv()
- Source: R/data.R
- popScenario.Rd
-
-
-
- A dataframe containing a population scenario to be passed as an input to run_fredi()
and run_fredi_sv()
.
-
-
-
-
-
- Format
- A data frame with 14,259 rows and 5 columns:
- year
-Year
-
-- region
-Region of U.S. ("Midwest", "Northeast", "Northern Plains", "Northwest", "Southeast", "Southern Plains", and "Southwest")
-
-- state
-One of 48 contiguous U.S. states or the District of Columbia
-
-- postal
-Postal code abbreviation associated with the state
-
-- state_pop
-State population for associated region and year
-
-
-
-
-
- Details
- This dataframe contains population projections at the state level from the Integrated Climate and Land Use Scenarios version 2 (ICLUSv2) model (Bierwagen et al, 2010; EPA 2017) under the Median variant projection of United Nations (2015).
-Bierwagen, B., D. M. Theobald, C. R. Pyke, A. Choate, P. Groth, J. V. Thomas, and P. Morefield. 2010. “National housing and impervious surface scenarios for integrated climate impact assessments.” Proc. Natl. Acad. Sci. 107 (49): 20887–20892. https://doi.org/10.1073/pnas.1002096107.
-EPA. 2017. Multi-Model Framework for Quantitative Sectoral Impacts Analysis: A technical report for the Fourth National Climate Assessment. U.S. Environmental Protection Agency, EPA 430-R-17-001.
-United Nations. 2015. World population prospects: The 2015 revision. New York: United Nations, Department of Economic and Social Affairs, Population Division.
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/reference/run_fredi.html b/docs/reference/run_fredi.html
index 09824b88..c5388b5f 100644
--- a/docs/reference/run_fredi.html
+++ b/docs/reference/run_fredi.html
@@ -12,7 +12,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -79,7 +79,7 @@
Usage
run_fredi(
- inputsList = list(tempInput = NULL, slrInput = NULL, gdpInput = NULL, popInput = NULL),
+ inputsList = list(temp = NULL, slr = NULL, gdp = NULL, pop = NULL),
sectorList = NULL,
aggLevels = c("national", "modelaverage", "impactyear", "impacttype"),
elasticity = 1,
@@ -93,8 +93,8 @@ Usage
Arguments
- - inputsList=NULL
-A list of named elements named elements (names(inputsList) = c("tempInput", "slrInput", "gdpInput", "popInput")
), each containing data frames of custom temperature, global mean sea level rise (GMSL), gross domestic product (GDP), and/or state-level population trajectories, respectively, over a continuous period in the range 2010 to 2300. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population and GDP scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
+ - inputsList=list(gdp=NULL, pop=NULL, temp=NULL, slr=NULL)
+A list with named elements (gdp
, pop
, temp
, and/or slr
), each containing data frames of custom scenarios for gross domestic product (GDP), state-level population, temperature, and/or global mean sea level rise (GMSL) trajectories, respectively, over a continuous period. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population and GDP scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
- sectorList=NULL
@@ -144,40 +144,40 @@ Value
Details
This function allows users to project annual average climate change impacts through 2300 (2010-2300) for available sectors. run_fredi()
is the main function in the FrEDI R package, described elsewhere (See https://epa.gov/cira/FrEDI for more information).
-Users can specify an optional list of custom scenarios with inputsList
(for more information on the format of inputs, see import_inputs()
). The function import_inputs()
can be used to importing custom scenarios from CSV files. import_inputs()
returns a list with elements tempInput
, slrInput
, gdpInput
, and popInput
, with each containing a data frame with a custom scenario for temperature, GMSL, GDP, and state-level population, respectively. If a user imports scenarios using import_inputs()
, they can pass the outputs of import_inputs()
directly to the run_fredi()
argument inputsList
. Note that the documentation for import_inputs()
can also provide additional guidance and specification on the formats for each scenario type.
-If inputsList = NULL
, run_fredi()
uses defaults for temperature, SLR, GDP, and population. Otherwise, run_fredi()
looks for a list object passed to the argument inputsList
. Within that list, run_fredi()
looks for list elements tempInput
, slrInput
, gdpInput
, and popInput
containing data frames with custom scenarios for temperature, GMSL, GDP, and state population, respectively. run_fredi()
will default back to the default scenarios for any list elements that empty or NULL
(in other words, running run_fredi(inputsList = list())
returns the same outputs as running run_fredi()
).
Temperature Inputs. The input temperature scenario requires CONUS temperatures in degrees Celsius relative to 1995 (degrees of warming relative to the baseline year--i.e., the central year of the 1986-2005 baseline). CONUS temperature values must be greater than or equal to zero degrees Celsius.
Users can convert global temperatures to CONUS temperatures using convertTemps(from = "global")
(or by specifying import_inputs(temptype = "global")
when using import_inputs()
to import a temperature scenario from a CSV file).
-tempInput
requires a data frame object with two columns with names "year"
, and "temp_C"
containing the year and CONUS temperatures in degrees Celsius, respectively.
-Temperature inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for temperature (i.e., inputsList = list(tempInput = NULL)
, run_fredi()
uses a default temperature scenario.
-
-SLR Inputs. The input SLR scenario requires values for changes in global mean sea level rise (GMSL) heights in centimeters (cm). GMSL heights must be greater than or equal to zero.
slrInput
requires a data frame object with two columns with names "year"
, "slr_cm"
containing the year and global mean sea level rise (GMSL) in centimeters, respectively.
-SLR inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for SLR (i.e., inputsList = list(slrInput = NULL)
, run_fredi()
first converts the input or default CONUS temperature scenario to global temperatures (using convertTemps()
) and then converts the global temperatures to a global mean sea level rise (GMSL) height in centimeters (using temps2slr()
).
-
-GDP Inputs. The input scenario for gross domestic product (GDP) requires national GDP values in 2015$. GDP values must be greater than or equal to zero.
gdpInput
requires a data frame object with two columns with names "year"
, and "gdp_usd"
containing the year and the national GDP, respectively. GDP values must be greater than or equal to zero.
+Users can specify an optional list of custom scenarios with inputsList
(for more information on the format of inputs, see import_inputs()
). The function import_inputs()
can be used to importing custom scenarios from CSV files. import_inputs()
returns a list with named elements gdp
, pop
, temp
, and slr
, with each containing a data frame with a custom scenario for GDP, state-level population, temperature, and/or GMSL respectively. If a user imports scenarios using import_inputs()
, they can pass the outputs of import_inputs()
directly to the run_fredi()
argument inputsList
. Note that the documentation for import_inputs()
can also provide additional guidance and specification on the formats for each scenario type.
+Otherwise, run_fredi()
looks for a list object passed to the argument inputsList
. Within that list, run_fredi()
looks for named list elements -- gdp
, pop
, temp
, and/or slr
-- each containing a data frame with a custom scenario for GDP, state population, temperature, and/or GMSL, respectively. If inputsList = NULL
or inputsList = list()
(default), run_fredi()
uses default trajectories for GDP, population, temperature, and SLR (see gdpDefault, popDefault, and gcamScenarios for more information). run_fredi()
will default back to the default scenarios for any list elements that empty or NULL
(in other words, running run_fredi(inputsList = list())
returns the same outputs as running run_fredi()
).
GDP Inputs. The input scenario for gross domestic product (GDP) requires national GDP values in 2015$. GDP values must be greater than or equal to zero.
gdp
requires a data frame object with two columns with names "year"
, and "gdp_usd"
containing the year and the national GDP, respectively. GDP values must be greater than or equal to zero.
GDP inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for GDP (i.e., inputsList = list(gdpInput = NULL)
, run_fredi()
uses a default GDP scenario.
+If the user does not specify an input scenario for GDP (i.e., inputsList = list(gdp = NULL)
, run_fredi()
uses a default GDP scenario.
-Population Inputs. The input population scenario requires state-level population values. Population values must be greater than or equal to zero.
popInput
requires a data frame object with five columns with names "region"
, "state"
, "postal"
, "year"
, and "state"
containing the year, the NCA region name, the state name, the postal code abbreviation for the state, and the state population, respectively.
+Population Inputs. The input population scenario requires state-level population values. Population values must be greater than or equal to zero.
pop
requires a data frame object with five columns with names "region"
, "state"
, "postal"
, "year"
, and "pop"
containing the year, the NCA region name (one of "Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
), the state name, the postal code abbreviation for the state, and the state population, respectively.
Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for population (i.e., inputsList = list(popInput = NULL)
, run_fredi()
uses a default population scenario.
+If the user does not specify an input scenario for population (i.e., inputsList = list(pop = NULL)
, run_fredi()
uses a default population scenario.
+
+Temperature Inputs. The input temperature scenario requires CONUS temperatures in degrees Celsius relative to 1995 (degrees of warming relative to the baseline year--i.e., the central year of the 1986-2005 baseline). CONUS temperature values must be greater than or equal to zero degrees Celsius.
Users can convert global temperatures to CONUS temperatures using convertTemps(from = "global")
(or by specifying import_inputs(temptype = "global")
when using import_inputs()
to import a temperature scenario from a CSV file).
+temp
requires a data frame object with two columns with names "year"
, and "temp_C"
containing the year and CONUS temperatures in degrees Celsius, respectively.
+Temperature inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+If the user does not specify an input scenario for temperature (i.e., inputsList = list(temp = NULL)
, run_fredi()
uses a default temperature scenario.
+
+SLR Inputs. The input SLR scenario requires values for changes in global mean sea level rise (GMSL) heights in centimeters (cm). GMSL heights must be greater than or equal to zero.
slr
requires a data frame object with two columns with names "year"
, "slr_cm"
containing the year and global mean sea level rise (GMSL) in centimeters, respectively.
+SLR inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+If the user does not specify an input scenario for SLR (i.e., inputsList = list(slr = NULL)
, run_fredi()
first converts the input or default CONUS temperature scenario to global temperatures (using convertTemps()
) and then converts the global temperatures to a global mean sea level rise (GMSL) height in centimeters (using temps2slr()
).
-
run_fredi()
linearly interpolates missing annual values for all input scenarios using non-missing values (each scenario requires at least two non-missing values as detailed above for each scenario type). After interpolation of the input scenarios, run_fredi()
subsets the input scenarios to values within the analysis period.
Temperatures are interpolated using 1995 as the baseline year (i.e., the central year of the 1986-2005 baseline) and GMSL is interpolated using 2000 as the baseline year. In other words, temperature (in degrees Celsius) is set to zero for the year 1995, whereas GMSL is set to zero for the year 2000. The interpolated temperature and GMSL scenarios are combined into a column called driverValue
, along with additional columns for year, the driver unit (column "driverUnit"
, with driverUnit = "degrees Celsius"
and driverUnit = "cm"
for temperature- and SLR-driven sectors, respectively), and the associated model type (column "model_type"
, with model_type = "GCM"
and model_type = "SLR"
for temperature- and SLR-driven sectors, respectively
-run_fredi()
calculations national population from state-level values and then calculates GDP per capita from values for GDP and national population. Values for state population, national population, national GDP (in 2015$), and national per capita GDP (in 2015$/capita) are provided in the results data frame in columns "state_pop"
, "national_pop"
, "gdp_usd"
, and "gdp_percap"
, respectively.
+
run_fredi()
linearly interpolates missing annual values for all input scenarios using non-missing values (each scenario requires at least two non-missing values as detailed above for each scenario type). After interpolation of the input scenarios, run_fredi()
subsets the input scenarios to values within the analysis period.
Temperatures are interpolated using 1995 as the baseline year (i.e., the central year of the 1986-2005 baseline) and GMSL is interpolated using 2000 as the baseline year. In other words, temperature (in degrees Celsius) is set to zero for the year 1995, whereas GMSL is set to zero for the year 2000. The interpolated temperature and GMSL scenarios are combined into a column called driverValue
, along with additional columns for year, the driver unit (column "driverUnit"
, with driverUnit = "degrees Celsius"
and driverUnit = "cm"
for temperature- and SLR-driven sectors, respectively), and the associated model type (column "model_type"
, with model_type = "GCM"
and model_type = "SLR"
for temperature- and SLR-driven sectors, respectively.
+run_fredi()
calculates national population from state-level values and then calculates GDP per capita from values for GDP and national population. Values for state population, national population, national GDP (in 2015$), and national per capita GDP (in 2015$/capita) are provided in the results data frame in columns "pop"
, "national_pop"
, "gdp_usd"
, and "gdp_percap"
, respectively.
By default, run_fredi()
will calculate impacts for all sectors included in the tool. Alternatively, users can pass a character vector specifying a single sector or a subset of sectors using the sectorList
argument. To see a list of sectors included within FrEDI, run get_sectorInfo()
. If sectorList = NULL
(default), all sectors are included.
By default, run_fredi()
calculates impacts starting in the year 2010 and ending in 2100. Specify an alternative end year for the analysis using the maxYear
argument. maxYear
has a default value of 2100
and minimum and maximum values of 2011
and 2300
, respectively. Alternatively, users can set argument thru2300 = TRUE
to override the maxYear
argument and set maxYear = 2300
. Note that the default scenarios included within FrEDI stop in the year 2100; users must provide custom input scenarios out to the desired end year and specify a maxYear >= 2100
(and maxYear <= 2300
) in order to return non-missing values for years after 2100.
Annual impacts for each sector, variant, impact type, and impact year combination included in the model are calculated by multiplying scaled climate impacts by a physical scalar and economic scalars and multipliers. Some sectors use Value of a Statistical Life (VSL) to adjust the value non-linearly over time. run_fredi()
uses a default value of elasticity = 1
to adjust VSL for applicable sectors and impacts (the default value of elasticity = 1
keeps VSL constant over time). A custom elasticity can be passed to the elasticity
argument. Applicable sectors and impacts are *Climate-Driven Changes in Air Quality (all impact types), ATS Temperature-Related Mortality (impactType = "N/A"
; i.e., all impact types), CIL Temperature-Related Mortality, Extreme Temperature (all impact types), Suicide (impactType = "N/A"
; i.e., all impact types), Southwest Dust (impactType = "All Mortality"
), Valley Fever (impactType = "Mortality"
), Vibriosis (impactType = "N/A"
; i.e., all impact types), and Wildfire (impactType = "Mortality"
).
run_fredi()
aggregates or summarizes results to level(s) of aggregation specified by the user (passed to aggLevels
) using the post-processing helper function aggregate_impacts()
. Users can specify all aggregation levels at once by specifying aggLevels = "all"
(default) or no aggregation levels (aggLevels = "none"
). Users can specify a single aggregation level or multiple aggregation levels by passing a single character string or character vector to aggLevels
. Options for aggregation include calculating national totals (aggLevels = "national"
), averaging across model types and models (aggLevels = "modelaverage"
), summing over all impact types (aggLevels = "impacttype"
), and interpolating between impact year estimates (aggLevels = "impactYear"
).
-If the user specifies aggLevels = "none"
, run_fredi()
returns a data frame with columns: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, "state_pop"
, "year"
, "physical_impacts"
, and "annual_impacts"
.
Columns "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, and "model"
all contain observation identifiers (sector name, variant, impact type, impact year, region, state, state postal code abbreviation, model type, and model, respectively).
+If the user specifies aggLevels = "none"
, run_fredi()
returns a data frame with columns: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, "pop"
, "year"
, "physical_impacts"
, and "annual_impacts"
.
Columns "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, and "model"
all contain observation identifiers (sector name, variant, impact type, impact year, region, state, state postal code abbreviation, model type, and model, respectively).
Columns "sectorprimary"
and "includeaggregate"
contain values that provide information about how to treat sectors and when aggregating over sectors (e.g., summing impacts across sectors). Note that FrEDI does not currently provide functionality to aggregate over sectors; this information is provided for user convenience.
Column "sectorprimary"
contains values indicating which variant to use as the primary one for each sector: sectorprimary = 1
for primary variants and sectorprimary = 0
for non-primary variants. When aggregating impacts over sectors, users should filter the outputs of run_fredi()
to variants with sectorprimary == 1
.
Column "includeaggregate"
contains values that provide information about how to treat sectors when aggregating over sectors (e.g., summing impacts across sectors). Sectors that have a value of includeaggregate == 0
should be dropped when aggregating results over sectors, to avoid potential double-counting of impacts for similar sectors. For instance, sectors ATS Temperature-Related Mortality, CIL Temperature-Related Mortality, and Extreme Temperature have values for temperature-related mortality. To avoid double counting, outputs of run_fredi()
should be filtered to values for which includeaggregate > 0
. Sectors with a value of includeaggregate > 0
can be included when aggregating over sectors; most sectors with a value of includeaggregate > 0
will have a value of includeaggregate = 1
. Values of includeaggregate > 1
flag additional information about sectors; currently, only the Suicide sector has a value of includeaggregate > 1
, with a value of includeaggregate = 2
. This flag indicates that the impacts from Suicide can be included when summing values across sectors, but may have some overlap with impacts from ATS Temperature-Related Mortality. For more information about the potential overlap between impacts for ATS Temperature-Related Mortality and Suicide, visit the technical documentation at https://epa.gov/cira/FrEDI/,
Columns "driverType"
, "driverUnit"
, and "driverValue"
contain information about the temperature and SLR scenarios.
-Columns "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "state_pop"
contain information about the GDP and population scenarios.
+Columns "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "pop"
contain information about the GDP and population scenarios.
Columns "physicalmeasure"
and "physical_impacts"
contain information about physical impacts.
Column "annual_impacts"
contains information on the economic value associated with annual impacts.
If the user specifies aggLevels = "all"
or other combinations of aggregation levels, run_fredi()
passes the results data frame and the aggLevels
argument to the aggregate_impacts()
function. aggregate_impacts()
then performs the following calculations, using the default grouping columns for the aggregate_impacts()
: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, and "year"
(note that the "variant"
column referred to below contains information about the variant name (or “N/A”
), as applicable).
-Aggregation Level Description impactyear
To aggregate over impact years, aggregate_impacts()
first separates results for sectors with only one impact year estimate (i.e., impactYear = "N/A"
) from from observations with multiple impact year estimates (i.e., sectors with results for both impactYear = "2010"
and impactYear = "2090"
). For these sectors with multiple impact years, physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
) are linearly interpolated between impact year estimates. For any model run years above 2090, annual results for sectors with multiple impact years return the 2090 estimate. The interpolated values are then row-bound to the results for sectors with a single impact year estimate, and column impactYear
set to impactYear = "Interpolation"
for all values. If "impactyear"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
aggregates over impact years before performing other types of aggregation. modelaverage
To aggregate over models for temperature-driven sectors, aggregate_impacts()
averages physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all GCM models present in the data. aggregate_impacts()
drops the column "model"
from the grouping columns when averaging over models. Averages exclude observations with missing values. However, If all values within a grouping are missing, the model average is set to NA
. The values in column "model"
are set to "Average"
for model averages and the model averages data frame is then row-bound to the main results data frame. For SLR-driven sectors, there is no need for additional model aggregation; these values already have model = "Interpolation"
. If "modelaverage"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years (if "impactyear"
present in aggLevels
or if aggLevels = "all"
) before aggregating over models. national
To aggregate values to the national level, aggregate_impacts()
sums physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all states present in the data. aggregate_impacts()
drops the columns "region"
, "state"
, and "postal"
when summing over states and regions. Years which have missing column data for all regions return as NA
. Values for columns "region"
, "state"
, and "postal"
are set to "National Total"
, All
, and US
, respectively. The data frame with national totals is then row-bound to the main results data frame. If "national"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years and/or models (if "impactyear"
and/or "modelaverage"
are present in aggLevels
or if aggLevels = "all"
) before aggregating over models. impacttype
To aggregate values over impact types, aggregate_impacts()
sums annual impacts (column "annual_impacts"
) across all impact types for each sector. aggregate_impacts()
drops the column "impactType"
and "physicalmeasure"
from the grouping columns when summing over impact types. Years which have missing column data for all impact types return as NA
. All values in column "impactType"
are set to "all"
. Aggregating over impact types, drops columns related to physical impacts (i.e., columns "physicalmeasure"
and "physical_impacts"
). These columns are dropped since aggregating over impact types for some sectors requires summing costs over different types of physical impacts, so reporting the physical impacts would be nonsensical.
After aggregating values, aggregate_impacts()
joins the data frame of impacts with information about "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "state_pop"
.
+Aggregation Level Description impactyear
To aggregate over impact years, aggregate_impacts()
first separates results for sectors with only one impact year estimate (i.e., impactYear = "N/A"
) from from observations with multiple impact year estimates (i.e., sectors with results for both impactYear = "2010"
and impactYear = "2090"
). For these sectors with multiple impact years, physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
) are linearly interpolated between impact year estimates. For any model run years above 2090, annual results for sectors with multiple impact years return the 2090 estimate. The interpolated values are then row-bound to the results for sectors with a single impact year estimate, and column impactYear
set to impactYear = "Interpolation"
for all values. If "impactyear"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
aggregates over impact years before performing other types of aggregation. modelaverage
To aggregate over models for temperature-driven sectors, aggregate_impacts()
averages physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all GCM models present in the data. aggregate_impacts()
drops the column "model"
from the grouping columns when averaging over models. Averages exclude observations with missing values. However, If all values within a grouping are missing, the model average is set to NA
. The values in column "model"
are set to "Average"
for model averages and the model averages data frame is then row-bound to the main results data frame. For SLR-driven sectors, there is no need for additional model aggregation; these values already have model = "Interpolation"
. If "modelaverage"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years (if "impactyear"
present in aggLevels
or if aggLevels = "all"
) before aggregating over models. national
To aggregate values to the national level, aggregate_impacts()
sums physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all states present in the data. aggregate_impacts()
drops the columns "region"
, "state"
, and "postal"
when summing over states and regions. Years which have missing column data for all regions return as NA
. Values for columns "region"
, "state"
, and "postal"
are set to "National Total"
, All
, and US
, respectively. The data frame with national totals is then row-bound to the main results data frame. If "national"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years and/or models (if "impactyear"
and/or "modelaverage"
are present in aggLevels
or if aggLevels = "all"
) before aggregating over models. impacttype
To aggregate values over impact types, aggregate_impacts()
sums annual impacts (column "annual_impacts"
) across all impact types for each sector. aggregate_impacts()
drops the column "impactType"
and "physicalmeasure"
from the grouping columns when summing over impact types. Years which have missing column data for all impact types return as NA
. All values in column "impactType"
are set to "all"
. Aggregating over impact types, drops columns related to physical impacts (i.e., columns "physicalmeasure"
and "physical_impacts"
). These columns are dropped since aggregating over impact types for some sectors requires summing costs over different types of physical impacts, so reporting the physical impacts would be nonsensical.
After aggregating values, aggregate_impacts()
joins the data frame of impacts with information about "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "pop"
.
If outputList = FALSE
(default), run_fredi()
returns a data frame of annual average impacts over the analysis period, for each sector, variant, impact type, impact year, region, state, model type ("GCM"
or "SLR"
), and model. If outputList = TRUE
, in addition to the data frame of impacts, run_fredi()
returns a list object containing information about values for function arguments, driver scenarios, and population and GDP scenarios.
@@ -190,16 +190,15 @@ Examples### Load FrEDI
require(FrEDI)
-### Run function with defaults (same as `defaultResults` dataset)
+### Run function with defaults
run1 <- run_fredi()
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from defaults...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -207,62 +206,71 @@ Examplesdata("gcamScenarios")
gcamScenarios |> glimpse()
#> Rows: 606
-#> Columns: 4
-#> $ year <int> 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2…
-#> $ temp_C <dbl> 0.1269649, 0.1575513, 0.1858310, 0.2101611, 0.2306551, 0.2444…
-#> $ slr_cm <dbl> 0.0000000, 0.2727356, 0.5552278, 0.8458496, 1.1430287, 1.4440…
-#> $ scenario <chr> "Hector_GCAM_v5.3_ECS_3.0_REF", "Hector_GCAM_v5.3_ECS_3.0_REF…
+#> Columns: 6
+#> $ year <int> 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20…
+#> $ temp_C_conus <dbl> 0.1804171, 0.2238804, 0.2640659, 0.2986389, 0.3277609, 0…
+#> $ temp_C_global <dbl> 0.1269649, 0.1575513, 0.1858310, 0.2101611, 0.2306551, 0…
+#> $ slr_cm <dbl> 0.0000000, 0.2727356, 0.5552278, 0.8458496, 1.1430287, 1…
+#> $ scenario <chr> "ECS_3.0_REF", "ECS_3.0_REF", "ECS_3.0_REF", "ECS_3.0_RE…
+#> $ model <chr> "Hector_GCAM_v5.3", "Hector_GCAM_v5.3", "Hector_GCAM_v5.…
### Load population scenario and glimpse data
-data(popScenario)
-popScenario |> glimpse()
+data("popDefault")
+popDefault |> glimpse()
#> Rows: 14,259
#> Columns: 5
-#> $ year <dbl> 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, …
#> $ region <chr> "Southeast", "Southeast", "Southeast", "Southeast", "Southea…
#> $ state <chr> "Alabama", "Alabama", "Alabama", "Alabama", "Alabama", "Alab…
#> $ postal <chr> "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", …
+#> $ year <int> 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, …
#> $ state_pop <dbl> 4779736, 4823623, 4867509, 4911396, 4955282, 4999169, 503604…
### Subset climate scenario
-temps1 <- gcamScenarios |> filter(scenario=="Hector_GCAM_v5.3_ECS_3.0_ref")
-temps1 <- temps1 |> mutate(temp_C = temp_C_global |> convertTemps(from="global"))
-#> Error in mutate(temps1, temp_C = convertTemps(temp_C_global, from = "global")): ℹ In argument: `temp_C = convertTemps(temp_C_global, from = "global")`.
-#> Caused by error:
-#> ! object 'temp_C_global' not found
-temps1 <- temps1 |> select(year, temp_C)
+temps1 <- gcamScenarios |> filter(scenario=="ECS_3.0_ref")
+temps1 <- temps1 |> select(year, temp_C_conus)
### Run custom scenario
-run2 <- run_fredi(inputsList=list(tempInput=temps1, popInput=popScenario))
-#> Checking input values...
-#> Creating temperature scenario from user inputs...
-#> Error in map(regions0, function(region_i) { df_i <- filter(data, region == region_i) x_i <- df_i[["year"]] y_i <- df_i[[column0]] new_i <- approx(x = x_i, y = y_i, xout = years, rule = rule, method = method) new_i <- as_tibble(new_i) new_i <- rename_at(new_i, c(cols0), ~cols1) new_i <- mutate(new_i, region = region_i) return(new_i)}): ℹ In index: 1.
-#> Caused by error in `approx()`:
-#> ! need at least two non-NA values to interpolate
+run2 <- run_fredi(inputsList=list(temp=temps1, pop=popDefault))
+#> Checking scenarios...
+#>
+#> Checking input values for pop inputs...
+#> Column "pop" not found in popfile data!
+#> Looking for columns with matches to the string "pop"...1 match found!
+#> Using column "", and renaming to "pop"...
+#> Data is missing the following required columns: state_pop!
+#> Dropping pop inputs from outputs.
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
+#>
+#> Finished.
### Load scenarios from file:
scenariosPath <- system.file(package="FrEDI") |> file.path("extdata","scenarios")
scenariosPath |> list.files()
-#> [1] "GCAM_scenario.csv" "State ICLUS Population.csv"
-#> [3] "slr_from_GCAM.csv"
+#> [1] "gcamDefault.csv" "gcamScenarios.csv" "gdpDefault.csv"
+#> [4] "popDefault.csv"
### SLR Scenario File Name
-slrInputFile <- scenariosPath |> file.path("slr_from_GCAM.csv")
+slrInputFile <- scenariosPath |> file.path("gcamDefault.csv")
### Population Scenario File Name
-popInputFile <- scenariosPath |> file.path("State ICLUS Population.csv")
+popInputFile <- scenariosPath |> file.path("popDefault.csv")
### Import inputs
-x_inputs <- import_inputs(slrfile=slrInputFile, popfile=popInputFile, popArea="state")
+x_inputs <- import_inputs(inputsList=list(slr=slrInputFile, pop=popInputFile), popArea="state")
#>
#> In import_inputs():
#> Loading data...
#> User specified slrfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/slr_from_GCAM.csv...
+#> Importing data from C:/Users/knoiva/AppData/Local/R/win-library/4.4/FrEDI/extdata/scenarios/gcamDefault.csv...
#> Data loaded.
#> User specified popfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/State ICLUS Population.csv...
+#> Importing data from C:/Users/knoiva/AppData/Local/R/win-library/4.4/FrEDI/extdata/scenarios/popDefault.csv...
#> Data loaded.
#>
#> Checking input values...
@@ -271,23 +279,37 @@ Examples#> Values passed.
#>
#> Checking input values for pop inputs...
-#> Column "pop" not found in popfile data!
-#> Looking for columns with matches to the string "pop"...1 match found!
-#> Using column "state_pop", and renaming to "state_pop"...
+#> Checking that all states, etc. are present...
+#>
+#> Checking inputs for unique regions, states...
+#> All regions present...
+#> All states present...
#> Values passed.
#>
#> Finished.
### Run custom scenarios
run3 <- run_fredi(inputsList=x_inputs)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
+#> Checking scenarios...
+#>
+#> Checking input values for slr inputs...
+#> Values passed.
+#>
+#> Checking input values for pop inputs...
+#> Checking that all states, etc. are present...
+#>
+#> Checking inputs for unique regions, states...
+#> All regions present...
+#> All states present...
+#> Values passed.
#> Creating SLR scenario from user inputs...
-#> No GDP scenario provided...Using default GDP scenario...
#> Creating population scenario from user inputs...
-#> Updating scalars...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -321,32 +343,37 @@ Examples
### Run for a single sector, with default inputs, no aggregation, and elasticity=1:
run4 <- run_fredi(sectorList="ATS Temperature-Related Mortality", aggLevels="none", elasticity=1)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from defaults...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
#> Formatting results...
#>
#> Finished.
### Set end year for analysis to 2110 -- messages user and returns a null value since default scenarios only have values out to 2100
run5 <- run_fredi(maxYear=2110)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Temperature scenario must have at least one non-missing value in or after the year 2110...
+#> Checking scenarios...
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
#>
-#> Exiting...
+#> Finished.
### Set end year for analysis to 2300 -- messages user and returns a null value since default scenarios only have values out to 2100)
run6 <- run_fredi(thru2300=TRUE)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Temperature scenario must have at least one non-missing value in or after the year 2300...
+#> Checking scenarios...
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
#>
-#> Exiting...
+#> Finished.
@@ -358,11 +385,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/run_fredi_sv.html b/docs/reference/run_fredi_sv.html
index 082f5c36..f234cad7 100644
--- a/docs/reference/run_fredi_sv.html
+++ b/docs/reference/run_fredi_sv.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -77,8 +77,7 @@
Usage
run_fredi_sv(
sector = NULL,
- driverInput = NULL,
- popInput = NULL,
+ inputsList = list(pop = NULL, temp = NULL, slr = NULL),
silent = TRUE,
.testing = FALSE
)
@@ -90,22 +89,22 @@ Argumentsget_sv_sectorInfo() for a list of available sectors).
-- driverInput
-A data frame of up to four custom scenarios for drivers (temperature or global mean sea level rise). driverInput
requires a data frame with columns of "year"
and "scenario"
. The data frame must also include a third column: "temp_C"
for temperature-driven sectors (containing temperature values in degrees Celsius of warming for the contiguous U.S.) or "slr_cm"
for sea level rise (SLR)-driven sectors (containing values for global mean sea level rise in centimeters). Run get_sv_sectorInfo(gcmOnly=TRUE)
to see temperature-driven sectors in the SV module and get_sv_sectorInfo(slrOnly=TRUE)
to see SLR-driven scenarios. Users can also pass a data frame with all four columns ("year"
, "scenario"
, "temp_C"
, and "slr_cm"
), in which case run_fredi_sv()
determines whether to use the "temp_C"
or "slr_cm"
column as the driver trajectory based on the specified sector. Driver inputs for all scenarios should start in the year 2000 or earlier. All scenarios must include at least two non-missing values (especially values before or at 2000 and at or after 2100). If any required columns are missing, run_fredi_sv()
will use the default temperature or sea level rise scenario from run_fredi()
. If the data frame passed to driverInput
has more than four unique scenarios, run_fredi_sv()
will only run the first four scenarios.
+- silent
+A logical (TRUE/FALSE
) value indicating the level of messaging desired by the user (defaults to silent=TRUE
)
-- popInput
-The input population scenario requires a data frame object with a single scenario of state-level population values.
The population scenario must have five columns with names "year"
, "region"
, "state"
, "postal"
, and "state_pop"
containing the year, the NCA region name, the state name, the postal code abbreviation (e.g., "ME" for "Maine") for the state, and the state population, respectively.
-popInput
only accepts a a single scenario, in contrast to driverInput
. In other words, run_fredi_sv()
uses the same population scenario for any and all driver scenarios passed to driverInput
.
-If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario.
+- inputsList=list(pop=NULL, temp=NULL, slr=NULL)
+A list with named elements (pop
, temp
, and/or slr
), each containing data frames of custom scenarios for state-level population, temperature, and/or global mean sea level rise (GMSL) trajectories, respectively, over a continuous period. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
pop. The input population scenario requires a data frame object with a single scenario of population values for each of the 48 U.S. states and the District of Columbia comprising the contiguous U.S. (CONUS).
The population scenario must have five columns with names "region"
, "state"
, "postal"
, "year"
, and "_pop"
containing the NCA region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
), the state name, the two-letter postal code abbreviation for the state (e.g., "ME"
for Maine), the year, and the state population, respectively.
+The input population scenario can only contain a single scenario, in contrast to values for temperature or SLR inputs. In other words, run_fredi_sv()
uses the same population scenario when running any and all of the temperature or SLR scenarios passed to run_fredi_sv()
.
+If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario (see documentation for popScenario).
Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (2100).
Population values must be greater than or equal to zero.
+
+temp or slr. The input temperature or SLR scenario should be a data frame containing one or more custom scenarios. These inputs should be formulated similarly to those for run_fredi()
and import_inputs()
, with an additional column (scenario
) indicating the unique scenario identifier. Temperature and/or SLR input scenarios must have at least one non-missing value in the year 2000 or earlier and at least one non-missing value in or after the final analysis year (2100).
temp. Temperature inputs are used by run_fredi_sv()
with temperature-driven sectors; run get_sv_sectorInfo(gcmOnly=TRUE)
to get a list of the temperature-driven sectors available for the SV module. Temperature inputs require a data frame with columns of year
, temp_C
, and scenario
, respectively containing the year associated with an observation, temperature values for CONUS in degrees Celsius of warming relative to a 1995 baseline (where 1995 is the central year of a 1986-2005 baseline period -- i.e., values should start at zero in the year 1995), and a unique scenario identifier. If no temperature scenario is specified (i.e., inputsList$temp
is NULL
) when running a temperature-driven sector, run_fredi_sv()
will use a default temperature scenario (see FrEDI:gcamScenarios).
+slr. SLR inputs are used by run_fredi_sv()
with sea level rise-driven sectors; run get_sv_sectorInfo(slrOnly=TRUE)
to get a list of the SLR-driven sectors available for the SV module. SLR inputs require a data frame with columns of year
, slr_cm
, and scenario
, respectively containing the global mean sea level rise in centimeters relative to a 2000 baseline (i.e., values should start at zero in the year 2000), and a unique scenario identifier. If no SLR scenario is specified (i.e., inputsList$slr
is NULL
) when running a temperature-driven sector: if a user has supplied a temperature scenario (i.e., inputsList$temp
is not NULL
), run_fredi_sv()
will calculate sea level rise values from the temperature inputs using the temps2slr()
function; if no temperature scenario is provided, run_fredi_sv
will use a default SLR scenario (see FrEDI:gcamScenarios).
+
-
-- silent
-A logical (TRUE/FALSE
) value indicating the level of messaging desired by the user (defaults to silent=TRUE
).
-
Value
@@ -117,17 +116,8 @@ Value
Details
run_fredi_sv()
projects annual climate change impacts for socially vulnerable (SV) populations throughout the 21st century (2010-2100) for available sectors, using default or user-specified population, temperature, and sea level rise (SLR) trajectories. run_fredi_sv()
is the main function for the FrEDI Social Vulnerability (SV) module in the FrEDI R package, described elsewhere (See https://epa.gov/cira/FrEDI for more information). The SV module extends the FrEDI framework to socially vulnerable populations using data underlying a 2021 U.S. Environmental Protection Agency (EPA) report on Climate Change and Social Vulnerability in the United States.
Users can run run_fredi_sv()
to generate annual physical impacts for SV groups for individual sectors. When running run_fredi_sv()
, users must specify one of the sectors in the SV module; use get_sv_sectorInfo()
for a list of available sectors.
-run_fredi_sv()
can be run with default population and climate (temperature and SLR) trajectories or use run_fredi_sv()
to run custom scenarios. Running run_fredi_sv()
with custom climate scenarios requires passing a data frame of scenarios to the driverInput
argument. run_fredi_sv()
can also be run with a custom population scenario by passing a data frame of regional population trajectories to the popInput
argument; unlike climate scenarios, run_fredi_sv()
will only run a single scenario at a time.
driverInput
can take a data frame containing up to four custom scenarios for drivers (temperature or global mean sea level rise). driverInput
requires a data frame with columns of "year"
and "scenario"
. The data frame must also include a third column: "temp_C"
for temperature-driven sectors (containing temperature values in degrees Celsius of warming for the contiguous U.S.) or "slr_cm"
for sea level rise (SLR)-driven sectors (containing values for global mean sea level rise in centimeters). Run get_sv_sectorInfo(gcmOnly = TRUE)
to see temperature-driven sectors in the SV module and get_sv_sectorInfo(slrOnly = TRUE)
to see SLR-driven scenarios. Users can also pass a data frame with all four columns ("year"
, "scenario"
, "temp_C"
, and "slr_cm"
), in which case run_fredi_sv()
determines whether to use the "temp_C"
or "slr_cm"
column as the driver trajectory based on the specified sector. If any required columns are missing, run_fredi_sv()
will use the default temperature or sea level rise scenario from run_fredi()
. If the data frame passed to driverInput
has more than four unique scenarios, run_fredi_sv()
will only run the first four scenarios.
Temperature inputs must be temperature change in degrees Celsius for the contiguous U.S. (use convertTemps()
to convert global temperatures to CONUS temperatures before passing to driverInput
) relative to a 1995 baseline (where 1995 is the central year of a 1986-2005 baseline period; values should start at zero in the year 1995).
-Sea level rise inputs must be in centimeters relative to a 2000 baseline (i.e., values should start at zero in the year 2000). Driver inputs for all scenarios should start in the year 2000 or earlier. All scenarios must include at least two non-missing values (especially values before or at 2000 and at or after 2100).
-
-The input population scenario requires a data frame object with a single scenario of state-level population values.
The population scenario must have five columns with names "year"
, "region"
, "state"
, "postal"
, and "state_pop"
containing the year, the NCA region name, the state name, the postal code abbreviation (e.g., "ME" for "Maine") for the state, and the state population, respectively.
-popInput
only accepts a a single scenario, in contrast to driverInput
. In other words, run_fredi_sv()
uses the same population scenario for any and all driver scenarios passed to driverInput
.
-If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario.
-Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (2100).
-Population values must be greater than or equal to zero.
-The default regional population scenario is drawn from the Integrated Climate and Land Use Scenarios version 2 (ICLUSv2) model (Bierwagen et al, 2010; EPA 2017) under the Median variant projection of United Nations (United Nations, 2015). Note that the FrEDI SV default population scenario differs from the default population scenario used by run_fredi()
.
-
-
The output of run_fredi_sv()
is an R data frame object containing average annual physical impacts for socially vulnerable groups, at the NCA region level and five-year increments.
+run_fredi_sv()
can be run with default population and climate (temperature and SLR) trajectories or use run_fredi_sv()
to run custom scenarios. Running run_fredi_sv()
with custom climate scenarios requires passing a data frame of scenarios to the driverInput
argument. run_fredi_sv()
can also be run with a custom population scenario by passing a data frame of regional population trajectories to the popInput
argument; unlike climate scenarios, run_fredi_sv()
will only run a single scenario at a time.
+The output of run_fredi_sv()
is an R data frame object containing average annual physical impacts for socially vulnerable groups, at the NCA region level and five-year increments.
References
@@ -141,163 +131,18 @@ References
Examples
- ### Run SV Module with defaults without specifying sector
-df_sv <- run_fredi_sv()
-#> [1] "Please select a sector: "
-#> [1] "1. Air Quality - Childhood Asthma"
-#> [1] "2. Air Quality - Premature Mortality"
-#> [1] "3. Labor"
-#> [1] "4. Extreme Temperature"
-#> [1] "5. Roads"
-#> [1] "6. Transportation Impacts from High Tide Flooding"
-#> [1] "7. Coastal Properties"
-#> Warning: type 29 is unimplemented in 'type2char'
-#> Error in readline(prompt = sector_msg3): INTEGER() can only be applied to a 'integer', not a 'unknown type #29'
-
-### Return a character vector with the names of all of the sectors in the FrEDI SV Module:
-get_sv_sectorInfo()
-#> [1] "Air Quality - Childhood Asthma"
-#> [2] "Air Quality - Premature Mortality"
-#> [3] "Coastal Properties"
-#> [4] "Extreme Temperature"
-#> [5] "Labor"
-#> [6] "Roads"
-#> [7] "Transportation Impacts from High Tide Flooding"
-
-### Return a data frame of all of the sectors in the FrEDI SV Module (sector names and additional information)
-get_sv_sectorInfo(description=T)
-#> sector modelType driverUnit
-#> 1 Air Quality - Childhood Asthma GCM degrees Celsius
-#> 2 Air Quality - Premature Mortality GCM degrees Celsius
-#> 3 Coastal Properties SLR cm
-#> 4 Extreme Temperature GCM degrees Celsius
-#> 5 Labor GCM degrees Celsius
-#> 6 Roads GCM degrees Celsius
-#> 7 Transportation Impacts from High Tide Flooding SLR cm
-#> impactUnit
-#> 1 Childhood asthma cases
-#> 2 Premature Mortality
-#> 3 Individuals threatened with total property loss
-#> 4 Mortality
-#> 5 Hours of labor lost
-#> 6 Hours of delay
-#> 7 Hours of delay
-#> variants
-#> 1 N/A
-#> 2 N/A
-#> 3 Without Adaptation, With Adaptation
-#> 4 N/A
-#> 5 N/A
-#> 6 No Adaptation, Proactive Adaptation
-#> 7 Without Adaptation, With Adaptation
-
-### Run SV Module with defaults for "Coastal Properties" without saving
-df_sv <- run_fredi_sv(sector="Coastal Properties")
-#> Running FrEDI SV for sector 'Coastal Properties':
-#>
-#> Preparing driver scenario...
-#> Using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#>
-#> Preparing population scenario...
-#> Using default population scenario...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Coastal Properties", variant="Without Adaptation", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#>
-#> Calculating impacts for sector="Coastal Properties", variant="With Adaptation", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-### Run SV Module with defaults for "Extreme Temperature" without saving
-df_sv <- run_fredi_sv(sector="Extreme Temperature")
-#> Running FrEDI SV for sector 'Extreme Temperature':
-#>
-#> Preparing driver scenario...
-#> Using default temperature scenario...
-#>
-#> Preparing population scenario...
-#> Using default population scenario...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-### Load temperature scenarios
-load(gcamScenarios)
-#> Error in load(gcamScenarios): bad 'file' argument
-
-### Load population scenario
-load(popScenario)
-#> Error in load(popScenario): bad 'file' argument
-
-### Run SV Module for "Extreme Temperature" with custom population and temperature scenarios
-df_sv <- run_fredi_sv(sector = "Extreme Temperature", driverInput = gcamScenarios, popInput = popScenario)
-#> Running FrEDI SV for sector 'Extreme Temperature':
-#> Checking `driverInput` values...
-#> Checking scenarios in `driverInput`...
-#> Warning: `driverInput` has more than four distinct scenarios!
-#> Only the first four scenarios will be used...
-#> Checking `driverInput` values for temperature scenario...
-#> All temperature scenario columns present...
-#> Checking `popInput` values...
-#> All population scenario columns present in `popInput`...
-#>
-#> Preparing driver scenario...
-#> Using temperature scenario from user inputs...
-#>
-#> Preparing population scenario...
-#> Creating population scenario from user inputs...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_20"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_30"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_50"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-
+
# Calculate the run_fredi_sv() results for a single impact sector
-
-# NOTE: the run_fredi_sv() module takes a few minutes to run because
-# the damages are calculated at the Census tract level and then
-# aggregated to the regional level
+
+### Calculate the run_fredi_sv() results for a single impact sector
-# take formatted temperature vector from the output of the
-# import_inputs() helper function
- temp_input <- inputs_list$tempInput
+### NOTE: the run_fredi_sv() module takes a few minutes to run because
+### the damages are calculated at the Census tract level and then
+### aggregated to the regional level
-# To see all available sectors, run:
-# FrEDI::get_sv_sectorInfo()
+### To see all available sectors, run: FrEDI::get_sv_sectorInfo()
-# Specify a specific sector
-sectorFlag = "Air Quality - Premature Mortality"
- # Purpose:
- # Specify the SV sector to calculate (can only run one sector at once)
- # Options: run FrEDI::get_sv_sectorInfo() to get a list of the
- # possible sectors
-driverFlag <- temp_input
- # Purpose:
- # Specify the temperature trajectory (up to 4) to use as an input.
- # Temperature needs to be in degrees C, *CONUS* temperature, relative
- # to the 1986-2005 average baseline
- # column 1 = 'year','column 2 = 'scenario', column 3 = 'temp_C'
- # NOTE: if temperature is in global degrees, use the
- # FrEDI::convertTemps() helper function to convert from global to CONUS
-popFlag <- NULL
- # Purpose:
- # Specify the population trajectory to use as an input.
- # column 1 = 'year', column 2 = 'region', column 3 = 'state', column 4 = 'postal', column 5 = 'state_pop'
- # default = if null, uses default population trajectory
-silentFlag = TRUE
- # Purpose:
- # Specify the level of messaging desired
- # Options: TRUE/FALSE
+### Sector Flag: Specify a specific sector
+### - Purpose: Specify the SV sector to calculate (can only run one sector at once)
+### - Options: Run FrEDI::get_sv_sectorInfo() to get a list of the possible sectors
+sectorFlag <- "Air Quality - Premature Mortality"
+
+### Silent Flag
+### - Purpose: Specify the level of messaging desired
+### - Options: TRUE/FALSE
+silentFlag <- TRUE
Step 3. Run FrEDI_SV
@@ -260,20 +254,23 @@ Step 3. Run FrEDI_SV
run_fredi(), as SV damage calculations are
conducted at finer spatial scales (e.g., U.S. Census tract vs. regional
level).
-
-#Run FrEDI using inputs and parameters set in Step #2
+
+### Run FrEDI using inputs and parameters set in Step 2
+output_sv <- run_fredi_sv(
+ sector = sectorFlag,
+ inputsList = inputs_list,
+ silent = silentFlag
+)
-output_df <- run_fredi_sv(sector = sectorFlag,
- driverInput = driverFlag,
- popInput = popFlag,
- silent = silentFlag)
+### Glimpse results
+output_sv |> glimpse()
-# Option: write output
-## Write Full Dataframe to CSV (or feather)
-# write.csv(output_df, './output/example_output.csv')
+### Option: write output
+### Write Full Dataframe to CSV (or feather)
+# write.csv(output_sv, './output/example_output.csv')
-#First five lines of output dataframe
-#output_df[1:5,]
+### First five lines of output dataframe
+# output_sv[1:5,]
FrEDI_SV
run_fredi(), as SV damage calculations are
conducted at finer spatial scales (e.g., U.S. Census tract vs. regional
level).
-
-#Run FrEDI using inputs and parameters set in Step #2
+
+### Run FrEDI using inputs and parameters set in Step 2
+output_sv <- run_fredi_sv(
+ sector = sectorFlag,
+ inputsList = inputs_list,
+ silent = silentFlag
+)
-output_df <- run_fredi_sv(sector = sectorFlag,
- driverInput = driverFlag,
- popInput = popFlag,
- silent = silentFlag)
+### Glimpse results
+output_sv |> glimpse()
-# Option: write output
-## Write Full Dataframe to CSV (or feather)
-# write.csv(output_df, './output/example_output.csv')
+### Option: write output
+### Write Full Dataframe to CSV (or feather)
+# write.csv(output_sv, './output/example_output.csv')
-#First five lines of output dataframe
-#output_df[1:5,]
+### First five lines of output dataframe
+# output_sv[1:5,]
Step 4. Analyze FrEDI_SV
@@ -294,11 +291,11 @@ Step 4. Analyze FrEDI_SV
diff --git a/docs/articles/References.html b/docs/articles/References.html
index b5ddb777..c4069184 100644
--- a/docs/articles/References.html
+++ b/docs/articles/References.html
@@ -28,7 +28,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -136,7 +136,7 @@ Example Applications
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
FrEDI_SV
diff --git a/docs/articles/References.html b/docs/articles/References.html
index b5ddb777..c4069184 100644
--- a/docs/articles/References.html
+++ b/docs/articles/References.html
@@ -28,7 +28,7 @@
FrEDI
- 4.1.0
+ 4.2.0
Example Applications
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
Citation
Hartin C, McDuffie E, Sarofim M, Noiva K (2024). FrEDI: The Framework for Evaluating Damages and Impacts (FrEDI). -R package version 4.1.1, https://epa.gov/cira/FrEDI/, https://github.com/USEPA/FrEDI/, https://usepa.github.io/FrEDI. +R package version 4.2.0, https://epa.gov/cira/FrEDI/, https://github.com/USEPA/FrEDI/, https://usepa.github.io/FrEDI.
@Manual{, title = {FrEDI: The Framework for Evaluating Damages and Impacts (FrEDI)}, author = {Corinne Hartin and Erin McDuffie and Marcus Sarofim and Karen Noiva}, year = {2024}, - note = {R package version 4.1.1, https://epa.gov/cira/FrEDI/, https://github.com/USEPA/FrEDI/}, + note = {R package version 4.2.0, https://epa.gov/cira/FrEDI/, https://github.com/USEPA/FrEDI/}, url = {https://usepa.github.io/FrEDI}, }diff --git a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyC0ITw.woff2 b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyC0ITw.woff2 index 6478b9ad..f4675de1 100644 Binary files a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyC0ITw.woff2 and b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyC0ITw.woff2 differ diff --git a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCAIT5lu.woff2 b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCAIT5lu.woff2 index dee82d4b..7ac6ae08 100644 Binary files a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCAIT5lu.woff2 and b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCAIT5lu.woff2 differ diff --git a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCIIT5lu.woff2 b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCIIT5lu.woff2 index b5664780..3d4f643a 100644 Binary files a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCIIT5lu.woff2 and b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCIIT5lu.woff2 differ diff --git a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCMIT5lu.woff2 b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCMIT5lu.woff2 index e0d65386..753e47ca 100644 Binary files a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCMIT5lu.woff2 and b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCMIT5lu.woff2 differ diff --git a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCkIT5lu.woff2 b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCkIT5lu.woff2 index 1005b7c8..49dbbaa5 100644 Binary files a/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCkIT5lu.woff2 and b/docs/deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCkIT5lu.woff2 differ diff --git a/docs/index.html b/docs/index.html index 10c20e37..293d84d1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -5,14 +5,14 @@ - +
Default outputs of run_fredi()
A dataframe containing the default outputs of run_fredi()
- Source: R/data.R
- defaultResults.Rd
Default outputs of run_fredi()
-A dataframe containing the default outputs of run_fredi()
Format
-A data frame with 1,501,500 rows and 20 columns:
- sector -
Name of the associated sector.
-
-- variant -
Name of the associated variant or adaptation (values are sector-specific).
-
-- impactYear -
Name of the impact year ("2010", "2090", "N/A", or "Interpolation").
-
-- impactType -
Name of the impact type ("all" or sector-specific values).
-
-- region -
Name of the associated region ("Midwest", "Northeast", "Northern Plains", "Northwest", "Southeast", "Southern Plains", "Southwest", or "National Total").
-
-- state -
Name of the associated state (or District of Columbia): "Alabama", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "District of Columbia", "Florida", "Georgia", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming". For the "National Total" region,
state = "All"
. For sectors with only has region-level data,state = "N/A"
.
-
-- postal -
Postal code abbreviation of the associated state (e.g.,
postal="AL"
forstate="Alabama"
). The postal code abbreviation for the District of Columbia is"DC"
. For the "National Total" region,postal = "US"
. For sectors with only has region-level data,postal = "N/A"
.
-
-- model_type -
Type of model used to calculate impacts --- either "GCM" (for "Global Climate Model") or "SLR" for ("Sea Level Rise")
-
-- model -
Name of the GCM ("Average", "CanESM2", "CCSM4", "GCM Ensemble", "GFDL-CM3", "GISS-E2-R", "HadGEM2-ES", "MIROC5", "MRI-CGCM3") or SLR model ("Interpolation")
-
-- sectorprimary -
A
0
or1
value indicating whether the sector is a primary CIRA sector (and whether it should be included when summing across sectors).sectorprimary=1
if a primary sector andsectorprimary=0
if not.
-
-- includeaggregate -
A
0
or1
value indicating whether the variant is the primary variant for the sector (and whether it should be included when summing across sectors).includeaggregate=1
if the variant is a primary variant andincludeaggregate=0
if not).
-
-- driverType -
Associated driver type ("Temperature" or "GMSL (SLR)").
-
-- driverUnit -
Unit for the associated driver type ("degrees Celsius" for temperature and "cm" for sea level rise).
-
-- driverValue -
Value for the associated driver type (in "degrees Celsius" for temperature and in "cm" for sea level rise).
-
-- gdp_usd -
National gross domestic product (GDP) for associated year in 2015 USD (U.S. dollars).
-
-- national_pop -
National population for associated year.
-
-- gdp_per_cap -
National GDP per capita for associated year in 2015 USD (U.S. dollars) per capita.
-
-- state_pop -
Population for the associated state (for state-level data) or region (for region-only data).
-
-- annual_impacts -
Annual impacts for associated sector, variant, impact type, impact year, region, state, model type, model, and year.
-
-
-
A dataframe containing six driver scenarios that can be passed as inputs to run_fredi()
and run_fredi_sv()
. This data frame has four columns -- year
, temp_C
, slr_cm
, and scenario
-- respectively containing:
gcamScenarios
is a data frame object containing six driver scenarios that can be passed as inputs to run_fredi()
and run_fredi_sv()
. This data frame has five columns -- year
, temp_C_global
, temp_C_conus
, slr_cm
, scenario
, and model
:
Usage
Format
- A data frame with 546 rows and 4 columns:
- year
+ A data frame with 606 rows and 6 columns:
- year
Year
-- temp_C
-Global temperature (in degrees Celsius) for the associated year and scenario
+- temp_C_global
+Global temperatures, in degrees Celsius, for the associated year and scenario
-- slr_cm
-Global Mean Sea Level Rise (in centimeters) for the associated year and scenario
+- temp_C_conus
+Temperatures for the contiguous U.S. (CONUS), in degrees Celsius, for the associated year and scenario (converted from global temperatures using convertTemps(from="global"))
-- scenario
-Associated scenario identifier
+- slr_cm
+Global Mean Sea Level Rise (GMSL or SLR), in centimeters, for the associated year and scenario (calculated from global temperatures using temps2slr()
)
+
+- scenario
+Associated scenario identifier (e.g., "ECS_3.0_REF"
)
+
+- model
+A string ("Hector_GCAM_v5.3"
) identifying the model (Hector, with GCAM v5.3) used in generating the global temperatures associated with each scenario
@@ -101,23 +107,32 @@ Source<
Details
-- year
+- year
The Common Era (CE) year associated with the observation.
-- temp_C
-Global temperature (i.e., degrees of warming above the baseline year of 1995) in degrees Celsius, for the associated year and scenario.
+- temp_C_global
+Global temperature (i.e., degrees of warming above the baseline year of 1995), in degrees Celsius, for the associated year and scenario.
+
+- temp_C_conus
+Temperatures (i.e., degrees of warming above the baseline year of 1995) for the contiguous U.S. (CONUS), in degrees Celsius, for the associated year and scenario (calculated from global temperatures using convertTemps(from="global")).
+
+- slr_cm
+Global Mean Sea Level Rise (GMSL or SLR), in centimeters, for the associated year and scenario (calculated from global temperatures using temps2slr()
).
-- slr_cm
-Global Mean Sea Level Rise (i.e., SLR) in centimeters for the associated year and scenario.
+- scenario
+Associated scenario identifier (e.g., "ECS_3.0_REF"
).
-- scenario
-Associated scenario identifier.
+- model
+A string ("Hector_GCAM_v5.3"
) identifying the model (Hector, with GCAM v5.3) used in generating the global temperatures associated with each scenario.
-
The scenarios in this dataframe were created using Hector, an open-source, reduced-form global carbon-cycle climate model (Hartin et al., 2015) to model temperatures associated with emissions scenarios from the Global Change Analysis Model v5.3 (GCAM). The Global Change Analysis Model v5.3 (GCAM) is an open source model that represents the linkages between energy, water, land, climate and economic systems (Calvin et al., 2019). Scenario identifiers in the scenario
column of gcamScenarios()
have the string "Hector_GCAM_v5.3_ECS_"
as a prefix, followed by the average warming temperature and the suffix "_REF"
(e.g., "Hector_GCAM_v5.3_ECS_3.0_REF"
for the default scenario for run_fredi()
and run_fredi_sv()
.
-These six temperature scenarios represent global temperatures; however, run_fredi()
and run_fredi_sv()
require temperature scenarios for the contiguous U.S. (CONUS). Therefore, to use the gcamScenarios
with run_fredi()
or run_fredi_sv()
, users must first convert temperatures in the temp_C
column to CONUS temperatures via the convertTemps function -- with argument from = "global"
(e.g., gcamScenarios |> mutate(temp_C = temp_C |> FrEDI::convertTemps(from = "global"))
).
-The GCAM scenarios can be passed directly to the SV module via the driverInput
argument (e.g., run_fredi_sv(driverInput = gcamScenarios)
), since run_fredi_sv()
is designed to run multiple scenarios. In contrast, run_fredi()
is intended to be run with a single scenario; gcamScenarios
should be subset to a specific scenario before passing the temperature scenario to run_fredi()
(e.g., run_fredi(list(tempInput=gcamScenarios |> dplyr::filter(scenario=="Hector_GCAM_v5.3_ECS_3.0_REF")))
to use the default scenario).
-Calvin, K., Patel, P., Clarke, L., et al. 2019. GCAM v5.1: representing the linkages between energy, water, land, climate, and economic systems, Geosci. Model Dev., 12:677–698. https://doi.org/10.5194/gmd-12-677-2019.
+
The scenarios in this data frame were created using Hector with GCAM v5.3:
Hector is an open-source, reduced-form global carbon-cycle climate model (Hartin et al., 2015) used to model temperatures associated with emissions scenarios from the Global Change Analysis Model v5.3 (GCAM).
+GCAM v5.3 -- i.e., the Global Change Analysis Model v5.3 -- is an open source model that represents the linkages between energy, water, land, climate and economic systems (Calvin et al., 2019).
+
Scenario identifiers in the scenario
column of gcamScenarios()
have the string "ECS_3.0_REF_"
as a prefix, followed by a suffix indicating an emissions intensity associated with the scenario (e.g., "20"
) -- for instance, the default scenario for run_fredi()
and run_fredi_sv()
is "ECS_3.0_REF"
. Other scenarios include "ECS_3.0_REF_20"
, "ECS_3.0_REF_30"
, "ECS_3.0_REF_50"
, "ECS_3.0_REF_70"
, and "ECS_3.0_REF_90"
.
+Users can use the scenarios in gcamScenarios
as inputs to FrEDI or the FrEDI SV Module:
Users can filter the gcamScenarios
data frame to any of these six scenarios, which can then be passed directly to the run_fredi()
function via a named element (temp
and/or slr
) in a list passed to the inputsList
argument -- e.g., run_fredi(inputsList=list(temp=gcamScenarios |> filter(scenario=="ECS_3.0_REF")))
will run using the default temperature scenario.
+Any or all of the GCAM scenarios can be passed directly to the FrEDI SV module via the run_fredi_sv()
function via a named list element (temp
and/or slr
) in a list passed to the inputsList
argument -- e.g., run_fredi_sv(inputsList=list(temp=gcamScenarios))
will run the SV module for all the GCAM scenarios provided in gcamScenarios
.
+gcamScenarios
can also be combined with other provided scenarios (gdpDefault
, popDefault
) in function calls (e.g., run_fredi(inputsList=list(temp=gcamScenarios |> filter(scenario=="ECS_3.0_REF"), gdp=gdpDefault, pop=popDefault))
) or user-provided data frames. For more information, see documentation for run_fredi()
, FrEDI:run_fredi_sv()
, FrEDI:run_fredi_methane()
, and import_inputs()
.
+
Calvin, K., Patel, P., Clarke, L., et al. 2019. GCAM v5.1: representing the linkages between energy, water, land, climate, and economic systems, Geosci. Model Dev., 12:677–698. https://doi.org/10.5194/gmd-12-677-2019.
Hartin, C.A., Patel, P., Schwarber, A., Link, R.P. and Bond-Lamberty, B.P., 2015. A simple object-oriented and open-source model for scientific and policy analyses of the global climate system–Hector v1. 0. Geoscientific Model Development, 8(4), pp.939-955.
@@ -126,11 +141,11 @@ Details
Format
-A data frame with 546 rows and 4 columns:
- year +
- year
Year
-- temp_C -
Global temperature (in degrees Celsius) for the associated year and scenario
+- temp_C_global +
Global temperatures, in degrees Celsius, for the associated year and scenario
-- slr_cm -
Global Mean Sea Level Rise (in centimeters) for the associated year and scenario
+- temp_C_conus +
Temperatures for the contiguous U.S. (CONUS), in degrees Celsius, for the associated year and scenario (converted from global temperatures using convertTemps(from="global"))
-- scenario -
Associated scenario identifier
+- slr_cm +
Global Mean Sea Level Rise (GMSL or SLR), in centimeters, for the associated year and scenario (calculated from global temperatures using
temps2slr()
)
+
+- scenario +
Associated scenario identifier (e.g.,
"ECS_3.0_REF"
)
+
+- model +
A string (
"Hector_GCAM_v5.3"
) identifying the model (Hector, with GCAM v5.3) used in generating the global temperatures associated with each scenario
A data frame with 606 rows and 6 columns:
Details
-- year +
- year
The Common Era (CE) year associated with the observation.
-- temp_C -
Global temperature (i.e., degrees of warming above the baseline year of 1995) in degrees Celsius, for the associated year and scenario.
+- temp_C_global +
Global temperature (i.e., degrees of warming above the baseline year of 1995), in degrees Celsius, for the associated year and scenario.
+
+- temp_C_conus +
Temperatures (i.e., degrees of warming above the baseline year of 1995) for the contiguous U.S. (CONUS), in degrees Celsius, for the associated year and scenario (calculated from global temperatures using convertTemps(from="global")).
+
+- slr_cm +
Global Mean Sea Level Rise (GMSL or SLR), in centimeters, for the associated year and scenario (calculated from global temperatures using
temps2slr()
).
-- slr_cm -
Global Mean Sea Level Rise (i.e., SLR) in centimeters for the associated year and scenario.
+- scenario +
Associated scenario identifier (e.g.,
"ECS_3.0_REF"
).
-- scenario -
Associated scenario identifier.
+- model +
A string (
"Hector_GCAM_v5.3"
) identifying the model (Hector, with GCAM v5.3) used in generating the global temperatures associated with each scenario.
-
The scenarios in this dataframe were created using Hector, an open-source, reduced-form global carbon-cycle climate model (Hartin et al., 2015) to model temperatures associated with emissions scenarios from the Global Change Analysis Model v5.3 (GCAM). The Global Change Analysis Model v5.3 (GCAM) is an open source model that represents the linkages between energy, water, land, climate and economic systems (Calvin et al., 2019). Scenario identifiers in the scenario
column of gcamScenarios()
have the string "Hector_GCAM_v5.3_ECS_"
as a prefix, followed by the average warming temperature and the suffix "_REF"
(e.g., "Hector_GCAM_v5.3_ECS_3.0_REF"
for the default scenario for run_fredi()
and run_fredi_sv()
.
These six temperature scenarios represent global temperatures; however, run_fredi()
and run_fredi_sv()
require temperature scenarios for the contiguous U.S. (CONUS). Therefore, to use the gcamScenarios
with run_fredi()
or run_fredi_sv()
, users must first convert temperatures in the temp_C
column to CONUS temperatures via the convertTemps function -- with argument from = "global"
(e.g., gcamScenarios |> mutate(temp_C = temp_C |> FrEDI::convertTemps(from = "global"))
).
The GCAM scenarios can be passed directly to the SV module via the driverInput
argument (e.g., run_fredi_sv(driverInput = gcamScenarios)
), since run_fredi_sv()
is designed to run multiple scenarios. In contrast, run_fredi()
is intended to be run with a single scenario; gcamScenarios
should be subset to a specific scenario before passing the temperature scenario to run_fredi()
(e.g., run_fredi(list(tempInput=gcamScenarios |> dplyr::filter(scenario=="Hector_GCAM_v5.3_ECS_3.0_REF")))
to use the default scenario).
Calvin, K., Patel, P., Clarke, L., et al. 2019. GCAM v5.1: representing the linkages between energy, water, land, climate, and economic systems, Geosci. Model Dev., 12:677–698. https://doi.org/10.5194/gmd-12-677-2019.
+The scenarios in this data frame were created using Hector with GCAM v5.3:
Hector is an open-source, reduced-form global carbon-cycle climate model (Hartin et al., 2015) used to model temperatures associated with emissions scenarios from the Global Change Analysis Model v5.3 (GCAM).
+GCAM v5.3 -- i.e., the Global Change Analysis Model v5.3 -- is an open source model that represents the linkages between energy, water, land, climate and economic systems (Calvin et al., 2019).
+
Scenario identifiers in the scenario
column of gcamScenarios()
have the string "ECS_3.0_REF_"
as a prefix, followed by a suffix indicating an emissions intensity associated with the scenario (e.g., "20"
) -- for instance, the default scenario for run_fredi()
and run_fredi_sv()
is "ECS_3.0_REF"
. Other scenarios include "ECS_3.0_REF_20"
, "ECS_3.0_REF_30"
, "ECS_3.0_REF_50"
, "ECS_3.0_REF_70"
, and "ECS_3.0_REF_90"
.
Users can use the scenarios in gcamScenarios
as inputs to FrEDI or the FrEDI SV Module:
Users can filter the
gcamScenarios
data frame to any of these six scenarios, which can then be passed directly to therun_fredi()
function via a named element (temp
and/orslr
) in a list passed to theinputsList
argument -- e.g.,run_fredi(inputsList=list(temp=gcamScenarios |> filter(scenario=="ECS_3.0_REF")))
will run using the default temperature scenario.
+Any or all of the GCAM scenarios can be passed directly to the FrEDI SV module via the
run_fredi_sv()
function via a named list element (temp
and/orslr
) in a list passed to theinputsList
argument -- e.g.,run_fredi_sv(inputsList=list(temp=gcamScenarios))
will run the SV module for all the GCAM scenarios provided ingcamScenarios
.
+gcamScenarios
can also be combined with other provided scenarios (gdpDefault
,popDefault
) in function calls (e.g.,run_fredi(inputsList=list(temp=gcamScenarios |> filter(scenario=="ECS_3.0_REF"), gdp=gdpDefault, pop=popDefault))
) or user-provided data frames. For more information, see documentation forrun_fredi()
,FrEDI:run_fredi_sv()
,FrEDI:run_fredi_methane()
, andimport_inputs()
.
+
Calvin, K., Patel, P., Clarke, L., et al. 2019. GCAM v5.1: representing the linkages between energy, water, land, climate, and economic systems, Geosci. Model Dev., 12:677–698. https://doi.org/10.5194/gmd-12-677-2019.
Hartin, C.A., Patel, P., Schwarber, A., Link, R.P. and Bond-Lamberty, B.P., 2015. A simple object-oriented and open-source model for scientific and policy analyses of the global climate system–Hector v1. 0. Geoscientific Model Development, 8(4), pp.939-955.
Details
Examples
### Return a dataframe of all of the sectors in FrEDI (sector names and additional information)
get_sectorInfo(description=T, gcmOnly=T)
-#> sector include model_type byState
-#> 3 ATS Temperature-Related Mortality 1 GCM 1
-#> 2 Asphalt Roads 1 GCM 1
-#> 4 CIL Agriculture 1 GCM 1
-#> 5 CIL Crime 1 GCM 1
-#> 6 CIL Temperature-Related Mortality 1 GCM 1
-#> 1 Climate-Driven Changes in Air Quality 1 GCM 1
-#> 8 Electricity Demand and Supply 1 GCM 1
-#> 9 Electricity Transmission and Distribution 1 GCM 1
-#> 10 Extreme Temperature 1 GCM 1
-#> 12 Inland Flooding 1 GCM 1
-#> 13 Labor 1 GCM 1
-#> 14 Marine Fisheries 1 GCM 1
-#> 16 Rail 1 GCM 1
-#> 17 Roads 1 GCM 1
-#> 18 Southwest Dust 1 GCM 1
-#> 15 Suicide 1 GCM 1
-#> 19 Urban Drainage 1 GCM 1
-#> 20 Valley Fever 1 GCM 1
-#> 21 Vibriosis 1 GCM 1
-#> 22 Water Quality 1 GCM 1
-#> 23 Wildfire 1 GCM 1
-#> 24 Wind Damage 1 GCM 1
-#> 25 Winter Recreation 1 GCM 1
+#> sector include model_type
+#> 1 ATS Temperature-Related Mortality 1 GCM
+#> 2 Asphalt Roads 1 GCM
+#> 3 CIL Agriculture 1 GCM
+#> 4 CIL Crime 1 GCM
+#> 5 CIL Temperature-Related Mortality 1 GCM
+#> 6 Climate-Driven Changes in Air Quality 1 GCM
+#> 7 Electricity Demand and Supply 1 GCM
+#> 8 Electricity Transmission and Distribution 1 GCM
+#> 9 Extreme Temperature 1 GCM
+#> 10 Inland Flooding 1 GCM
+#> 11 Labor 1 GCM
+#> 12 Marine Fisheries 1 GCM
+#> 13 Rail 1 GCM
+#> 14 Roads 1 GCM
+#> 15 Southwest Dust 1 GCM
+#> 16 Suicide 1 GCM
+#> 17 Urban Drainage 1 GCM
+#> 18 Valley Fever 1 GCM
+#> 19 Vibriosis 1 GCM
+#> 20 Water Quality 1 GCM
+#> 21 Wildfire 1 GCM
+#> 22 Wind Damage 1 GCM
+#> 23 Winter Recreation 1 GCM
#> variants
-#> 3 Mean, Low Confidence Interval, High Confidence Interval
+#> 1 Mean, Low Confidence Interval, High Confidence Interval
#> 2 N/A
-#> 4 With CO2 Fertilization, Without CO2 Fertilization
-#> 5 N/A
-#> 6 Median, Low Confidence Interval, High Confidence Interval
-#> 1 2011 Emissions, 2040 Emissions
-#> 8 N/A
-#> 9 No Additional Adaptation, Proactive Adaptation, Reactive Adaptation
-#> 10 Adaptation, No Additional Adaptation
+#> 3 With CO2 Fertilization, Without CO2 Fertilization
+#> 4 N/A
+#> 5 Median, Low Confidence Interval, High Confidence Interval
+#> 6 2011 Emissions, 2040 Emissions
+#> 7 N/A
+#> 8 No Additional Adaptation, Proactive Adaptation, Reactive Adaptation
+#> 9 Adaptation, No Additional Adaptation
+#> 10 N/A
+#> 11 N/A
#> 12 N/A
-#> 13 N/A
-#> 14 N/A
-#> 16 No Additional Adaptation, Proactive Adaptation, Reactive Adaptation
-#> 17 No Additional Adaptation, Proactive Adaptation, Reactive Adaptation
-#> 18 N/A
+#> 13 No Additional Adaptation, Proactive Adaptation, Reactive Adaptation
+#> 14 No Additional Adaptation, Proactive Adaptation, Reactive Adaptation
#> 15 N/A
+#> 16 N/A
+#> 17 N/A
+#> 18 N/A
#> 19 N/A
#> 20 N/A
#> 21 N/A
#> 22 N/A
#> 23 N/A
-#> 24 N/A
-#> 25 N/A
#> impactYears
-#> 3 N/A
-#> 2 N/A
-#> 4 N/A
-#> 5 N/A
-#> 6 N/A
-#> 1 N/A
-#> 8 N/A
-#> 9 N/A
-#> 10 2010, 2090
-#> 12 N/A
-#> 13 N/A
-#> 14 N/A
-#> 16 N/A
-#> 17 N/A
-#> 18 2010, 2090
-#> 15 N/A
-#> 19 N/A
-#> 20 N/A
-#> 21 N/A
-#> 22 N/A
-#> 23 N/A
-#> 24 N/A
-#> 25 2010, 2090
+#> 1 NA
+#> 2 NA
+#> 3 NA
+#> 4 NA
+#> 5 NA
+#> 6 NA
+#> 7 NA
+#> 8 NA
+#> 9 2010, 2090
+#> 10 NA
+#> 11 NA
+#> 12 NA
+#> 13 NA
+#> 14 NA
+#> 15 2010, 2090
+#> 16 NA
+#> 17 NA
+#> 18 NA
+#> 19 NA
+#> 20 NA
+#> 21 NA
+#> 22 NA
+#> 23 2010, 2090
#> impactTypes
-#> 3 N/A
+#> 1 N/A
#> 2 N/A
-#> 4 Cotton, Maize, Soybean, Wheat
-#> 5 Property, Violent
-#> 6 N/A
-#> 1 Ozone, PM2.5
+#> 3 Cotton, Maize, Soybean, Wheat
+#> 4 Property, Violent
+#> 5 N/A
+#> 6 Ozone, PM2.5
+#> 7 N/A
#> 8 N/A
-#> 9 N/A
-#> 10 Cold, Hot
+#> 9 Cold, Hot
+#> 10 N/A
+#> 11 N/A
#> 12 N/A
#> 13 N/A
#> 14 N/A
+#> 15 Acute Myocardial Infarction, All Cardiovascular, All Mortality, All Respiratory, Asthma ER
#> 16 N/A
#> 17 N/A
-#> 18 Acute Myocardial Infarction, All Cardiovascular, All Mortality, All Respiratory, Asthma ER
-#> 15 N/A
-#> 19 N/A
-#> 20 Lost Wages, Morbidity, Mortality
-#> 21 Direct Medical Cost, Lost Days, Mortality
+#> 18 Lost Wages, Morbidity, Mortality
+#> 19 Direct Medical Cost, Lost Days, Mortality
+#> 20 N/A
+#> 21 Morbidity, Mortality, Response Costs
#> 22 N/A
-#> 23 Morbidity, Mortality, Response Costs
-#> 24 N/A
-#> 25 Alpine Skiing, Cross-Country Skiing, Snowmobiling
+#> 23 Alpine Skiing, Cross-Country Skiing, Snowmobiling
### Return a character vector with only the names of the temperature-driven sectors:
get_sectorInfo(gcmOnly=T)
@@ -267,14 +267,12 @@ Examples
### Run FrEDI for only the temperature-driven sectors and view results:
df_x <- run_fredi(sectorList=get_sectorInfo(gcmOnly=T))
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from defaults...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -286,11 +284,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/get_sv_sectorInfo.html b/docs/reference/get_sv_sectorInfo.html
index 0f5fa8f1..a486c04e 100644
--- a/docs/reference/get_sv_sectorInfo.html
+++ b/docs/reference/get_sv_sectorInfo.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -168,11 +168,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/import_inputs.html b/docs/reference/import_inputs.html
index 79a35d77..7c5a1903 100644
--- a/docs/reference/import_inputs.html
+++ b/docs/reference/import_inputs.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -76,33 +76,29 @@
Usage
import_inputs(
- tempfile = NULL,
- slrfile = NULL,
- gdpfile = NULL,
- popfile = NULL,
+ inputsList = list(gdp = NULL, pop = NULL, temp = NULL, slr = NULL, ch4 = NULL, nox =
+ NULL, o3 = NULL),
temptype = "conus",
- popArea = "state"
+ popArea = "state",
+ module = "fredi"
)
Arguments
- - tempfile=NULL
-A character string indicating the location of a CSV file containing a custom temperature scenario. The first column in the CSV should be named "year"
and contain years associated with the temperature estimates; the second column (named "temp_C"
) should contain values for temperatures (i.e., degrees of warming relative to a baseline year of 1995), in degrees Celsius. The temperature scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
-
-
-- slrfile=NULL
-A character string indicating the location of a CSV file containing a custom sea level rise scenario. The first column in the CSV should be named "year"
and contain years associated with the sea level rise estimates; second column should be named "slr_cm"
and contain values for global mean sea level rise (GMSL), in centimeters, above a baseline year of 2000. The SLR scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
-
-
-- gdpfile=NULL
-A character string indicating the location of a CSV file containing a custom scenario for U.S. gross domestic product (GDP). The first column in the CSV should be named "year"
and contains years associated with the GDP estimates; the second column (named "gdp_usd"
) should contain values for U.S. GDP in 2015 U.S. dollars (2015$ USD). The GDP scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
). Values for GDP in column "gdp_usd"
must be greater than or equal to zero.
-
-
-- popfile=NULL
-A character string indicating the location of a CSV file containing a custom population scenario for states and NCA regions. The first column should be named "year"
and contain years in the interval 2010 to 2300. The second column should be called "pop"
and contain population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument (for more information, see the popArea
argument, below.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year. If popArea = "national"
, only the year
and pop
columns are required.
+ - inputsList=list(gdp=NULL, pop=NULL, temp=NULL, slr=NULL, ch4=NULL, nox=NULL)
+A named list containing file paths to CSV files containing scenarios:
gdp A character string indicating the location of a CSV file containing a custom scenario for U.S. gross domestic product (GDP), for use with run_fredi()
or run_fredi_methane()
. The first column in the CSV should be named "year"
and contains years associated with the GDP estimates; the second column (named "gdp_usd"
) should contain values for U.S. GDP in 2015 U.S. dollars (2015$ USD). The GDP scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
or run_fredi_methane()
). Values for GDP in column "gdp_usd"
must be greater than or equal to zero.
+pop A character string indicating the location of a CSV file containing a custom population scenario for states and NCA regions, for use with run_fredi()
, run_fredi_sv()
, or run_fredi_methane()
. The first column should be named "year"
and contain years in the interval 2010 to 2300. The second column should be called "pop"
and contain population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument (for more information, see the popArea
argument, below.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year. If popArea = "national"
, only the year
and pop
columns are required.
If popArea = "state"
, the file must contain estimates for all CONUS states -- i.e., all states except Alaska and Hawaii must be present in the input file (estimates for Alaska and Hawaii are optional). If popArea = "regional"
, the file must contain estimates for all seven NCA regions.
-The population scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
). Values for population in column "pop"
must be greater than or equal to zero.
+The population scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
or run_fredi_methane()
). Values for population in column "pop"
must be greater than or equal to zero.
+
+temp A character string indicating the location of a CSV file containing a custom temperature scenario, for use with run_fredi()
or run_fredi_sv()
. The first column in the CSV should be named "year"
and contain years associated with the temperature estimates; the second column (named "temp_C"
) should contain values for temperatures (i.e., degrees of warming relative to a baseline era of 1986-2005), in degrees Celsius. The temperature scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
+slr A character string indicating the location of a CSV file containing a custom sea level rise scenario, for use with run_fredi()
or run_fredi_sv()
. The first column in the CSV should be named "year"
and contain years associated with the sea level rise estimates; the second column should be named "slr_cm"
and contain values for global mean sea level rise (GMSL), in centimeters, above a baseline year of 2000. The SLR scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
+o3 A character string indicating the location of a CSV file containing a custom scenario for changes in U.S. state-level ozone concentrations (relative to a 1986-2005 baseline era). The input ozone scenario requires changes in annual state-level ozone concentrations, by GCM model, in parts per trillion by volume (pptv) relative to a 1986-2005 baseline era. In other words, the input ozone scenario requires ozone concentrations specific to the state, GCM model, and year of the analysis.
The o3
input requires a data frame object with six columns with names "region"
, "state"
, "postal"
, "model"
, "year"
, and "O3_pptv"
containing the region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively), the state name, the two-character postal code abbreviation for the state, the GCM model name ("CanESM2"
, "GFDL-CM3"
, "GISS-E2-R"
, "HadGEM2-ES"
, and/or "MIROC5"
), the year, and the change in ozone concentration (in pptv) relative to a 1986-2005 baseline era.
+Ozone inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by the maxYear
argument).
+
+ch4 A character string indicating the location of a CSV file containing a custom scenario for changes in U.S. methane concentrations (relative to a 1986-2005 baseline era), at the national level, for use with run_fredi_methane()
. The first column in the CSV should be named "year"
and contain years associated with the national methane estimates; the second column should be named "CH4_ppbv"
and contain values for methane. The methane scenario must start in 2020 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi_methane()
).
+nox A character string indicating the location of a CSV file containing a custom scenario for U.S. NOx emission values, at the national level. The first column in the CSV should be named "year"
and contain years associated with the national NOx estimates; the second column should be named "Mt"
and contain values for NOx emissions, in megatons per year (Mt). The NOx scenario must start in 2020 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi_methane()
).
@@ -121,29 +117,41 @@ Value
import_inputs()
returns a list of named elements containing data frames with custom scenarios for temperature, GMSL, GDP, and regional population, respectively:
-List Index Description tempInput
Data frame containing a custom temperature scenario imported from the CSV file specified by tempfile
, with missing values removed. tempInput
has two columns with names "year"
and "temp_C"
, containing the year and CONUS temperatures in degrees Celsius, respectively. slrInput
Data frame containing a custom GMSL scenario imported from the CSV file specified by slrfile
, with missing values removed. slrInput
has two columns with names "year"
, and "slr_cm"
, containing the year and global mean sea level rise (GMSL) in centimeters, respectively. gdpInput
Data frame containing a custom GDP scenario imported from the CSV file specified by gdpfile
, with missing values removed. gdpInput
has two columns with names "year"
, and "gdp_usd"
, containing the year and the national GDP, respectively. popInput
Data frame containing a custom temperature scenario imported from the CSV file specified by popfile
, with missing values removed. popInput
has three columns with names "year"
, "region"
, "state"
, "postal"
, and "state_pop"
, containing the year, the NCA region name, and the state, the postal code abbreviation (e.g., postal = "ME"
for state = "Maine"
), and the state population, respectively.
+List Index Description gdp
Data frame containing a custom GDP scenario imported from the CSV file specified by inputsList$gdp
, with missing values removed. gdp
has two columns with names "year"
, and "gdp_usd"
, containing the year and the national GDP, respectively. pop
Data frame containing a custom temperature scenario imported from the CSV file specified by inputsList$pop
, with missing values removed. popInput
has three columns with names "year"
, "region"
, "state"
, "postal"
, and "pop"
, containing the year, the NCA region name, and the state, the postal code abbreviation (e.g., postal = "ME"
for state = "Maine"
), and the state population, respectively. temp
Data frame containing a custom temperature scenario imported from the CSV file specified by inputsList$temp
, with missing values removed. temp
has two columns with names "year"
and "temp_C"
, containing the year and CONUS temperatures in degrees Celsius, respectively. slr
Data frame containing a custom GMSL scenario imported from the CSV file specified by inputsList$slr
, with missing values removed. slr
has two columns with names "year"
, and "slr_cm"
, containing the year and global mean sea level rise (GMSL) in centimeters, respectively. o3
Data frame containing a custom scenario with changes in ozone concentrations imported from the CSV file specified by inputsList$temp
, with missing values removed. o3
has six columns with names "region"
, "state"
, "postal"
, "model"
, "year"
, and "O3_pptv"
containing the region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively), the state name, the two-character postal code abbreviation for the state, the GCM model name ("CanESM2"
, "GFDL-CM3"
, "GISS-E2-R"
, "HadGEM2-ES"
, and/or "MIROC5"
), the year, and the change in ozone concentration (in pptv) relative to a 1986-2005 baseline era. ch4
Data frame containing a custom scenario with changes in methane concentrations imported from the CSV file specified by inputsList$slr
, with missing values removed. ch4
has two columns with names "year"
, and "CH4_ppbv"
, containing the year and Change in U.S. methane concentrations, in parts per billion by volume (ppbv) relative to a 1995-2006 baseline era, respectively. nox
Data frame containing a custom NOx emissions scenario imported from the CSV file specified by inputsList$nox
, with missing values removed. nox
has two columns with names "year"
and "NOx_Mt"
, containing the year and U.S. national-level NOx emissions (in Mt), respectively.
Details
- This function enables users to import data on custom scenarios for use with temperature binning. Users specify path names to CSV files containing temperature, global mean sea level rise (GMSL), population, and gross domestic product (GDP) scenarios (tempfile
, slrfile
, gdpfile
, and popfile
, respectively). import_inputs()
reads in and formats any specified files as data frames and returns a list of data frames for imported scenarios.
-The CSV files should contain estimates aligned with the requirements of the run_fredi()
or ``
Temperature Scenario. The file specified by tempfile
must have two columns -- "year"
and "temp_C"
-- respectively containing the years associated with the temperature estimates and the temperatures (i.e., degrees of warming) in degrees Celsius relative to a baseline year of 1995 (i.e., the central year of a 1986-2005 reference period).
If values in "temp_C"
have global rather than CONUS-specific temperatures, users should specify temptype = "global"
when running import_inputs()
, and import_inputs()
will convert the temperatures to CONUS using convertTemps (with argument from = "global"
).
-Temperature inputs to run_fredi()
must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-
-SLR Scenario. The file specified by slrfile
must have two columns -- "year"
and "slr_cm"
-- respectively containing the years associated with the GMSL estimates and GMSL estimates, in centimeters, above a 2000 baseline year.
GMSL heights must be greater than or equal to zero.
-The SLR scenario must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-
-GDP Scenario. The file specified by gdpfile
must have two columns -- "year"
and "gdp_usd"
-- respectively containing the years associated with the GDP estimates and the estimates for U.S. GDP, in 2015$.
GDP values must be greater than or equal to zero.
+ This function enables users to import data on custom scenarios for use with temperature binning. Users provide a named list specifying path names to CSV files containing scenarios for gross domestic product (GDP) (for use with run_fredi()
or run_fredi_methane()
); population (for use with run_fredi()
, run_fredi_sv()
, or run_fredi_methane()
); temperature and/or global mean sea level rise (GMSL) (for use with run_fredi()
or run_fredi_sv()
); or methane or NOx (for use with run_fredi_methane()
). import_inputs()
reads in and formats any specified files as data frames and returns a list of data frames for imported scenarios.
+The CSV files should contain estimates aligned with the requirements of the run_fredi()
or ``
GDP Scenario. The file specified by inputsList$gdp
must have two columns -- "year"
and "gdp_usd"
-- respectively containing the years associated with the GDP estimates and the estimates for U.S. GDP, in 2015$.
GDP values must be greater than or equal to zero.
The GDP scenario must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-Population Scenario. The file specified by popfile
population must have at least two columns -- "year"
and "pop"
-- respectively containing the years associated with the population estimates and the population estimates. requires state-level population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year. If popArea = "national"
, only the year
and pop
columns are required.
+Population Scenario. The file specified by inputsList$pop
population must have at least two columns -- "year"
and "pop"
-- respectively containing the years associated with the population estimates and the population estimates. requires state-level population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year (one of "Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively). If popArea = "national"
, only the year
and pop
columns are required.
If popArea = "state"
, the file must contain estimates for all CONUS states -- i.e., all states except Alaska and Hawaii must be present in the input file (estimates for Alaska and Hawaii are optional). If popArea = "regional"
, the file must contain estimates for all seven NCA regions.
The population scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
Population values must be greater than or equal to zero.
Population estimates must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-
run_fredi()
requires a population scenario at the state level. If the population scenario is supplied to import_inputs()
at a geographical scale above the state level (i.e., if popArea = "national"
, popArea = "area"
, or popArea = "regional"
), import_inputs()
will calculate state-level estimates from the provided data:
If popArea = "national"
, import_inputs()
will use historical U.S. Census data for the period 2010--2023 to allocate total national population to CONUS and non-CONUS regions (i.e., Alaska and Hawaii); U.S. Census values from 2023 are applied in allocations for years after 2023. import_inputs()
then uses ICLUS data and projections for the period 2010--2100 to allocate CONUS population to specific NCA regions; ICLUS values from 2100 are applied in allocations for years after 2100.
+Temperature Scenario. The file specified by inputsList$temp
must have two columns -- "year"
and "temp_C"
-- respectively containing the years associated with the temperature estimates and the temperatures (i.e., degrees of warming) in degrees Celsius relative to a baseline year of 1995 (i.e., the central year of a 1986-2005 reference period).
If values in "temp_C"
have global rather than CONUS-specific temperatures, users should specify temptype = "global"
when running import_inputs()
, and import_inputs()
will convert the temperatures to CONUS using convertTemps (with argument from = "global"
).
+Temperature inputs to run_fredi()
must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
+
+SLR Scenario. The file specified by inputsList$slr
must have two columns -- "year"
and "slr_cm"
-- respectively containing the years associated with the GMSL estimates and GMSL estimates, in centimeters, above a 2000 baseline year.
GMSL heights must be greater than or equal to zero.
+The SLR scenario must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
+
+Ozone Scenario. The input ozone scenario requires changes in annual state-level ozone concentrations, by GCM model, in parts per trillion by volume (pptv) relative to a 1986-2005 baseline era. In other words, the input ozone scenario requires ozone concentrations specific to the state, GCM model, and year of the analysis.
o3
requires a data frame object with six columns with names "region"
, "state"
, "postal"
, "model"
, "year"
, and "O3_pptv"
containing the region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively), the state name, the two-character postal code abbreviation for the state, the GCM model name ("CanESM2"
, "GFDL-CM3"
, "GISS-E2-R"
, "HadGEM2-ES"
, and/or "MIROC5"
), the year, and the change in ozone concentration (in pptv) relative to a 1986-2005 baseline era.
+Ozone inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+If inputs are specified for ozone and methane or NOx (i.e., !is.null(inputsList$o3) & (!is.null(inputsList$ch4) | !is.null(inputsList$nox))
), run_fredi_methane()
will use the ozone scenario in preference of the methane and NOx scenario.
+
+Methane Scenario. The input methane scenario requires changes in annual methane concentrations, at the national level, in parts per billion by volume (ppbv) relative to a 1986-2005 baseline era.
ch4
requires a data frame object with two columns with names "year"
and "CH4_ppbv"
containing the year and the change in methane concentration (in ppbv) relative to a 1986-2005 baseline era.
+Methane inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+run_fredi_methane()
will override a user-supplied methane scenario with a user-supplied ozone scenario; in other words, run_fredi_methane()
will use the ozone scenario in preference of the methane and NOx scenario.
+
+NOx Scenario. The input NOx scenario requires annual NOx emissions in the US, at the national level, in Megatons (MT) relative to a 1986-2005 baseline.
nox
requires a data frame object with two columns with names "year"
and "NOx_Mt"
containing the year and the change in NOx concentration (in Mt) relative to a 1986-2005 baseline era.
+NOx inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+run_fredi_methane()
will override a user-supplied methane scenario with a user-supplied ozone scenario; in other words, run_fredi_methane()
will use the ozone scenario in preference of the methane and NOx scenario.
+
+
run_fredi()
, run_fredi_sv()
, and run_fredi_methane()
each require a population scenario at the state level. If the population scenario is supplied to import_inputs()
at a geographical scale above the state level (i.e., if popArea = "national"
, popArea = "area"
, or popArea = "regional"
), import_inputs()
will calculate state-level estimates from the provided data:
If popArea = "national"
, import_inputs()
will use historical U.S. Census data for the period 2010--2023 to allocate total national population to CONUS and non-CONUS regions (i.e., Alaska and Hawaii); U.S. Census values from 2023 are applied in allocations for years after 2023. import_inputs()
then uses ICLUS data and projections for the period 2010--2100 to allocate CONUS population to specific NCA regions; ICLUS values from 2100 are applied in allocations for years after 2100.
If popArea = "national"
or popArea = "regional"
, import_inputs()
uses ICLUS data and projections for the period 2010--2100 to allocate population for each NCA region to the associated states; ICLUS values from 2100 are applied in allocations for years after 2100.
import_inputs()
outputs a list of data frame objects that can be passed to the main FREDI function run_fredi()
using the inputList
argument. For example, specify run_fredi(inputsList = x)
to generate impacts for a custom scenario x
(where x
is a list of data frames such as that output from import_inputs()
) (see run_fredi()
).
-All inputs to import_inputs()
are optional. If the user does not specify a file path for tempfile
, slrfile
, gdpfile
, or popfile
(or if there is are any errors reading in inputs from a file path), import_inputs()
outputs a list with a NULL
value for the associated list element. After reading in data from the specified CSV files, import_inputs()
performs basic checks and will also return a NULL
value for a particular list element if any of the checks fail.
+All inputs to import_inputs()
are optional. If the user does not specify particular named elements (or if there is are any errors reading in inputs from a file path), import_inputs()
outputs a list with a NULL
value for the associated list element. After reading in data from the specified CSV files, import_inputs()
performs basic checks and will also return a NULL
value for a particular list element if any of the checks fail.
When using import_inputs()
with run_fredi()
, run_fredi()
defaults back to the default scenarios for any elements of the inputs list that are NULL
or missing. In other words, running run_fredi(inputsList = list())
returns the same outputs as running run_fredi()
(see run_fredi()
).
@@ -162,8 +170,8 @@ Examples
### View example scenario names
scenariosPath |> list.files()
-#> [1] "GCAM_scenario.csv" "State ICLUS Population.csv"
-#> [3] "slr_from_GCAM.csv"
+#> [1] "gcamDefault.csv" "gcamScenarios.csv" "gdpDefault.csv"
+#> [4] "popDefault.csv"
### SLR Scenario File Name
slrInputFile <- scenariosPath |> file.path("slr_from_gcam.csv")
@@ -172,40 +180,28 @@ ExamplespopInputFile <- scenariosPath |> file.path("State ICLUS Population.csv")
### Import inputs
-example_inputsList <- import_inputs(slrfile=slrInputFile, popfile=popInputFile, popArea="state")
+example_inputsList <- import_inputs(inputsList=list(slr=slrInputFile, pop=popInputFile), popArea="state")
#>
#> In import_inputs():
#> Loading data...
#> User specified slrfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/slr_from_gcam.csv...
-#> Data loaded.
+#> File does not exist! Returning a null data frame for slr input.
#> User specified popfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/State ICLUS Population.csv...
-#> Data loaded.
+#> File does not exist! Returning a null data frame for pop input.
#>
#> Checking input values...
#>
-#> Checking input values for slr inputs...
-#> Values passed.
-#>
-#> Checking input values for pop inputs...
-#> Column "pop" not found in popfile data!
-#> Looking for columns with matches to the string "pop"...1 match found!
-#> Using column "state_pop", and renaming to "state_pop"...
-#> Values passed.
-#>
#> Finished.
### Use imports with FREDI:
df_x <- run_fredi(inputsList=example_inputsList)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from user inputs...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from user inputs...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -216,11 +212,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/index.html b/docs/reference/index.html
index d9dfde11..08aa75d4 100644
--- a/docs/reference/index.html
+++ b/docs/reference/index.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.1
+ 4.2.0
@@ -82,7 +82,7 @@ All functionsaggregate_impacts()
- Summarize and aggregate impacts from run_fredi()
(calculate national totals, average across models, sum impact types, and interpolate between impact year estimates)
+ Summarize and aggregate impacts from run_fredi()
(calculate national totals, average across models, sum impact types, and interpolate between impact year estimates)
-
convertTemps()
@@ -90,14 +90,14 @@ All functionsdefaultResults
+ gcamScenarios
- - Default outputs of
run_fredi()
A dataframe containing the default outputs of run_fredi()
+ - Six driver scenarios that can be passed as inputs to
run_fredi()
and run_fredi_sv()
-
-
gcamScenarios
+ gdpDefault
- - Six driver scenarios that can be passed as inputs to
run_fredi()
and run_fredi_sv()
+ - Scenario with values for U.S. Gross Domestic Product (GDP), which can be passed as an input to
run_fredi()
or run_fredi_methane()
.
-
get_sectorInfo()
@@ -107,7 +107,7 @@ All functionsget_sv_sectorInfo()
- - Retrieve a character vector of sectors available in the FrEDI Social Vulnerability (SV) module (run_fredi_sv) or a data frame with SV sectors and additional information.
+ - Retrieve a character vector of sectors available in the FrEDI Social Vulnerability (SV) module (run_fredi_sv) or a data frame with SV sectors and additional information.
-
import_inputs()
@@ -115,9 +115,9 @@ All functionspopScenario
+ popDefault
- - Population scenario to use as an input to
run_fredi()
and run_fredi_sv()
+ - U.S. state population scenario, which can be passed as an input to
run_fredi()
, run_fredi_sv()
, and/or FrEDI:run_fredi_methane()
.
-
run_fredi()
@@ -125,6 +125,11 @@ All functionsrun_fredi_methane()
+
+ - Project annual average impacts from methane, NOx, and ozone.
+
-
+
run_fredi_sv()
- Calculate climate change impacts on socially vulnerable (SV) populations throughout the 21st century for available sectors
diff --git a/docs/reference/popScenario.html b/docs/reference/popScenario.html
deleted file mode 100644
index cad31b4a..00000000
--- a/docs/reference/popScenario.html
+++ /dev/null
@@ -1,131 +0,0 @@
-
-Population scenario to use as an input to run_fredi() and run_fredi_sv() — popScenario • FrEDI
- Skip to contents
-
-
-
-
-
- Population scenario to use as an input to run_fredi()
and run_fredi_sv()
- Source: R/data.R
- popScenario.Rd
-
-
-
- A dataframe containing a population scenario to be passed as an input to run_fredi()
and run_fredi_sv()
.
-
-
-
-
-
- Format
- A data frame with 14,259 rows and 5 columns:
- year
-Year
-
-- region
-Region of U.S. ("Midwest", "Northeast", "Northern Plains", "Northwest", "Southeast", "Southern Plains", and "Southwest")
-
-- state
-One of 48 contiguous U.S. states or the District of Columbia
-
-- postal
-Postal code abbreviation associated with the state
-
-- state_pop
-State population for associated region and year
-
-
-
-
-
- Details
- This dataframe contains population projections at the state level from the Integrated Climate and Land Use Scenarios version 2 (ICLUSv2) model (Bierwagen et al, 2010; EPA 2017) under the Median variant projection of United Nations (2015).
-Bierwagen, B., D. M. Theobald, C. R. Pyke, A. Choate, P. Groth, J. V. Thomas, and P. Morefield. 2010. “National housing and impervious surface scenarios for integrated climate impact assessments.” Proc. Natl. Acad. Sci. 107 (49): 20887–20892. https://doi.org/10.1073/pnas.1002096107.
-EPA. 2017. Multi-Model Framework for Quantitative Sectoral Impacts Analysis: A technical report for the Fourth National Climate Assessment. U.S. Environmental Protection Agency, EPA 430-R-17-001.
-United Nations. 2015. World population prospects: The 2015 revision. New York: United Nations, Department of Economic and Social Affairs, Population Division.
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/reference/run_fredi.html b/docs/reference/run_fredi.html
index 09824b88..c5388b5f 100644
--- a/docs/reference/run_fredi.html
+++ b/docs/reference/run_fredi.html
@@ -12,7 +12,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -79,7 +79,7 @@
Usage
run_fredi(
- inputsList = list(tempInput = NULL, slrInput = NULL, gdpInput = NULL, popInput = NULL),
+ inputsList = list(temp = NULL, slr = NULL, gdp = NULL, pop = NULL),
sectorList = NULL,
aggLevels = c("national", "modelaverage", "impactyear", "impacttype"),
elasticity = 1,
@@ -93,8 +93,8 @@ Usage
Arguments
- - inputsList=NULL
-A list of named elements named elements (names(inputsList) = c("tempInput", "slrInput", "gdpInput", "popInput")
), each containing data frames of custom temperature, global mean sea level rise (GMSL), gross domestic product (GDP), and/or state-level population trajectories, respectively, over a continuous period in the range 2010 to 2300. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population and GDP scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
+ - inputsList=list(gdp=NULL, pop=NULL, temp=NULL, slr=NULL)
+A list with named elements (gdp
, pop
, temp
, and/or slr
), each containing data frames of custom scenarios for gross domestic product (GDP), state-level population, temperature, and/or global mean sea level rise (GMSL) trajectories, respectively, over a continuous period. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population and GDP scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
- sectorList=NULL
@@ -144,40 +144,40 @@ Value
Details
This function allows users to project annual average climate change impacts through 2300 (2010-2300) for available sectors. run_fredi()
is the main function in the FrEDI R package, described elsewhere (See https://epa.gov/cira/FrEDI for more information).
-Users can specify an optional list of custom scenarios with inputsList
(for more information on the format of inputs, see import_inputs()
). The function import_inputs()
can be used to importing custom scenarios from CSV files. import_inputs()
returns a list with elements tempInput
, slrInput
, gdpInput
, and popInput
, with each containing a data frame with a custom scenario for temperature, GMSL, GDP, and state-level population, respectively. If a user imports scenarios using import_inputs()
, they can pass the outputs of import_inputs()
directly to the run_fredi()
argument inputsList
. Note that the documentation for import_inputs()
can also provide additional guidance and specification on the formats for each scenario type.
-If inputsList = NULL
, run_fredi()
uses defaults for temperature, SLR, GDP, and population. Otherwise, run_fredi()
looks for a list object passed to the argument inputsList
. Within that list, run_fredi()
looks for list elements tempInput
, slrInput
, gdpInput
, and popInput
containing data frames with custom scenarios for temperature, GMSL, GDP, and state population, respectively. run_fredi()
will default back to the default scenarios for any list elements that empty or NULL
(in other words, running run_fredi(inputsList = list())
returns the same outputs as running run_fredi()
).
Temperature Inputs. The input temperature scenario requires CONUS temperatures in degrees Celsius relative to 1995 (degrees of warming relative to the baseline year--i.e., the central year of the 1986-2005 baseline). CONUS temperature values must be greater than or equal to zero degrees Celsius.
Users can convert global temperatures to CONUS temperatures using convertTemps(from = "global")
(or by specifying import_inputs(temptype = "global")
when using import_inputs()
to import a temperature scenario from a CSV file).
-tempInput
requires a data frame object with two columns with names "year"
, and "temp_C"
containing the year and CONUS temperatures in degrees Celsius, respectively.
-Temperature inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for temperature (i.e., inputsList = list(tempInput = NULL)
, run_fredi()
uses a default temperature scenario.
-
-SLR Inputs. The input SLR scenario requires values for changes in global mean sea level rise (GMSL) heights in centimeters (cm). GMSL heights must be greater than or equal to zero.
slrInput
requires a data frame object with two columns with names "year"
, "slr_cm"
containing the year and global mean sea level rise (GMSL) in centimeters, respectively.
-SLR inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for SLR (i.e., inputsList = list(slrInput = NULL)
, run_fredi()
first converts the input or default CONUS temperature scenario to global temperatures (using convertTemps()
) and then converts the global temperatures to a global mean sea level rise (GMSL) height in centimeters (using temps2slr()
).
-
-GDP Inputs. The input scenario for gross domestic product (GDP) requires national GDP values in 2015$. GDP values must be greater than or equal to zero.
gdpInput
requires a data frame object with two columns with names "year"
, and "gdp_usd"
containing the year and the national GDP, respectively. GDP values must be greater than or equal to zero.
+Users can specify an optional list of custom scenarios with inputsList
(for more information on the format of inputs, see import_inputs()
). The function import_inputs()
can be used to importing custom scenarios from CSV files. import_inputs()
returns a list with named elements gdp
, pop
, temp
, and slr
, with each containing a data frame with a custom scenario for GDP, state-level population, temperature, and/or GMSL respectively. If a user imports scenarios using import_inputs()
, they can pass the outputs of import_inputs()
directly to the run_fredi()
argument inputsList
. Note that the documentation for import_inputs()
can also provide additional guidance and specification on the formats for each scenario type.
+Otherwise, run_fredi()
looks for a list object passed to the argument inputsList
. Within that list, run_fredi()
looks for named list elements -- gdp
, pop
, temp
, and/or slr
-- each containing a data frame with a custom scenario for GDP, state population, temperature, and/or GMSL, respectively. If inputsList = NULL
or inputsList = list()
(default), run_fredi()
uses default trajectories for GDP, population, temperature, and SLR (see gdpDefault, popDefault, and gcamScenarios for more information). run_fredi()
will default back to the default scenarios for any list elements that empty or NULL
(in other words, running run_fredi(inputsList = list())
returns the same outputs as running run_fredi()
).
GDP Inputs. The input scenario for gross domestic product (GDP) requires national GDP values in 2015$. GDP values must be greater than or equal to zero.
gdp
requires a data frame object with two columns with names "year"
, and "gdp_usd"
containing the year and the national GDP, respectively. GDP values must be greater than or equal to zero.
GDP inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for GDP (i.e., inputsList = list(gdpInput = NULL)
, run_fredi()
uses a default GDP scenario.
+If the user does not specify an input scenario for GDP (i.e., inputsList = list(gdp = NULL)
, run_fredi()
uses a default GDP scenario.
-Population Inputs. The input population scenario requires state-level population values. Population values must be greater than or equal to zero.
popInput
requires a data frame object with five columns with names "region"
, "state"
, "postal"
, "year"
, and "state"
containing the year, the NCA region name, the state name, the postal code abbreviation for the state, and the state population, respectively.
+Population Inputs. The input population scenario requires state-level population values. Population values must be greater than or equal to zero.
pop
requires a data frame object with five columns with names "region"
, "state"
, "postal"
, "year"
, and "pop"
containing the year, the NCA region name (one of "Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
), the state name, the postal code abbreviation for the state, and the state population, respectively.
Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for population (i.e., inputsList = list(popInput = NULL)
, run_fredi()
uses a default population scenario.
+If the user does not specify an input scenario for population (i.e., inputsList = list(pop = NULL)
, run_fredi()
uses a default population scenario.
+
+Temperature Inputs. The input temperature scenario requires CONUS temperatures in degrees Celsius relative to 1995 (degrees of warming relative to the baseline year--i.e., the central year of the 1986-2005 baseline). CONUS temperature values must be greater than or equal to zero degrees Celsius.
Users can convert global temperatures to CONUS temperatures using convertTemps(from = "global")
(or by specifying import_inputs(temptype = "global")
when using import_inputs()
to import a temperature scenario from a CSV file).
+temp
requires a data frame object with two columns with names "year"
, and "temp_C"
containing the year and CONUS temperatures in degrees Celsius, respectively.
+Temperature inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+If the user does not specify an input scenario for temperature (i.e., inputsList = list(temp = NULL)
, run_fredi()
uses a default temperature scenario.
+
+SLR Inputs. The input SLR scenario requires values for changes in global mean sea level rise (GMSL) heights in centimeters (cm). GMSL heights must be greater than or equal to zero.
slr
requires a data frame object with two columns with names "year"
, "slr_cm"
containing the year and global mean sea level rise (GMSL) in centimeters, respectively.
+SLR inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+If the user does not specify an input scenario for SLR (i.e., inputsList = list(slr = NULL)
, run_fredi()
first converts the input or default CONUS temperature scenario to global temperatures (using convertTemps()
) and then converts the global temperatures to a global mean sea level rise (GMSL) height in centimeters (using temps2slr()
).
-
run_fredi()
linearly interpolates missing annual values for all input scenarios using non-missing values (each scenario requires at least two non-missing values as detailed above for each scenario type). After interpolation of the input scenarios, run_fredi()
subsets the input scenarios to values within the analysis period.
Temperatures are interpolated using 1995 as the baseline year (i.e., the central year of the 1986-2005 baseline) and GMSL is interpolated using 2000 as the baseline year. In other words, temperature (in degrees Celsius) is set to zero for the year 1995, whereas GMSL is set to zero for the year 2000. The interpolated temperature and GMSL scenarios are combined into a column called driverValue
, along with additional columns for year, the driver unit (column "driverUnit"
, with driverUnit = "degrees Celsius"
and driverUnit = "cm"
for temperature- and SLR-driven sectors, respectively), and the associated model type (column "model_type"
, with model_type = "GCM"
and model_type = "SLR"
for temperature- and SLR-driven sectors, respectively
-run_fredi()
calculations national population from state-level values and then calculates GDP per capita from values for GDP and national population. Values for state population, national population, national GDP (in 2015$), and national per capita GDP (in 2015$/capita) are provided in the results data frame in columns "state_pop"
, "national_pop"
, "gdp_usd"
, and "gdp_percap"
, respectively.
+
run_fredi()
linearly interpolates missing annual values for all input scenarios using non-missing values (each scenario requires at least two non-missing values as detailed above for each scenario type). After interpolation of the input scenarios, run_fredi()
subsets the input scenarios to values within the analysis period.
Temperatures are interpolated using 1995 as the baseline year (i.e., the central year of the 1986-2005 baseline) and GMSL is interpolated using 2000 as the baseline year. In other words, temperature (in degrees Celsius) is set to zero for the year 1995, whereas GMSL is set to zero for the year 2000. The interpolated temperature and GMSL scenarios are combined into a column called driverValue
, along with additional columns for year, the driver unit (column "driverUnit"
, with driverUnit = "degrees Celsius"
and driverUnit = "cm"
for temperature- and SLR-driven sectors, respectively), and the associated model type (column "model_type"
, with model_type = "GCM"
and model_type = "SLR"
for temperature- and SLR-driven sectors, respectively.
+run_fredi()
calculates national population from state-level values and then calculates GDP per capita from values for GDP and national population. Values for state population, national population, national GDP (in 2015$), and national per capita GDP (in 2015$/capita) are provided in the results data frame in columns "pop"
, "national_pop"
, "gdp_usd"
, and "gdp_percap"
, respectively.
By default, run_fredi()
will calculate impacts for all sectors included in the tool. Alternatively, users can pass a character vector specifying a single sector or a subset of sectors using the sectorList
argument. To see a list of sectors included within FrEDI, run get_sectorInfo()
. If sectorList = NULL
(default), all sectors are included.
By default, run_fredi()
calculates impacts starting in the year 2010 and ending in 2100. Specify an alternative end year for the analysis using the maxYear
argument. maxYear
has a default value of 2100
and minimum and maximum values of 2011
and 2300
, respectively. Alternatively, users can set argument thru2300 = TRUE
to override the maxYear
argument and set maxYear = 2300
. Note that the default scenarios included within FrEDI stop in the year 2100; users must provide custom input scenarios out to the desired end year and specify a maxYear >= 2100
(and maxYear <= 2300
) in order to return non-missing values for years after 2100.
Annual impacts for each sector, variant, impact type, and impact year combination included in the model are calculated by multiplying scaled climate impacts by a physical scalar and economic scalars and multipliers. Some sectors use Value of a Statistical Life (VSL) to adjust the value non-linearly over time. run_fredi()
uses a default value of elasticity = 1
to adjust VSL for applicable sectors and impacts (the default value of elasticity = 1
keeps VSL constant over time). A custom elasticity can be passed to the elasticity
argument. Applicable sectors and impacts are *Climate-Driven Changes in Air Quality (all impact types), ATS Temperature-Related Mortality (impactType = "N/A"
; i.e., all impact types), CIL Temperature-Related Mortality, Extreme Temperature (all impact types), Suicide (impactType = "N/A"
; i.e., all impact types), Southwest Dust (impactType = "All Mortality"
), Valley Fever (impactType = "Mortality"
), Vibriosis (impactType = "N/A"
; i.e., all impact types), and Wildfire (impactType = "Mortality"
).
run_fredi()
aggregates or summarizes results to level(s) of aggregation specified by the user (passed to aggLevels
) using the post-processing helper function aggregate_impacts()
. Users can specify all aggregation levels at once by specifying aggLevels = "all"
(default) or no aggregation levels (aggLevels = "none"
). Users can specify a single aggregation level or multiple aggregation levels by passing a single character string or character vector to aggLevels
. Options for aggregation include calculating national totals (aggLevels = "national"
), averaging across model types and models (aggLevels = "modelaverage"
), summing over all impact types (aggLevels = "impacttype"
), and interpolating between impact year estimates (aggLevels = "impactYear"
).
-If the user specifies aggLevels = "none"
, run_fredi()
returns a data frame with columns: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, "state_pop"
, "year"
, "physical_impacts"
, and "annual_impacts"
.
Columns "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, and "model"
all contain observation identifiers (sector name, variant, impact type, impact year, region, state, state postal code abbreviation, model type, and model, respectively).
+If the user specifies aggLevels = "none"
, run_fredi()
returns a data frame with columns: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, "pop"
, "year"
, "physical_impacts"
, and "annual_impacts"
.
Columns "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, and "model"
all contain observation identifiers (sector name, variant, impact type, impact year, region, state, state postal code abbreviation, model type, and model, respectively).
Columns "sectorprimary"
and "includeaggregate"
contain values that provide information about how to treat sectors and when aggregating over sectors (e.g., summing impacts across sectors). Note that FrEDI does not currently provide functionality to aggregate over sectors; this information is provided for user convenience.
Column "sectorprimary"
contains values indicating which variant to use as the primary one for each sector: sectorprimary = 1
for primary variants and sectorprimary = 0
for non-primary variants. When aggregating impacts over sectors, users should filter the outputs of run_fredi()
to variants with sectorprimary == 1
.
Column "includeaggregate"
contains values that provide information about how to treat sectors when aggregating over sectors (e.g., summing impacts across sectors). Sectors that have a value of includeaggregate == 0
should be dropped when aggregating results over sectors, to avoid potential double-counting of impacts for similar sectors. For instance, sectors ATS Temperature-Related Mortality, CIL Temperature-Related Mortality, and Extreme Temperature have values for temperature-related mortality. To avoid double counting, outputs of run_fredi()
should be filtered to values for which includeaggregate > 0
. Sectors with a value of includeaggregate > 0
can be included when aggregating over sectors; most sectors with a value of includeaggregate > 0
will have a value of includeaggregate = 1
. Values of includeaggregate > 1
flag additional information about sectors; currently, only the Suicide sector has a value of includeaggregate > 1
, with a value of includeaggregate = 2
. This flag indicates that the impacts from Suicide can be included when summing values across sectors, but may have some overlap with impacts from ATS Temperature-Related Mortality. For more information about the potential overlap between impacts for ATS Temperature-Related Mortality and Suicide, visit the technical documentation at https://epa.gov/cira/FrEDI/,
Columns "driverType"
, "driverUnit"
, and "driverValue"
contain information about the temperature and SLR scenarios.
-Columns "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "state_pop"
contain information about the GDP and population scenarios.
+Columns "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "pop"
contain information about the GDP and population scenarios.
Columns "physicalmeasure"
and "physical_impacts"
contain information about physical impacts.
Column "annual_impacts"
contains information on the economic value associated with annual impacts.
If the user specifies aggLevels = "all"
or other combinations of aggregation levels, run_fredi()
passes the results data frame and the aggLevels
argument to the aggregate_impacts()
function. aggregate_impacts()
then performs the following calculations, using the default grouping columns for the aggregate_impacts()
: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, and "year"
(note that the "variant"
column referred to below contains information about the variant name (or “N/A”
), as applicable).
-Aggregation Level Description impactyear
To aggregate over impact years, aggregate_impacts()
first separates results for sectors with only one impact year estimate (i.e., impactYear = "N/A"
) from from observations with multiple impact year estimates (i.e., sectors with results for both impactYear = "2010"
and impactYear = "2090"
). For these sectors with multiple impact years, physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
) are linearly interpolated between impact year estimates. For any model run years above 2090, annual results for sectors with multiple impact years return the 2090 estimate. The interpolated values are then row-bound to the results for sectors with a single impact year estimate, and column impactYear
set to impactYear = "Interpolation"
for all values. If "impactyear"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
aggregates over impact years before performing other types of aggregation. modelaverage
To aggregate over models for temperature-driven sectors, aggregate_impacts()
averages physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all GCM models present in the data. aggregate_impacts()
drops the column "model"
from the grouping columns when averaging over models. Averages exclude observations with missing values. However, If all values within a grouping are missing, the model average is set to NA
. The values in column "model"
are set to "Average"
for model averages and the model averages data frame is then row-bound to the main results data frame. For SLR-driven sectors, there is no need for additional model aggregation; these values already have model = "Interpolation"
. If "modelaverage"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years (if "impactyear"
present in aggLevels
or if aggLevels = "all"
) before aggregating over models. national
To aggregate values to the national level, aggregate_impacts()
sums physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all states present in the data. aggregate_impacts()
drops the columns "region"
, "state"
, and "postal"
when summing over states and regions. Years which have missing column data for all regions return as NA
. Values for columns "region"
, "state"
, and "postal"
are set to "National Total"
, All
, and US
, respectively. The data frame with national totals is then row-bound to the main results data frame. If "national"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years and/or models (if "impactyear"
and/or "modelaverage"
are present in aggLevels
or if aggLevels = "all"
) before aggregating over models. impacttype
To aggregate values over impact types, aggregate_impacts()
sums annual impacts (column "annual_impacts"
) across all impact types for each sector. aggregate_impacts()
drops the column "impactType"
and "physicalmeasure"
from the grouping columns when summing over impact types. Years which have missing column data for all impact types return as NA
. All values in column "impactType"
are set to "all"
. Aggregating over impact types, drops columns related to physical impacts (i.e., columns "physicalmeasure"
and "physical_impacts"
). These columns are dropped since aggregating over impact types for some sectors requires summing costs over different types of physical impacts, so reporting the physical impacts would be nonsensical.
After aggregating values, aggregate_impacts()
joins the data frame of impacts with information about "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "state_pop"
.
+Aggregation Level Description impactyear
To aggregate over impact years, aggregate_impacts()
first separates results for sectors with only one impact year estimate (i.e., impactYear = "N/A"
) from from observations with multiple impact year estimates (i.e., sectors with results for both impactYear = "2010"
and impactYear = "2090"
). For these sectors with multiple impact years, physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
) are linearly interpolated between impact year estimates. For any model run years above 2090, annual results for sectors with multiple impact years return the 2090 estimate. The interpolated values are then row-bound to the results for sectors with a single impact year estimate, and column impactYear
set to impactYear = "Interpolation"
for all values. If "impactyear"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
aggregates over impact years before performing other types of aggregation. modelaverage
To aggregate over models for temperature-driven sectors, aggregate_impacts()
averages physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all GCM models present in the data. aggregate_impacts()
drops the column "model"
from the grouping columns when averaging over models. Averages exclude observations with missing values. However, If all values within a grouping are missing, the model average is set to NA
. The values in column "model"
are set to "Average"
for model averages and the model averages data frame is then row-bound to the main results data frame. For SLR-driven sectors, there is no need for additional model aggregation; these values already have model = "Interpolation"
. If "modelaverage"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years (if "impactyear"
present in aggLevels
or if aggLevels = "all"
) before aggregating over models. national
To aggregate values to the national level, aggregate_impacts()
sums physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all states present in the data. aggregate_impacts()
drops the columns "region"
, "state"
, and "postal"
when summing over states and regions. Years which have missing column data for all regions return as NA
. Values for columns "region"
, "state"
, and "postal"
are set to "National Total"
, All
, and US
, respectively. The data frame with national totals is then row-bound to the main results data frame. If "national"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years and/or models (if "impactyear"
and/or "modelaverage"
are present in aggLevels
or if aggLevels = "all"
) before aggregating over models. impacttype
To aggregate values over impact types, aggregate_impacts()
sums annual impacts (column "annual_impacts"
) across all impact types for each sector. aggregate_impacts()
drops the column "impactType"
and "physicalmeasure"
from the grouping columns when summing over impact types. Years which have missing column data for all impact types return as NA
. All values in column "impactType"
are set to "all"
. Aggregating over impact types, drops columns related to physical impacts (i.e., columns "physicalmeasure"
and "physical_impacts"
). These columns are dropped since aggregating over impact types for some sectors requires summing costs over different types of physical impacts, so reporting the physical impacts would be nonsensical.
After aggregating values, aggregate_impacts()
joins the data frame of impacts with information about "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "pop"
.
If outputList = FALSE
(default), run_fredi()
returns a data frame of annual average impacts over the analysis period, for each sector, variant, impact type, impact year, region, state, model type ("GCM"
or "SLR"
), and model. If outputList = TRUE
, in addition to the data frame of impacts, run_fredi()
returns a list object containing information about values for function arguments, driver scenarios, and population and GDP scenarios.
@@ -190,16 +190,15 @@ Examples### Load FrEDI
require(FrEDI)
-### Run function with defaults (same as `defaultResults` dataset)
+### Run function with defaults
run1 <- run_fredi()
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from defaults...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -207,62 +206,71 @@ Examplesdata("gcamScenarios")
gcamScenarios |> glimpse()
#> Rows: 606
-#> Columns: 4
-#> $ year <int> 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2…
-#> $ temp_C <dbl> 0.1269649, 0.1575513, 0.1858310, 0.2101611, 0.2306551, 0.2444…
-#> $ slr_cm <dbl> 0.0000000, 0.2727356, 0.5552278, 0.8458496, 1.1430287, 1.4440…
-#> $ scenario <chr> "Hector_GCAM_v5.3_ECS_3.0_REF", "Hector_GCAM_v5.3_ECS_3.0_REF…
+#> Columns: 6
+#> $ year <int> 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20…
+#> $ temp_C_conus <dbl> 0.1804171, 0.2238804, 0.2640659, 0.2986389, 0.3277609, 0…
+#> $ temp_C_global <dbl> 0.1269649, 0.1575513, 0.1858310, 0.2101611, 0.2306551, 0…
+#> $ slr_cm <dbl> 0.0000000, 0.2727356, 0.5552278, 0.8458496, 1.1430287, 1…
+#> $ scenario <chr> "ECS_3.0_REF", "ECS_3.0_REF", "ECS_3.0_REF", "ECS_3.0_RE…
+#> $ model <chr> "Hector_GCAM_v5.3", "Hector_GCAM_v5.3", "Hector_GCAM_v5.…
### Load population scenario and glimpse data
-data(popScenario)
-popScenario |> glimpse()
+data("popDefault")
+popDefault |> glimpse()
#> Rows: 14,259
#> Columns: 5
-#> $ year <dbl> 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, …
#> $ region <chr> "Southeast", "Southeast", "Southeast", "Southeast", "Southea…
#> $ state <chr> "Alabama", "Alabama", "Alabama", "Alabama", "Alabama", "Alab…
#> $ postal <chr> "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", …
+#> $ year <int> 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, …
#> $ state_pop <dbl> 4779736, 4823623, 4867509, 4911396, 4955282, 4999169, 503604…
### Subset climate scenario
-temps1 <- gcamScenarios |> filter(scenario=="Hector_GCAM_v5.3_ECS_3.0_ref")
-temps1 <- temps1 |> mutate(temp_C = temp_C_global |> convertTemps(from="global"))
-#> Error in mutate(temps1, temp_C = convertTemps(temp_C_global, from = "global")): ℹ In argument: `temp_C = convertTemps(temp_C_global, from = "global")`.
-#> Caused by error:
-#> ! object 'temp_C_global' not found
-temps1 <- temps1 |> select(year, temp_C)
+temps1 <- gcamScenarios |> filter(scenario=="ECS_3.0_ref")
+temps1 <- temps1 |> select(year, temp_C_conus)
### Run custom scenario
-run2 <- run_fredi(inputsList=list(tempInput=temps1, popInput=popScenario))
-#> Checking input values...
-#> Creating temperature scenario from user inputs...
-#> Error in map(regions0, function(region_i) { df_i <- filter(data, region == region_i) x_i <- df_i[["year"]] y_i <- df_i[[column0]] new_i <- approx(x = x_i, y = y_i, xout = years, rule = rule, method = method) new_i <- as_tibble(new_i) new_i <- rename_at(new_i, c(cols0), ~cols1) new_i <- mutate(new_i, region = region_i) return(new_i)}): ℹ In index: 1.
-#> Caused by error in `approx()`:
-#> ! need at least two non-NA values to interpolate
+run2 <- run_fredi(inputsList=list(temp=temps1, pop=popDefault))
+#> Checking scenarios...
+#>
+#> Checking input values for pop inputs...
+#> Column "pop" not found in popfile data!
+#> Looking for columns with matches to the string "pop"...1 match found!
+#> Using column "", and renaming to "pop"...
+#> Data is missing the following required columns: state_pop!
+#> Dropping pop inputs from outputs.
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
+#>
+#> Finished.
### Load scenarios from file:
scenariosPath <- system.file(package="FrEDI") |> file.path("extdata","scenarios")
scenariosPath |> list.files()
-#> [1] "GCAM_scenario.csv" "State ICLUS Population.csv"
-#> [3] "slr_from_GCAM.csv"
+#> [1] "gcamDefault.csv" "gcamScenarios.csv" "gdpDefault.csv"
+#> [4] "popDefault.csv"
### SLR Scenario File Name
-slrInputFile <- scenariosPath |> file.path("slr_from_GCAM.csv")
+slrInputFile <- scenariosPath |> file.path("gcamDefault.csv")
### Population Scenario File Name
-popInputFile <- scenariosPath |> file.path("State ICLUS Population.csv")
+popInputFile <- scenariosPath |> file.path("popDefault.csv")
### Import inputs
-x_inputs <- import_inputs(slrfile=slrInputFile, popfile=popInputFile, popArea="state")
+x_inputs <- import_inputs(inputsList=list(slr=slrInputFile, pop=popInputFile), popArea="state")
#>
#> In import_inputs():
#> Loading data...
#> User specified slrfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/slr_from_GCAM.csv...
+#> Importing data from C:/Users/knoiva/AppData/Local/R/win-library/4.4/FrEDI/extdata/scenarios/gcamDefault.csv...
#> Data loaded.
#> User specified popfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/State ICLUS Population.csv...
+#> Importing data from C:/Users/knoiva/AppData/Local/R/win-library/4.4/FrEDI/extdata/scenarios/popDefault.csv...
#> Data loaded.
#>
#> Checking input values...
@@ -271,23 +279,37 @@ Examples#> Values passed.
#>
#> Checking input values for pop inputs...
-#> Column "pop" not found in popfile data!
-#> Looking for columns with matches to the string "pop"...1 match found!
-#> Using column "state_pop", and renaming to "state_pop"...
+#> Checking that all states, etc. are present...
+#>
+#> Checking inputs for unique regions, states...
+#> All regions present...
+#> All states present...
#> Values passed.
#>
#> Finished.
### Run custom scenarios
run3 <- run_fredi(inputsList=x_inputs)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
+#> Checking scenarios...
+#>
+#> Checking input values for slr inputs...
+#> Values passed.
+#>
+#> Checking input values for pop inputs...
+#> Checking that all states, etc. are present...
+#>
+#> Checking inputs for unique regions, states...
+#> All regions present...
+#> All states present...
+#> Values passed.
#> Creating SLR scenario from user inputs...
-#> No GDP scenario provided...Using default GDP scenario...
#> Creating population scenario from user inputs...
-#> Updating scalars...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -321,32 +343,37 @@ Examples
### Run for a single sector, with default inputs, no aggregation, and elasticity=1:
run4 <- run_fredi(sectorList="ATS Temperature-Related Mortality", aggLevels="none", elasticity=1)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from defaults...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
#> Formatting results...
#>
#> Finished.
### Set end year for analysis to 2110 -- messages user and returns a null value since default scenarios only have values out to 2100
run5 <- run_fredi(maxYear=2110)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Temperature scenario must have at least one non-missing value in or after the year 2110...
+#> Checking scenarios...
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
#>
-#> Exiting...
+#> Finished.
### Set end year for analysis to 2300 -- messages user and returns a null value since default scenarios only have values out to 2100)
run6 <- run_fredi(thru2300=TRUE)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Temperature scenario must have at least one non-missing value in or after the year 2300...
+#> Checking scenarios...
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
#>
-#> Exiting...
+#> Finished.
@@ -358,11 +385,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/run_fredi_sv.html b/docs/reference/run_fredi_sv.html
index 082f5c36..f234cad7 100644
--- a/docs/reference/run_fredi_sv.html
+++ b/docs/reference/run_fredi_sv.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -77,8 +77,7 @@
Usage
run_fredi_sv(
sector = NULL,
- driverInput = NULL,
- popInput = NULL,
+ inputsList = list(pop = NULL, temp = NULL, slr = NULL),
silent = TRUE,
.testing = FALSE
)
@@ -90,22 +89,22 @@ Argumentsget_sv_sectorInfo() for a list of available sectors).
-- driverInput
-A data frame of up to four custom scenarios for drivers (temperature or global mean sea level rise). driverInput
requires a data frame with columns of "year"
and "scenario"
. The data frame must also include a third column: "temp_C"
for temperature-driven sectors (containing temperature values in degrees Celsius of warming for the contiguous U.S.) or "slr_cm"
for sea level rise (SLR)-driven sectors (containing values for global mean sea level rise in centimeters). Run get_sv_sectorInfo(gcmOnly=TRUE)
to see temperature-driven sectors in the SV module and get_sv_sectorInfo(slrOnly=TRUE)
to see SLR-driven scenarios. Users can also pass a data frame with all four columns ("year"
, "scenario"
, "temp_C"
, and "slr_cm"
), in which case run_fredi_sv()
determines whether to use the "temp_C"
or "slr_cm"
column as the driver trajectory based on the specified sector. Driver inputs for all scenarios should start in the year 2000 or earlier. All scenarios must include at least two non-missing values (especially values before or at 2000 and at or after 2100). If any required columns are missing, run_fredi_sv()
will use the default temperature or sea level rise scenario from run_fredi()
. If the data frame passed to driverInput
has more than four unique scenarios, run_fredi_sv()
will only run the first four scenarios.
+- silent
+A logical (TRUE/FALSE
) value indicating the level of messaging desired by the user (defaults to silent=TRUE
)
-- popInput
-The input population scenario requires a data frame object with a single scenario of state-level population values.
The population scenario must have five columns with names "year"
, "region"
, "state"
, "postal"
, and "state_pop"
containing the year, the NCA region name, the state name, the postal code abbreviation (e.g., "ME" for "Maine") for the state, and the state population, respectively.
-popInput
only accepts a a single scenario, in contrast to driverInput
. In other words, run_fredi_sv()
uses the same population scenario for any and all driver scenarios passed to driverInput
.
-If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario.
+- inputsList=list(pop=NULL, temp=NULL, slr=NULL)
+A list with named elements (pop
, temp
, and/or slr
), each containing data frames of custom scenarios for state-level population, temperature, and/or global mean sea level rise (GMSL) trajectories, respectively, over a continuous period. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
pop. The input population scenario requires a data frame object with a single scenario of population values for each of the 48 U.S. states and the District of Columbia comprising the contiguous U.S. (CONUS).
The population scenario must have five columns with names "region"
, "state"
, "postal"
, "year"
, and "_pop"
containing the NCA region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
), the state name, the two-letter postal code abbreviation for the state (e.g., "ME"
for Maine), the year, and the state population, respectively.
+The input population scenario can only contain a single scenario, in contrast to values for temperature or SLR inputs. In other words, run_fredi_sv()
uses the same population scenario when running any and all of the temperature or SLR scenarios passed to run_fredi_sv()
.
+If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario (see documentation for popScenario).
Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (2100).
Population values must be greater than or equal to zero.
+
+temp or slr. The input temperature or SLR scenario should be a data frame containing one or more custom scenarios. These inputs should be formulated similarly to those for run_fredi()
and import_inputs()
, with an additional column (scenario
) indicating the unique scenario identifier. Temperature and/or SLR input scenarios must have at least one non-missing value in the year 2000 or earlier and at least one non-missing value in or after the final analysis year (2100).
temp. Temperature inputs are used by run_fredi_sv()
with temperature-driven sectors; run get_sv_sectorInfo(gcmOnly=TRUE)
to get a list of the temperature-driven sectors available for the SV module. Temperature inputs require a data frame with columns of year
, temp_C
, and scenario
, respectively containing the year associated with an observation, temperature values for CONUS in degrees Celsius of warming relative to a 1995 baseline (where 1995 is the central year of a 1986-2005 baseline period -- i.e., values should start at zero in the year 1995), and a unique scenario identifier. If no temperature scenario is specified (i.e., inputsList$temp
is NULL
) when running a temperature-driven sector, run_fredi_sv()
will use a default temperature scenario (see FrEDI:gcamScenarios).
+slr. SLR inputs are used by run_fredi_sv()
with sea level rise-driven sectors; run get_sv_sectorInfo(slrOnly=TRUE)
to get a list of the SLR-driven sectors available for the SV module. SLR inputs require a data frame with columns of year
, slr_cm
, and scenario
, respectively containing the global mean sea level rise in centimeters relative to a 2000 baseline (i.e., values should start at zero in the year 2000), and a unique scenario identifier. If no SLR scenario is specified (i.e., inputsList$slr
is NULL
) when running a temperature-driven sector: if a user has supplied a temperature scenario (i.e., inputsList$temp
is not NULL
), run_fredi_sv()
will calculate sea level rise values from the temperature inputs using the temps2slr()
function; if no temperature scenario is provided, run_fredi_sv
will use a default SLR scenario (see FrEDI:gcamScenarios).
+
-
-- silent
-A logical (TRUE/FALSE
) value indicating the level of messaging desired by the user (defaults to silent=TRUE
).
-
Value
@@ -117,17 +116,8 @@ Value
Details
run_fredi_sv()
projects annual climate change impacts for socially vulnerable (SV) populations throughout the 21st century (2010-2100) for available sectors, using default or user-specified population, temperature, and sea level rise (SLR) trajectories. run_fredi_sv()
is the main function for the FrEDI Social Vulnerability (SV) module in the FrEDI R package, described elsewhere (See https://epa.gov/cira/FrEDI for more information). The SV module extends the FrEDI framework to socially vulnerable populations using data underlying a 2021 U.S. Environmental Protection Agency (EPA) report on Climate Change and Social Vulnerability in the United States.
Users can run run_fredi_sv()
to generate annual physical impacts for SV groups for individual sectors. When running run_fredi_sv()
, users must specify one of the sectors in the SV module; use get_sv_sectorInfo()
for a list of available sectors.
-run_fredi_sv()
can be run with default population and climate (temperature and SLR) trajectories or use run_fredi_sv()
to run custom scenarios. Running run_fredi_sv()
with custom climate scenarios requires passing a data frame of scenarios to the driverInput
argument. run_fredi_sv()
can also be run with a custom population scenario by passing a data frame of regional population trajectories to the popInput
argument; unlike climate scenarios, run_fredi_sv()
will only run a single scenario at a time.
driverInput
can take a data frame containing up to four custom scenarios for drivers (temperature or global mean sea level rise). driverInput
requires a data frame with columns of "year"
and "scenario"
. The data frame must also include a third column: "temp_C"
for temperature-driven sectors (containing temperature values in degrees Celsius of warming for the contiguous U.S.) or "slr_cm"
for sea level rise (SLR)-driven sectors (containing values for global mean sea level rise in centimeters). Run get_sv_sectorInfo(gcmOnly = TRUE)
to see temperature-driven sectors in the SV module and get_sv_sectorInfo(slrOnly = TRUE)
to see SLR-driven scenarios. Users can also pass a data frame with all four columns ("year"
, "scenario"
, "temp_C"
, and "slr_cm"
), in which case run_fredi_sv()
determines whether to use the "temp_C"
or "slr_cm"
column as the driver trajectory based on the specified sector. If any required columns are missing, run_fredi_sv()
will use the default temperature or sea level rise scenario from run_fredi()
. If the data frame passed to driverInput
has more than four unique scenarios, run_fredi_sv()
will only run the first four scenarios.
Temperature inputs must be temperature change in degrees Celsius for the contiguous U.S. (use convertTemps()
to convert global temperatures to CONUS temperatures before passing to driverInput
) relative to a 1995 baseline (where 1995 is the central year of a 1986-2005 baseline period; values should start at zero in the year 1995).
-Sea level rise inputs must be in centimeters relative to a 2000 baseline (i.e., values should start at zero in the year 2000). Driver inputs for all scenarios should start in the year 2000 or earlier. All scenarios must include at least two non-missing values (especially values before or at 2000 and at or after 2100).
-
-The input population scenario requires a data frame object with a single scenario of state-level population values.
The population scenario must have five columns with names "year"
, "region"
, "state"
, "postal"
, and "state_pop"
containing the year, the NCA region name, the state name, the postal code abbreviation (e.g., "ME" for "Maine") for the state, and the state population, respectively.
-popInput
only accepts a a single scenario, in contrast to driverInput
. In other words, run_fredi_sv()
uses the same population scenario for any and all driver scenarios passed to driverInput
.
-If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario.
-Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (2100).
-Population values must be greater than or equal to zero.
-The default regional population scenario is drawn from the Integrated Climate and Land Use Scenarios version 2 (ICLUSv2) model (Bierwagen et al, 2010; EPA 2017) under the Median variant projection of United Nations (United Nations, 2015). Note that the FrEDI SV default population scenario differs from the default population scenario used by run_fredi()
.
-
-
The output of run_fredi_sv()
is an R data frame object containing average annual physical impacts for socially vulnerable groups, at the NCA region level and five-year increments.
+run_fredi_sv()
can be run with default population and climate (temperature and SLR) trajectories or use run_fredi_sv()
to run custom scenarios. Running run_fredi_sv()
with custom climate scenarios requires passing a data frame of scenarios to the driverInput
argument. run_fredi_sv()
can also be run with a custom population scenario by passing a data frame of regional population trajectories to the popInput
argument; unlike climate scenarios, run_fredi_sv()
will only run a single scenario at a time.
+The output of run_fredi_sv()
is an R data frame object containing average annual physical impacts for socially vulnerable groups, at the NCA region level and five-year increments.
References
@@ -141,163 +131,18 @@ References
Examples
- ### Run SV Module with defaults without specifying sector
-df_sv <- run_fredi_sv()
-#> [1] "Please select a sector: "
-#> [1] "1. Air Quality - Childhood Asthma"
-#> [1] "2. Air Quality - Premature Mortality"
-#> [1] "3. Labor"
-#> [1] "4. Extreme Temperature"
-#> [1] "5. Roads"
-#> [1] "6. Transportation Impacts from High Tide Flooding"
-#> [1] "7. Coastal Properties"
-#> Warning: type 29 is unimplemented in 'type2char'
-#> Error in readline(prompt = sector_msg3): INTEGER() can only be applied to a 'integer', not a 'unknown type #29'
-
-### Return a character vector with the names of all of the sectors in the FrEDI SV Module:
-get_sv_sectorInfo()
-#> [1] "Air Quality - Childhood Asthma"
-#> [2] "Air Quality - Premature Mortality"
-#> [3] "Coastal Properties"
-#> [4] "Extreme Temperature"
-#> [5] "Labor"
-#> [6] "Roads"
-#> [7] "Transportation Impacts from High Tide Flooding"
-
-### Return a data frame of all of the sectors in the FrEDI SV Module (sector names and additional information)
-get_sv_sectorInfo(description=T)
-#> sector modelType driverUnit
-#> 1 Air Quality - Childhood Asthma GCM degrees Celsius
-#> 2 Air Quality - Premature Mortality GCM degrees Celsius
-#> 3 Coastal Properties SLR cm
-#> 4 Extreme Temperature GCM degrees Celsius
-#> 5 Labor GCM degrees Celsius
-#> 6 Roads GCM degrees Celsius
-#> 7 Transportation Impacts from High Tide Flooding SLR cm
-#> impactUnit
-#> 1 Childhood asthma cases
-#> 2 Premature Mortality
-#> 3 Individuals threatened with total property loss
-#> 4 Mortality
-#> 5 Hours of labor lost
-#> 6 Hours of delay
-#> 7 Hours of delay
-#> variants
-#> 1 N/A
-#> 2 N/A
-#> 3 Without Adaptation, With Adaptation
-#> 4 N/A
-#> 5 N/A
-#> 6 No Adaptation, Proactive Adaptation
-#> 7 Without Adaptation, With Adaptation
-
-### Run SV Module with defaults for "Coastal Properties" without saving
-df_sv <- run_fredi_sv(sector="Coastal Properties")
-#> Running FrEDI SV for sector 'Coastal Properties':
-#>
-#> Preparing driver scenario...
-#> Using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#>
-#> Preparing population scenario...
-#> Using default population scenario...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Coastal Properties", variant="Without Adaptation", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#>
-#> Calculating impacts for sector="Coastal Properties", variant="With Adaptation", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-### Run SV Module with defaults for "Extreme Temperature" without saving
-df_sv <- run_fredi_sv(sector="Extreme Temperature")
-#> Running FrEDI SV for sector 'Extreme Temperature':
-#>
-#> Preparing driver scenario...
-#> Using default temperature scenario...
-#>
-#> Preparing population scenario...
-#> Using default population scenario...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-### Load temperature scenarios
-load(gcamScenarios)
-#> Error in load(gcamScenarios): bad 'file' argument
-
-### Load population scenario
-load(popScenario)
-#> Error in load(popScenario): bad 'file' argument
-
-### Run SV Module for "Extreme Temperature" with custom population and temperature scenarios
-df_sv <- run_fredi_sv(sector = "Extreme Temperature", driverInput = gcamScenarios, popInput = popScenario)
-#> Running FrEDI SV for sector 'Extreme Temperature':
-#> Checking `driverInput` values...
-#> Checking scenarios in `driverInput`...
-#> Warning: `driverInput` has more than four distinct scenarios!
-#> Only the first four scenarios will be used...
-#> Checking `driverInput` values for temperature scenario...
-#> All temperature scenario columns present...
-#> Checking `popInput` values...
-#> All population scenario columns present in `popInput`...
-#>
-#> Preparing driver scenario...
-#> Using temperature scenario from user inputs...
-#>
-#> Preparing population scenario...
-#> Creating population scenario from user inputs...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_20"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_30"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_50"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-
+
Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/get_sv_sectorInfo.html b/docs/reference/get_sv_sectorInfo.html
index 0f5fa8f1..a486c04e 100644
--- a/docs/reference/get_sv_sectorInfo.html
+++ b/docs/reference/get_sv_sectorInfo.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -168,11 +168,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/import_inputs.html b/docs/reference/import_inputs.html
index 79a35d77..7c5a1903 100644
--- a/docs/reference/import_inputs.html
+++ b/docs/reference/import_inputs.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -76,33 +76,29 @@
Usage
import_inputs(
- tempfile = NULL,
- slrfile = NULL,
- gdpfile = NULL,
- popfile = NULL,
+ inputsList = list(gdp = NULL, pop = NULL, temp = NULL, slr = NULL, ch4 = NULL, nox =
+ NULL, o3 = NULL),
temptype = "conus",
- popArea = "state"
+ popArea = "state",
+ module = "fredi"
)
Arguments
- - tempfile=NULL
-A character string indicating the location of a CSV file containing a custom temperature scenario. The first column in the CSV should be named "year"
and contain years associated with the temperature estimates; the second column (named "temp_C"
) should contain values for temperatures (i.e., degrees of warming relative to a baseline year of 1995), in degrees Celsius. The temperature scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
-
-
-- slrfile=NULL
-A character string indicating the location of a CSV file containing a custom sea level rise scenario. The first column in the CSV should be named "year"
and contain years associated with the sea level rise estimates; second column should be named "slr_cm"
and contain values for global mean sea level rise (GMSL), in centimeters, above a baseline year of 2000. The SLR scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
-
-
-- gdpfile=NULL
-A character string indicating the location of a CSV file containing a custom scenario for U.S. gross domestic product (GDP). The first column in the CSV should be named "year"
and contains years associated with the GDP estimates; the second column (named "gdp_usd"
) should contain values for U.S. GDP in 2015 U.S. dollars (2015$ USD). The GDP scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
). Values for GDP in column "gdp_usd"
must be greater than or equal to zero.
-
-
-- popfile=NULL
-A character string indicating the location of a CSV file containing a custom population scenario for states and NCA regions. The first column should be named "year"
and contain years in the interval 2010 to 2300. The second column should be called "pop"
and contain population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument (for more information, see the popArea
argument, below.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year. If popArea = "national"
, only the year
and pop
columns are required.
+ - inputsList=list(gdp=NULL, pop=NULL, temp=NULL, slr=NULL, ch4=NULL, nox=NULL)
+A named list containing file paths to CSV files containing scenarios:
gdp A character string indicating the location of a CSV file containing a custom scenario for U.S. gross domestic product (GDP), for use with run_fredi()
or run_fredi_methane()
. The first column in the CSV should be named "year"
and contains years associated with the GDP estimates; the second column (named "gdp_usd"
) should contain values for U.S. GDP in 2015 U.S. dollars (2015$ USD). The GDP scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
or run_fredi_methane()
). Values for GDP in column "gdp_usd"
must be greater than or equal to zero.
+pop A character string indicating the location of a CSV file containing a custom population scenario for states and NCA regions, for use with run_fredi()
, run_fredi_sv()
, or run_fredi_methane()
. The first column should be named "year"
and contain years in the interval 2010 to 2300. The second column should be called "pop"
and contain population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument (for more information, see the popArea
argument, below.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year. If popArea = "national"
, only the year
and pop
columns are required.
If popArea = "state"
, the file must contain estimates for all CONUS states -- i.e., all states except Alaska and Hawaii must be present in the input file (estimates for Alaska and Hawaii are optional). If popArea = "regional"
, the file must contain estimates for all seven NCA regions.
-The population scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
). Values for population in column "pop"
must be greater than or equal to zero.
+The population scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
or run_fredi_methane()
). Values for population in column "pop"
must be greater than or equal to zero.
+
+temp A character string indicating the location of a CSV file containing a custom temperature scenario, for use with run_fredi()
or run_fredi_sv()
. The first column in the CSV should be named "year"
and contain years associated with the temperature estimates; the second column (named "temp_C"
) should contain values for temperatures (i.e., degrees of warming relative to a baseline era of 1986-2005), in degrees Celsius. The temperature scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
+slr A character string indicating the location of a CSV file containing a custom sea level rise scenario, for use with run_fredi()
or run_fredi_sv()
. The first column in the CSV should be named "year"
and contain years associated with the sea level rise estimates; the second column should be named "slr_cm"
and contain values for global mean sea level rise (GMSL), in centimeters, above a baseline year of 2000. The SLR scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
+o3 A character string indicating the location of a CSV file containing a custom scenario for changes in U.S. state-level ozone concentrations (relative to a 1986-2005 baseline era). The input ozone scenario requires changes in annual state-level ozone concentrations, by GCM model, in parts per trillion by volume (pptv) relative to a 1986-2005 baseline era. In other words, the input ozone scenario requires ozone concentrations specific to the state, GCM model, and year of the analysis.
The o3
input requires a data frame object with six columns with names "region"
, "state"
, "postal"
, "model"
, "year"
, and "O3_pptv"
containing the region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively), the state name, the two-character postal code abbreviation for the state, the GCM model name ("CanESM2"
, "GFDL-CM3"
, "GISS-E2-R"
, "HadGEM2-ES"
, and/or "MIROC5"
), the year, and the change in ozone concentration (in pptv) relative to a 1986-2005 baseline era.
+Ozone inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by the maxYear
argument).
+
+ch4 A character string indicating the location of a CSV file containing a custom scenario for changes in U.S. methane concentrations (relative to a 1986-2005 baseline era), at the national level, for use with run_fredi_methane()
. The first column in the CSV should be named "year"
and contain years associated with the national methane estimates; the second column should be named "CH4_ppbv"
and contain values for methane. The methane scenario must start in 2020 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi_methane()
).
+nox A character string indicating the location of a CSV file containing a custom scenario for U.S. NOx emission values, at the national level. The first column in the CSV should be named "year"
and contain years associated with the national NOx estimates; the second column should be named "Mt"
and contain values for NOx emissions, in megatons per year (Mt). The NOx scenario must start in 2020 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi_methane()
).
@@ -121,29 +117,41 @@ Value
import_inputs()
returns a list of named elements containing data frames with custom scenarios for temperature, GMSL, GDP, and regional population, respectively:
-List Index Description tempInput
Data frame containing a custom temperature scenario imported from the CSV file specified by tempfile
, with missing values removed. tempInput
has two columns with names "year"
and "temp_C"
, containing the year and CONUS temperatures in degrees Celsius, respectively. slrInput
Data frame containing a custom GMSL scenario imported from the CSV file specified by slrfile
, with missing values removed. slrInput
has two columns with names "year"
, and "slr_cm"
, containing the year and global mean sea level rise (GMSL) in centimeters, respectively. gdpInput
Data frame containing a custom GDP scenario imported from the CSV file specified by gdpfile
, with missing values removed. gdpInput
has two columns with names "year"
, and "gdp_usd"
, containing the year and the national GDP, respectively. popInput
Data frame containing a custom temperature scenario imported from the CSV file specified by popfile
, with missing values removed. popInput
has three columns with names "year"
, "region"
, "state"
, "postal"
, and "state_pop"
, containing the year, the NCA region name, and the state, the postal code abbreviation (e.g., postal = "ME"
for state = "Maine"
), and the state population, respectively.
+List Index Description gdp
Data frame containing a custom GDP scenario imported from the CSV file specified by inputsList$gdp
, with missing values removed. gdp
has two columns with names "year"
, and "gdp_usd"
, containing the year and the national GDP, respectively. pop
Data frame containing a custom temperature scenario imported from the CSV file specified by inputsList$pop
, with missing values removed. popInput
has three columns with names "year"
, "region"
, "state"
, "postal"
, and "pop"
, containing the year, the NCA region name, and the state, the postal code abbreviation (e.g., postal = "ME"
for state = "Maine"
), and the state population, respectively. temp
Data frame containing a custom temperature scenario imported from the CSV file specified by inputsList$temp
, with missing values removed. temp
has two columns with names "year"
and "temp_C"
, containing the year and CONUS temperatures in degrees Celsius, respectively. slr
Data frame containing a custom GMSL scenario imported from the CSV file specified by inputsList$slr
, with missing values removed. slr
has two columns with names "year"
, and "slr_cm"
, containing the year and global mean sea level rise (GMSL) in centimeters, respectively. o3
Data frame containing a custom scenario with changes in ozone concentrations imported from the CSV file specified by inputsList$temp
, with missing values removed. o3
has six columns with names "region"
, "state"
, "postal"
, "model"
, "year"
, and "O3_pptv"
containing the region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively), the state name, the two-character postal code abbreviation for the state, the GCM model name ("CanESM2"
, "GFDL-CM3"
, "GISS-E2-R"
, "HadGEM2-ES"
, and/or "MIROC5"
), the year, and the change in ozone concentration (in pptv) relative to a 1986-2005 baseline era. ch4
Data frame containing a custom scenario with changes in methane concentrations imported from the CSV file specified by inputsList$slr
, with missing values removed. ch4
has two columns with names "year"
, and "CH4_ppbv"
, containing the year and Change in U.S. methane concentrations, in parts per billion by volume (ppbv) relative to a 1995-2006 baseline era, respectively. nox
Data frame containing a custom NOx emissions scenario imported from the CSV file specified by inputsList$nox
, with missing values removed. nox
has two columns with names "year"
and "NOx_Mt"
, containing the year and U.S. national-level NOx emissions (in Mt), respectively.
Details
- This function enables users to import data on custom scenarios for use with temperature binning. Users specify path names to CSV files containing temperature, global mean sea level rise (GMSL), population, and gross domestic product (GDP) scenarios (tempfile
, slrfile
, gdpfile
, and popfile
, respectively). import_inputs()
reads in and formats any specified files as data frames and returns a list of data frames for imported scenarios.
-The CSV files should contain estimates aligned with the requirements of the run_fredi()
or ``
Temperature Scenario. The file specified by tempfile
must have two columns -- "year"
and "temp_C"
-- respectively containing the years associated with the temperature estimates and the temperatures (i.e., degrees of warming) in degrees Celsius relative to a baseline year of 1995 (i.e., the central year of a 1986-2005 reference period).
If values in "temp_C"
have global rather than CONUS-specific temperatures, users should specify temptype = "global"
when running import_inputs()
, and import_inputs()
will convert the temperatures to CONUS using convertTemps (with argument from = "global"
).
-Temperature inputs to run_fredi()
must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-
-SLR Scenario. The file specified by slrfile
must have two columns -- "year"
and "slr_cm"
-- respectively containing the years associated with the GMSL estimates and GMSL estimates, in centimeters, above a 2000 baseline year.
GMSL heights must be greater than or equal to zero.
-The SLR scenario must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-
-GDP Scenario. The file specified by gdpfile
must have two columns -- "year"
and "gdp_usd"
-- respectively containing the years associated with the GDP estimates and the estimates for U.S. GDP, in 2015$.
GDP values must be greater than or equal to zero.
+ This function enables users to import data on custom scenarios for use with temperature binning. Users provide a named list specifying path names to CSV files containing scenarios for gross domestic product (GDP) (for use with run_fredi()
or run_fredi_methane()
); population (for use with run_fredi()
, run_fredi_sv()
, or run_fredi_methane()
); temperature and/or global mean sea level rise (GMSL) (for use with run_fredi()
or run_fredi_sv()
); or methane or NOx (for use with run_fredi_methane()
). import_inputs()
reads in and formats any specified files as data frames and returns a list of data frames for imported scenarios.
+The CSV files should contain estimates aligned with the requirements of the run_fredi()
or ``
GDP Scenario. The file specified by inputsList$gdp
must have two columns -- "year"
and "gdp_usd"
-- respectively containing the years associated with the GDP estimates and the estimates for U.S. GDP, in 2015$.
GDP values must be greater than or equal to zero.
The GDP scenario must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-Population Scenario. The file specified by popfile
population must have at least two columns -- "year"
and "pop"
-- respectively containing the years associated with the population estimates and the population estimates. requires state-level population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year. If popArea = "national"
, only the year
and pop
columns are required.
+Population Scenario. The file specified by inputsList$pop
population must have at least two columns -- "year"
and "pop"
-- respectively containing the years associated with the population estimates and the population estimates. requires state-level population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year (one of "Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively). If popArea = "national"
, only the year
and pop
columns are required.
If popArea = "state"
, the file must contain estimates for all CONUS states -- i.e., all states except Alaska and Hawaii must be present in the input file (estimates for Alaska and Hawaii are optional). If popArea = "regional"
, the file must contain estimates for all seven NCA regions.
The population scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
Population values must be greater than or equal to zero.
Population estimates must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-
run_fredi()
requires a population scenario at the state level. If the population scenario is supplied to import_inputs()
at a geographical scale above the state level (i.e., if popArea = "national"
, popArea = "area"
, or popArea = "regional"
), import_inputs()
will calculate state-level estimates from the provided data:
If popArea = "national"
, import_inputs()
will use historical U.S. Census data for the period 2010--2023 to allocate total national population to CONUS and non-CONUS regions (i.e., Alaska and Hawaii); U.S. Census values from 2023 are applied in allocations for years after 2023. import_inputs()
then uses ICLUS data and projections for the period 2010--2100 to allocate CONUS population to specific NCA regions; ICLUS values from 2100 are applied in allocations for years after 2100.
+Temperature Scenario. The file specified by inputsList$temp
must have two columns -- "year"
and "temp_C"
-- respectively containing the years associated with the temperature estimates and the temperatures (i.e., degrees of warming) in degrees Celsius relative to a baseline year of 1995 (i.e., the central year of a 1986-2005 reference period).
If values in "temp_C"
have global rather than CONUS-specific temperatures, users should specify temptype = "global"
when running import_inputs()
, and import_inputs()
will convert the temperatures to CONUS using convertTemps (with argument from = "global"
).
+Temperature inputs to run_fredi()
must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
+
+SLR Scenario. The file specified by inputsList$slr
must have two columns -- "year"
and "slr_cm"
-- respectively containing the years associated with the GMSL estimates and GMSL estimates, in centimeters, above a 2000 baseline year.
GMSL heights must be greater than or equal to zero.
+The SLR scenario must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
+
+Ozone Scenario. The input ozone scenario requires changes in annual state-level ozone concentrations, by GCM model, in parts per trillion by volume (pptv) relative to a 1986-2005 baseline era. In other words, the input ozone scenario requires ozone concentrations specific to the state, GCM model, and year of the analysis.
o3
requires a data frame object with six columns with names "region"
, "state"
, "postal"
, "model"
, "year"
, and "O3_pptv"
containing the region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively), the state name, the two-character postal code abbreviation for the state, the GCM model name ("CanESM2"
, "GFDL-CM3"
, "GISS-E2-R"
, "HadGEM2-ES"
, and/or "MIROC5"
), the year, and the change in ozone concentration (in pptv) relative to a 1986-2005 baseline era.
+Ozone inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+If inputs are specified for ozone and methane or NOx (i.e., !is.null(inputsList$o3) & (!is.null(inputsList$ch4) | !is.null(inputsList$nox))
), run_fredi_methane()
will use the ozone scenario in preference of the methane and NOx scenario.
+
+Methane Scenario. The input methane scenario requires changes in annual methane concentrations, at the national level, in parts per billion by volume (ppbv) relative to a 1986-2005 baseline era.
ch4
requires a data frame object with two columns with names "year"
and "CH4_ppbv"
containing the year and the change in methane concentration (in ppbv) relative to a 1986-2005 baseline era.
+Methane inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+run_fredi_methane()
will override a user-supplied methane scenario with a user-supplied ozone scenario; in other words, run_fredi_methane()
will use the ozone scenario in preference of the methane and NOx scenario.
+
+NOx Scenario. The input NOx scenario requires annual NOx emissions in the US, at the national level, in Megatons (MT) relative to a 1986-2005 baseline.
nox
requires a data frame object with two columns with names "year"
and "NOx_Mt"
containing the year and the change in NOx concentration (in Mt) relative to a 1986-2005 baseline era.
+NOx inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+run_fredi_methane()
will override a user-supplied methane scenario with a user-supplied ozone scenario; in other words, run_fredi_methane()
will use the ozone scenario in preference of the methane and NOx scenario.
+
+
run_fredi()
, run_fredi_sv()
, and run_fredi_methane()
each require a population scenario at the state level. If the population scenario is supplied to import_inputs()
at a geographical scale above the state level (i.e., if popArea = "national"
, popArea = "area"
, or popArea = "regional"
), import_inputs()
will calculate state-level estimates from the provided data:
If popArea = "national"
, import_inputs()
will use historical U.S. Census data for the period 2010--2023 to allocate total national population to CONUS and non-CONUS regions (i.e., Alaska and Hawaii); U.S. Census values from 2023 are applied in allocations for years after 2023. import_inputs()
then uses ICLUS data and projections for the period 2010--2100 to allocate CONUS population to specific NCA regions; ICLUS values from 2100 are applied in allocations for years after 2100.
If popArea = "national"
or popArea = "regional"
, import_inputs()
uses ICLUS data and projections for the period 2010--2100 to allocate population for each NCA region to the associated states; ICLUS values from 2100 are applied in allocations for years after 2100.
import_inputs()
outputs a list of data frame objects that can be passed to the main FREDI function run_fredi()
using the inputList
argument. For example, specify run_fredi(inputsList = x)
to generate impacts for a custom scenario x
(where x
is a list of data frames such as that output from import_inputs()
) (see run_fredi()
).
-All inputs to import_inputs()
are optional. If the user does not specify a file path for tempfile
, slrfile
, gdpfile
, or popfile
(or if there is are any errors reading in inputs from a file path), import_inputs()
outputs a list with a NULL
value for the associated list element. After reading in data from the specified CSV files, import_inputs()
performs basic checks and will also return a NULL
value for a particular list element if any of the checks fail.
+All inputs to import_inputs()
are optional. If the user does not specify particular named elements (or if there is are any errors reading in inputs from a file path), import_inputs()
outputs a list with a NULL
value for the associated list element. After reading in data from the specified CSV files, import_inputs()
performs basic checks and will also return a NULL
value for a particular list element if any of the checks fail.
When using import_inputs()
with run_fredi()
, run_fredi()
defaults back to the default scenarios for any elements of the inputs list that are NULL
or missing. In other words, running run_fredi(inputsList = list())
returns the same outputs as running run_fredi()
(see run_fredi()
).
@@ -162,8 +170,8 @@ Examples
### View example scenario names
scenariosPath |> list.files()
-#> [1] "GCAM_scenario.csv" "State ICLUS Population.csv"
-#> [3] "slr_from_GCAM.csv"
+#> [1] "gcamDefault.csv" "gcamScenarios.csv" "gdpDefault.csv"
+#> [4] "popDefault.csv"
### SLR Scenario File Name
slrInputFile <- scenariosPath |> file.path("slr_from_gcam.csv")
@@ -172,40 +180,28 @@ ExamplespopInputFile <- scenariosPath |> file.path("State ICLUS Population.csv")
### Import inputs
-example_inputsList <- import_inputs(slrfile=slrInputFile, popfile=popInputFile, popArea="state")
+example_inputsList <- import_inputs(inputsList=list(slr=slrInputFile, pop=popInputFile), popArea="state")
#>
#> In import_inputs():
#> Loading data...
#> User specified slrfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/slr_from_gcam.csv...
-#> Data loaded.
+#> File does not exist! Returning a null data frame for slr input.
#> User specified popfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/State ICLUS Population.csv...
-#> Data loaded.
+#> File does not exist! Returning a null data frame for pop input.
#>
#> Checking input values...
#>
-#> Checking input values for slr inputs...
-#> Values passed.
-#>
-#> Checking input values for pop inputs...
-#> Column "pop" not found in popfile data!
-#> Looking for columns with matches to the string "pop"...1 match found!
-#> Using column "state_pop", and renaming to "state_pop"...
-#> Values passed.
-#>
#> Finished.
### Use imports with FREDI:
df_x <- run_fredi(inputsList=example_inputsList)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from user inputs...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from user inputs...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -216,11 +212,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/index.html b/docs/reference/index.html
index d9dfde11..08aa75d4 100644
--- a/docs/reference/index.html
+++ b/docs/reference/index.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.1
+ 4.2.0
@@ -82,7 +82,7 @@ All functionsaggregate_impacts()
- Summarize and aggregate impacts from run_fredi()
(calculate national totals, average across models, sum impact types, and interpolate between impact year estimates)
+ Summarize and aggregate impacts from run_fredi()
(calculate national totals, average across models, sum impact types, and interpolate between impact year estimates)
-
convertTemps()
@@ -90,14 +90,14 @@ All functionsdefaultResults
+ gcamScenarios
- - Default outputs of
run_fredi()
A dataframe containing the default outputs of run_fredi()
+ - Six driver scenarios that can be passed as inputs to
run_fredi()
and run_fredi_sv()
-
-
gcamScenarios
+ gdpDefault
- - Six driver scenarios that can be passed as inputs to
run_fredi()
and run_fredi_sv()
+ - Scenario with values for U.S. Gross Domestic Product (GDP), which can be passed as an input to
run_fredi()
or run_fredi_methane()
.
-
get_sectorInfo()
@@ -107,7 +107,7 @@ All functionsget_sv_sectorInfo()
- - Retrieve a character vector of sectors available in the FrEDI Social Vulnerability (SV) module (run_fredi_sv) or a data frame with SV sectors and additional information.
+ - Retrieve a character vector of sectors available in the FrEDI Social Vulnerability (SV) module (run_fredi_sv) or a data frame with SV sectors and additional information.
-
import_inputs()
@@ -115,9 +115,9 @@ All functionspopScenario
+ popDefault
- - Population scenario to use as an input to
run_fredi()
and run_fredi_sv()
+ - U.S. state population scenario, which can be passed as an input to
run_fredi()
, run_fredi_sv()
, and/or FrEDI:run_fredi_methane()
.
-
run_fredi()
@@ -125,6 +125,11 @@ All functionsrun_fredi_methane()
+
+ - Project annual average impacts from methane, NOx, and ozone.
+
-
+
run_fredi_sv()
- Calculate climate change impacts on socially vulnerable (SV) populations throughout the 21st century for available sectors
diff --git a/docs/reference/popScenario.html b/docs/reference/popScenario.html
deleted file mode 100644
index cad31b4a..00000000
--- a/docs/reference/popScenario.html
+++ /dev/null
@@ -1,131 +0,0 @@
-
-Population scenario to use as an input to run_fredi() and run_fredi_sv() — popScenario • FrEDI
- Skip to contents
-
-
-
-
-
- Population scenario to use as an input to run_fredi()
and run_fredi_sv()
- Source: R/data.R
- popScenario.Rd
-
-
-
- A dataframe containing a population scenario to be passed as an input to run_fredi()
and run_fredi_sv()
.
-
-
-
-
-
- Format
- A data frame with 14,259 rows and 5 columns:
- year
-Year
-
-- region
-Region of U.S. ("Midwest", "Northeast", "Northern Plains", "Northwest", "Southeast", "Southern Plains", and "Southwest")
-
-- state
-One of 48 contiguous U.S. states or the District of Columbia
-
-- postal
-Postal code abbreviation associated with the state
-
-- state_pop
-State population for associated region and year
-
-
-
-
-
- Details
- This dataframe contains population projections at the state level from the Integrated Climate and Land Use Scenarios version 2 (ICLUSv2) model (Bierwagen et al, 2010; EPA 2017) under the Median variant projection of United Nations (2015).
-Bierwagen, B., D. M. Theobald, C. R. Pyke, A. Choate, P. Groth, J. V. Thomas, and P. Morefield. 2010. “National housing and impervious surface scenarios for integrated climate impact assessments.” Proc. Natl. Acad. Sci. 107 (49): 20887–20892. https://doi.org/10.1073/pnas.1002096107.
-EPA. 2017. Multi-Model Framework for Quantitative Sectoral Impacts Analysis: A technical report for the Fourth National Climate Assessment. U.S. Environmental Protection Agency, EPA 430-R-17-001.
-United Nations. 2015. World population prospects: The 2015 revision. New York: United Nations, Department of Economic and Social Affairs, Population Division.
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/reference/run_fredi.html b/docs/reference/run_fredi.html
index 09824b88..c5388b5f 100644
--- a/docs/reference/run_fredi.html
+++ b/docs/reference/run_fredi.html
@@ -12,7 +12,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -79,7 +79,7 @@
Usage
run_fredi(
- inputsList = list(tempInput = NULL, slrInput = NULL, gdpInput = NULL, popInput = NULL),
+ inputsList = list(temp = NULL, slr = NULL, gdp = NULL, pop = NULL),
sectorList = NULL,
aggLevels = c("national", "modelaverage", "impactyear", "impacttype"),
elasticity = 1,
@@ -93,8 +93,8 @@ Usage
Arguments
- - inputsList=NULL
-A list of named elements named elements (names(inputsList) = c("tempInput", "slrInput", "gdpInput", "popInput")
), each containing data frames of custom temperature, global mean sea level rise (GMSL), gross domestic product (GDP), and/or state-level population trajectories, respectively, over a continuous period in the range 2010 to 2300. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population and GDP scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
+ - inputsList=list(gdp=NULL, pop=NULL, temp=NULL, slr=NULL)
+A list with named elements (gdp
, pop
, temp
, and/or slr
), each containing data frames of custom scenarios for gross domestic product (GDP), state-level population, temperature, and/or global mean sea level rise (GMSL) trajectories, respectively, over a continuous period. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population and GDP scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
- sectorList=NULL
@@ -144,40 +144,40 @@ Value
Details
This function allows users to project annual average climate change impacts through 2300 (2010-2300) for available sectors. run_fredi()
is the main function in the FrEDI R package, described elsewhere (See https://epa.gov/cira/FrEDI for more information).
-Users can specify an optional list of custom scenarios with inputsList
(for more information on the format of inputs, see import_inputs()
). The function import_inputs()
can be used to importing custom scenarios from CSV files. import_inputs()
returns a list with elements tempInput
, slrInput
, gdpInput
, and popInput
, with each containing a data frame with a custom scenario for temperature, GMSL, GDP, and state-level population, respectively. If a user imports scenarios using import_inputs()
, they can pass the outputs of import_inputs()
directly to the run_fredi()
argument inputsList
. Note that the documentation for import_inputs()
can also provide additional guidance and specification on the formats for each scenario type.
-If inputsList = NULL
, run_fredi()
uses defaults for temperature, SLR, GDP, and population. Otherwise, run_fredi()
looks for a list object passed to the argument inputsList
. Within that list, run_fredi()
looks for list elements tempInput
, slrInput
, gdpInput
, and popInput
containing data frames with custom scenarios for temperature, GMSL, GDP, and state population, respectively. run_fredi()
will default back to the default scenarios for any list elements that empty or NULL
(in other words, running run_fredi(inputsList = list())
returns the same outputs as running run_fredi()
).
Temperature Inputs. The input temperature scenario requires CONUS temperatures in degrees Celsius relative to 1995 (degrees of warming relative to the baseline year--i.e., the central year of the 1986-2005 baseline). CONUS temperature values must be greater than or equal to zero degrees Celsius.
Users can convert global temperatures to CONUS temperatures using convertTemps(from = "global")
(or by specifying import_inputs(temptype = "global")
when using import_inputs()
to import a temperature scenario from a CSV file).
-tempInput
requires a data frame object with two columns with names "year"
, and "temp_C"
containing the year and CONUS temperatures in degrees Celsius, respectively.
-Temperature inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for temperature (i.e., inputsList = list(tempInput = NULL)
, run_fredi()
uses a default temperature scenario.
-
-SLR Inputs. The input SLR scenario requires values for changes in global mean sea level rise (GMSL) heights in centimeters (cm). GMSL heights must be greater than or equal to zero.
slrInput
requires a data frame object with two columns with names "year"
, "slr_cm"
containing the year and global mean sea level rise (GMSL) in centimeters, respectively.
-SLR inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for SLR (i.e., inputsList = list(slrInput = NULL)
, run_fredi()
first converts the input or default CONUS temperature scenario to global temperatures (using convertTemps()
) and then converts the global temperatures to a global mean sea level rise (GMSL) height in centimeters (using temps2slr()
).
-
-GDP Inputs. The input scenario for gross domestic product (GDP) requires national GDP values in 2015$. GDP values must be greater than or equal to zero.
gdpInput
requires a data frame object with two columns with names "year"
, and "gdp_usd"
containing the year and the national GDP, respectively. GDP values must be greater than or equal to zero.
+Users can specify an optional list of custom scenarios with inputsList
(for more information on the format of inputs, see import_inputs()
). The function import_inputs()
can be used to importing custom scenarios from CSV files. import_inputs()
returns a list with named elements gdp
, pop
, temp
, and slr
, with each containing a data frame with a custom scenario for GDP, state-level population, temperature, and/or GMSL respectively. If a user imports scenarios using import_inputs()
, they can pass the outputs of import_inputs()
directly to the run_fredi()
argument inputsList
. Note that the documentation for import_inputs()
can also provide additional guidance and specification on the formats for each scenario type.
+Otherwise, run_fredi()
looks for a list object passed to the argument inputsList
. Within that list, run_fredi()
looks for named list elements -- gdp
, pop
, temp
, and/or slr
-- each containing a data frame with a custom scenario for GDP, state population, temperature, and/or GMSL, respectively. If inputsList = NULL
or inputsList = list()
(default), run_fredi()
uses default trajectories for GDP, population, temperature, and SLR (see gdpDefault, popDefault, and gcamScenarios for more information). run_fredi()
will default back to the default scenarios for any list elements that empty or NULL
(in other words, running run_fredi(inputsList = list())
returns the same outputs as running run_fredi()
).
GDP Inputs. The input scenario for gross domestic product (GDP) requires national GDP values in 2015$. GDP values must be greater than or equal to zero.
gdp
requires a data frame object with two columns with names "year"
, and "gdp_usd"
containing the year and the national GDP, respectively. GDP values must be greater than or equal to zero.
GDP inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for GDP (i.e., inputsList = list(gdpInput = NULL)
, run_fredi()
uses a default GDP scenario.
+If the user does not specify an input scenario for GDP (i.e., inputsList = list(gdp = NULL)
, run_fredi()
uses a default GDP scenario.
-Population Inputs. The input population scenario requires state-level population values. Population values must be greater than or equal to zero.
popInput
requires a data frame object with five columns with names "region"
, "state"
, "postal"
, "year"
, and "state"
containing the year, the NCA region name, the state name, the postal code abbreviation for the state, and the state population, respectively.
+Population Inputs. The input population scenario requires state-level population values. Population values must be greater than or equal to zero.
pop
requires a data frame object with five columns with names "region"
, "state"
, "postal"
, "year"
, and "pop"
containing the year, the NCA region name (one of "Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
), the state name, the postal code abbreviation for the state, and the state population, respectively.
Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for population (i.e., inputsList = list(popInput = NULL)
, run_fredi()
uses a default population scenario.
+If the user does not specify an input scenario for population (i.e., inputsList = list(pop = NULL)
, run_fredi()
uses a default population scenario.
+
+Temperature Inputs. The input temperature scenario requires CONUS temperatures in degrees Celsius relative to 1995 (degrees of warming relative to the baseline year--i.e., the central year of the 1986-2005 baseline). CONUS temperature values must be greater than or equal to zero degrees Celsius.
Users can convert global temperatures to CONUS temperatures using convertTemps(from = "global")
(or by specifying import_inputs(temptype = "global")
when using import_inputs()
to import a temperature scenario from a CSV file).
+temp
requires a data frame object with two columns with names "year"
, and "temp_C"
containing the year and CONUS temperatures in degrees Celsius, respectively.
+Temperature inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+If the user does not specify an input scenario for temperature (i.e., inputsList = list(temp = NULL)
, run_fredi()
uses a default temperature scenario.
+
+SLR Inputs. The input SLR scenario requires values for changes in global mean sea level rise (GMSL) heights in centimeters (cm). GMSL heights must be greater than or equal to zero.
slr
requires a data frame object with two columns with names "year"
, "slr_cm"
containing the year and global mean sea level rise (GMSL) in centimeters, respectively.
+SLR inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+If the user does not specify an input scenario for SLR (i.e., inputsList = list(slr = NULL)
, run_fredi()
first converts the input or default CONUS temperature scenario to global temperatures (using convertTemps()
) and then converts the global temperatures to a global mean sea level rise (GMSL) height in centimeters (using temps2slr()
).
-
run_fredi()
linearly interpolates missing annual values for all input scenarios using non-missing values (each scenario requires at least two non-missing values as detailed above for each scenario type). After interpolation of the input scenarios, run_fredi()
subsets the input scenarios to values within the analysis period.
Temperatures are interpolated using 1995 as the baseline year (i.e., the central year of the 1986-2005 baseline) and GMSL is interpolated using 2000 as the baseline year. In other words, temperature (in degrees Celsius) is set to zero for the year 1995, whereas GMSL is set to zero for the year 2000. The interpolated temperature and GMSL scenarios are combined into a column called driverValue
, along with additional columns for year, the driver unit (column "driverUnit"
, with driverUnit = "degrees Celsius"
and driverUnit = "cm"
for temperature- and SLR-driven sectors, respectively), and the associated model type (column "model_type"
, with model_type = "GCM"
and model_type = "SLR"
for temperature- and SLR-driven sectors, respectively
-run_fredi()
calculations national population from state-level values and then calculates GDP per capita from values for GDP and national population. Values for state population, national population, national GDP (in 2015$), and national per capita GDP (in 2015$/capita) are provided in the results data frame in columns "state_pop"
, "national_pop"
, "gdp_usd"
, and "gdp_percap"
, respectively.
+
run_fredi()
linearly interpolates missing annual values for all input scenarios using non-missing values (each scenario requires at least two non-missing values as detailed above for each scenario type). After interpolation of the input scenarios, run_fredi()
subsets the input scenarios to values within the analysis period.
Temperatures are interpolated using 1995 as the baseline year (i.e., the central year of the 1986-2005 baseline) and GMSL is interpolated using 2000 as the baseline year. In other words, temperature (in degrees Celsius) is set to zero for the year 1995, whereas GMSL is set to zero for the year 2000. The interpolated temperature and GMSL scenarios are combined into a column called driverValue
, along with additional columns for year, the driver unit (column "driverUnit"
, with driverUnit = "degrees Celsius"
and driverUnit = "cm"
for temperature- and SLR-driven sectors, respectively), and the associated model type (column "model_type"
, with model_type = "GCM"
and model_type = "SLR"
for temperature- and SLR-driven sectors, respectively.
+run_fredi()
calculates national population from state-level values and then calculates GDP per capita from values for GDP and national population. Values for state population, national population, national GDP (in 2015$), and national per capita GDP (in 2015$/capita) are provided in the results data frame in columns "pop"
, "national_pop"
, "gdp_usd"
, and "gdp_percap"
, respectively.
By default, run_fredi()
will calculate impacts for all sectors included in the tool. Alternatively, users can pass a character vector specifying a single sector or a subset of sectors using the sectorList
argument. To see a list of sectors included within FrEDI, run get_sectorInfo()
. If sectorList = NULL
(default), all sectors are included.
By default, run_fredi()
calculates impacts starting in the year 2010 and ending in 2100. Specify an alternative end year for the analysis using the maxYear
argument. maxYear
has a default value of 2100
and minimum and maximum values of 2011
and 2300
, respectively. Alternatively, users can set argument thru2300 = TRUE
to override the maxYear
argument and set maxYear = 2300
. Note that the default scenarios included within FrEDI stop in the year 2100; users must provide custom input scenarios out to the desired end year and specify a maxYear >= 2100
(and maxYear <= 2300
) in order to return non-missing values for years after 2100.
Annual impacts for each sector, variant, impact type, and impact year combination included in the model are calculated by multiplying scaled climate impacts by a physical scalar and economic scalars and multipliers. Some sectors use Value of a Statistical Life (VSL) to adjust the value non-linearly over time. run_fredi()
uses a default value of elasticity = 1
to adjust VSL for applicable sectors and impacts (the default value of elasticity = 1
keeps VSL constant over time). A custom elasticity can be passed to the elasticity
argument. Applicable sectors and impacts are *Climate-Driven Changes in Air Quality (all impact types), ATS Temperature-Related Mortality (impactType = "N/A"
; i.e., all impact types), CIL Temperature-Related Mortality, Extreme Temperature (all impact types), Suicide (impactType = "N/A"
; i.e., all impact types), Southwest Dust (impactType = "All Mortality"
), Valley Fever (impactType = "Mortality"
), Vibriosis (impactType = "N/A"
; i.e., all impact types), and Wildfire (impactType = "Mortality"
).
run_fredi()
aggregates or summarizes results to level(s) of aggregation specified by the user (passed to aggLevels
) using the post-processing helper function aggregate_impacts()
. Users can specify all aggregation levels at once by specifying aggLevels = "all"
(default) or no aggregation levels (aggLevels = "none"
). Users can specify a single aggregation level or multiple aggregation levels by passing a single character string or character vector to aggLevels
. Options for aggregation include calculating national totals (aggLevels = "national"
), averaging across model types and models (aggLevels = "modelaverage"
), summing over all impact types (aggLevels = "impacttype"
), and interpolating between impact year estimates (aggLevels = "impactYear"
).
-If the user specifies aggLevels = "none"
, run_fredi()
returns a data frame with columns: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, "state_pop"
, "year"
, "physical_impacts"
, and "annual_impacts"
.
Columns "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, and "model"
all contain observation identifiers (sector name, variant, impact type, impact year, region, state, state postal code abbreviation, model type, and model, respectively).
+If the user specifies aggLevels = "none"
, run_fredi()
returns a data frame with columns: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, "pop"
, "year"
, "physical_impacts"
, and "annual_impacts"
.
Columns "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, and "model"
all contain observation identifiers (sector name, variant, impact type, impact year, region, state, state postal code abbreviation, model type, and model, respectively).
Columns "sectorprimary"
and "includeaggregate"
contain values that provide information about how to treat sectors and when aggregating over sectors (e.g., summing impacts across sectors). Note that FrEDI does not currently provide functionality to aggregate over sectors; this information is provided for user convenience.
Column "sectorprimary"
contains values indicating which variant to use as the primary one for each sector: sectorprimary = 1
for primary variants and sectorprimary = 0
for non-primary variants. When aggregating impacts over sectors, users should filter the outputs of run_fredi()
to variants with sectorprimary == 1
.
Column "includeaggregate"
contains values that provide information about how to treat sectors when aggregating over sectors (e.g., summing impacts across sectors). Sectors that have a value of includeaggregate == 0
should be dropped when aggregating results over sectors, to avoid potential double-counting of impacts for similar sectors. For instance, sectors ATS Temperature-Related Mortality, CIL Temperature-Related Mortality, and Extreme Temperature have values for temperature-related mortality. To avoid double counting, outputs of run_fredi()
should be filtered to values for which includeaggregate > 0
. Sectors with a value of includeaggregate > 0
can be included when aggregating over sectors; most sectors with a value of includeaggregate > 0
will have a value of includeaggregate = 1
. Values of includeaggregate > 1
flag additional information about sectors; currently, only the Suicide sector has a value of includeaggregate > 1
, with a value of includeaggregate = 2
. This flag indicates that the impacts from Suicide can be included when summing values across sectors, but may have some overlap with impacts from ATS Temperature-Related Mortality. For more information about the potential overlap between impacts for ATS Temperature-Related Mortality and Suicide, visit the technical documentation at https://epa.gov/cira/FrEDI/,
Columns "driverType"
, "driverUnit"
, and "driverValue"
contain information about the temperature and SLR scenarios.
-Columns "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "state_pop"
contain information about the GDP and population scenarios.
+Columns "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "pop"
contain information about the GDP and population scenarios.
Columns "physicalmeasure"
and "physical_impacts"
contain information about physical impacts.
Column "annual_impacts"
contains information on the economic value associated with annual impacts.
If the user specifies aggLevels = "all"
or other combinations of aggregation levels, run_fredi()
passes the results data frame and the aggLevels
argument to the aggregate_impacts()
function. aggregate_impacts()
then performs the following calculations, using the default grouping columns for the aggregate_impacts()
: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, and "year"
(note that the "variant"
column referred to below contains information about the variant name (or “N/A”
), as applicable).
-Aggregation Level Description impactyear
To aggregate over impact years, aggregate_impacts()
first separates results for sectors with only one impact year estimate (i.e., impactYear = "N/A"
) from from observations with multiple impact year estimates (i.e., sectors with results for both impactYear = "2010"
and impactYear = "2090"
). For these sectors with multiple impact years, physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
) are linearly interpolated between impact year estimates. For any model run years above 2090, annual results for sectors with multiple impact years return the 2090 estimate. The interpolated values are then row-bound to the results for sectors with a single impact year estimate, and column impactYear
set to impactYear = "Interpolation"
for all values. If "impactyear"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
aggregates over impact years before performing other types of aggregation. modelaverage
To aggregate over models for temperature-driven sectors, aggregate_impacts()
averages physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all GCM models present in the data. aggregate_impacts()
drops the column "model"
from the grouping columns when averaging over models. Averages exclude observations with missing values. However, If all values within a grouping are missing, the model average is set to NA
. The values in column "model"
are set to "Average"
for model averages and the model averages data frame is then row-bound to the main results data frame. For SLR-driven sectors, there is no need for additional model aggregation; these values already have model = "Interpolation"
. If "modelaverage"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years (if "impactyear"
present in aggLevels
or if aggLevels = "all"
) before aggregating over models. national
To aggregate values to the national level, aggregate_impacts()
sums physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all states present in the data. aggregate_impacts()
drops the columns "region"
, "state"
, and "postal"
when summing over states and regions. Years which have missing column data for all regions return as NA
. Values for columns "region"
, "state"
, and "postal"
are set to "National Total"
, All
, and US
, respectively. The data frame with national totals is then row-bound to the main results data frame. If "national"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years and/or models (if "impactyear"
and/or "modelaverage"
are present in aggLevels
or if aggLevels = "all"
) before aggregating over models. impacttype
To aggregate values over impact types, aggregate_impacts()
sums annual impacts (column "annual_impacts"
) across all impact types for each sector. aggregate_impacts()
drops the column "impactType"
and "physicalmeasure"
from the grouping columns when summing over impact types. Years which have missing column data for all impact types return as NA
. All values in column "impactType"
are set to "all"
. Aggregating over impact types, drops columns related to physical impacts (i.e., columns "physicalmeasure"
and "physical_impacts"
). These columns are dropped since aggregating over impact types for some sectors requires summing costs over different types of physical impacts, so reporting the physical impacts would be nonsensical.
After aggregating values, aggregate_impacts()
joins the data frame of impacts with information about "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "state_pop"
.
+Aggregation Level Description impactyear
To aggregate over impact years, aggregate_impacts()
first separates results for sectors with only one impact year estimate (i.e., impactYear = "N/A"
) from from observations with multiple impact year estimates (i.e., sectors with results for both impactYear = "2010"
and impactYear = "2090"
). For these sectors with multiple impact years, physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
) are linearly interpolated between impact year estimates. For any model run years above 2090, annual results for sectors with multiple impact years return the 2090 estimate. The interpolated values are then row-bound to the results for sectors with a single impact year estimate, and column impactYear
set to impactYear = "Interpolation"
for all values. If "impactyear"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
aggregates over impact years before performing other types of aggregation. modelaverage
To aggregate over models for temperature-driven sectors, aggregate_impacts()
averages physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all GCM models present in the data. aggregate_impacts()
drops the column "model"
from the grouping columns when averaging over models. Averages exclude observations with missing values. However, If all values within a grouping are missing, the model average is set to NA
. The values in column "model"
are set to "Average"
for model averages and the model averages data frame is then row-bound to the main results data frame. For SLR-driven sectors, there is no need for additional model aggregation; these values already have model = "Interpolation"
. If "modelaverage"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years (if "impactyear"
present in aggLevels
or if aggLevels = "all"
) before aggregating over models. national
To aggregate values to the national level, aggregate_impacts()
sums physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all states present in the data. aggregate_impacts()
drops the columns "region"
, "state"
, and "postal"
when summing over states and regions. Years which have missing column data for all regions return as NA
. Values for columns "region"
, "state"
, and "postal"
are set to "National Total"
, All
, and US
, respectively. The data frame with national totals is then row-bound to the main results data frame. If "national"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years and/or models (if "impactyear"
and/or "modelaverage"
are present in aggLevels
or if aggLevels = "all"
) before aggregating over models. impacttype
To aggregate values over impact types, aggregate_impacts()
sums annual impacts (column "annual_impacts"
) across all impact types for each sector. aggregate_impacts()
drops the column "impactType"
and "physicalmeasure"
from the grouping columns when summing over impact types. Years which have missing column data for all impact types return as NA
. All values in column "impactType"
are set to "all"
. Aggregating over impact types, drops columns related to physical impacts (i.e., columns "physicalmeasure"
and "physical_impacts"
). These columns are dropped since aggregating over impact types for some sectors requires summing costs over different types of physical impacts, so reporting the physical impacts would be nonsensical.
After aggregating values, aggregate_impacts()
joins the data frame of impacts with information about "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "pop"
.
If outputList = FALSE
(default), run_fredi()
returns a data frame of annual average impacts over the analysis period, for each sector, variant, impact type, impact year, region, state, model type ("GCM"
or "SLR"
), and model. If outputList = TRUE
, in addition to the data frame of impacts, run_fredi()
returns a list object containing information about values for function arguments, driver scenarios, and population and GDP scenarios.
@@ -190,16 +190,15 @@ Examples### Load FrEDI
require(FrEDI)
-### Run function with defaults (same as `defaultResults` dataset)
+### Run function with defaults
run1 <- run_fredi()
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from defaults...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -207,62 +206,71 @@ Examplesdata("gcamScenarios")
gcamScenarios |> glimpse()
#> Rows: 606
-#> Columns: 4
-#> $ year <int> 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2…
-#> $ temp_C <dbl> 0.1269649, 0.1575513, 0.1858310, 0.2101611, 0.2306551, 0.2444…
-#> $ slr_cm <dbl> 0.0000000, 0.2727356, 0.5552278, 0.8458496, 1.1430287, 1.4440…
-#> $ scenario <chr> "Hector_GCAM_v5.3_ECS_3.0_REF", "Hector_GCAM_v5.3_ECS_3.0_REF…
+#> Columns: 6
+#> $ year <int> 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20…
+#> $ temp_C_conus <dbl> 0.1804171, 0.2238804, 0.2640659, 0.2986389, 0.3277609, 0…
+#> $ temp_C_global <dbl> 0.1269649, 0.1575513, 0.1858310, 0.2101611, 0.2306551, 0…
+#> $ slr_cm <dbl> 0.0000000, 0.2727356, 0.5552278, 0.8458496, 1.1430287, 1…
+#> $ scenario <chr> "ECS_3.0_REF", "ECS_3.0_REF", "ECS_3.0_REF", "ECS_3.0_RE…
+#> $ model <chr> "Hector_GCAM_v5.3", "Hector_GCAM_v5.3", "Hector_GCAM_v5.…
### Load population scenario and glimpse data
-data(popScenario)
-popScenario |> glimpse()
+data("popDefault")
+popDefault |> glimpse()
#> Rows: 14,259
#> Columns: 5
-#> $ year <dbl> 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, …
#> $ region <chr> "Southeast", "Southeast", "Southeast", "Southeast", "Southea…
#> $ state <chr> "Alabama", "Alabama", "Alabama", "Alabama", "Alabama", "Alab…
#> $ postal <chr> "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", …
+#> $ year <int> 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, …
#> $ state_pop <dbl> 4779736, 4823623, 4867509, 4911396, 4955282, 4999169, 503604…
### Subset climate scenario
-temps1 <- gcamScenarios |> filter(scenario=="Hector_GCAM_v5.3_ECS_3.0_ref")
-temps1 <- temps1 |> mutate(temp_C = temp_C_global |> convertTemps(from="global"))
-#> Error in mutate(temps1, temp_C = convertTemps(temp_C_global, from = "global")): ℹ In argument: `temp_C = convertTemps(temp_C_global, from = "global")`.
-#> Caused by error:
-#> ! object 'temp_C_global' not found
-temps1 <- temps1 |> select(year, temp_C)
+temps1 <- gcamScenarios |> filter(scenario=="ECS_3.0_ref")
+temps1 <- temps1 |> select(year, temp_C_conus)
### Run custom scenario
-run2 <- run_fredi(inputsList=list(tempInput=temps1, popInput=popScenario))
-#> Checking input values...
-#> Creating temperature scenario from user inputs...
-#> Error in map(regions0, function(region_i) { df_i <- filter(data, region == region_i) x_i <- df_i[["year"]] y_i <- df_i[[column0]] new_i <- approx(x = x_i, y = y_i, xout = years, rule = rule, method = method) new_i <- as_tibble(new_i) new_i <- rename_at(new_i, c(cols0), ~cols1) new_i <- mutate(new_i, region = region_i) return(new_i)}): ℹ In index: 1.
-#> Caused by error in `approx()`:
-#> ! need at least two non-NA values to interpolate
+run2 <- run_fredi(inputsList=list(temp=temps1, pop=popDefault))
+#> Checking scenarios...
+#>
+#> Checking input values for pop inputs...
+#> Column "pop" not found in popfile data!
+#> Looking for columns with matches to the string "pop"...1 match found!
+#> Using column "", and renaming to "pop"...
+#> Data is missing the following required columns: state_pop!
+#> Dropping pop inputs from outputs.
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
+#>
+#> Finished.
### Load scenarios from file:
scenariosPath <- system.file(package="FrEDI") |> file.path("extdata","scenarios")
scenariosPath |> list.files()
-#> [1] "GCAM_scenario.csv" "State ICLUS Population.csv"
-#> [3] "slr_from_GCAM.csv"
+#> [1] "gcamDefault.csv" "gcamScenarios.csv" "gdpDefault.csv"
+#> [4] "popDefault.csv"
### SLR Scenario File Name
-slrInputFile <- scenariosPath |> file.path("slr_from_GCAM.csv")
+slrInputFile <- scenariosPath |> file.path("gcamDefault.csv")
### Population Scenario File Name
-popInputFile <- scenariosPath |> file.path("State ICLUS Population.csv")
+popInputFile <- scenariosPath |> file.path("popDefault.csv")
### Import inputs
-x_inputs <- import_inputs(slrfile=slrInputFile, popfile=popInputFile, popArea="state")
+x_inputs <- import_inputs(inputsList=list(slr=slrInputFile, pop=popInputFile), popArea="state")
#>
#> In import_inputs():
#> Loading data...
#> User specified slrfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/slr_from_GCAM.csv...
+#> Importing data from C:/Users/knoiva/AppData/Local/R/win-library/4.4/FrEDI/extdata/scenarios/gcamDefault.csv...
#> Data loaded.
#> User specified popfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/State ICLUS Population.csv...
+#> Importing data from C:/Users/knoiva/AppData/Local/R/win-library/4.4/FrEDI/extdata/scenarios/popDefault.csv...
#> Data loaded.
#>
#> Checking input values...
@@ -271,23 +279,37 @@ Examples#> Values passed.
#>
#> Checking input values for pop inputs...
-#> Column "pop" not found in popfile data!
-#> Looking for columns with matches to the string "pop"...1 match found!
-#> Using column "state_pop", and renaming to "state_pop"...
+#> Checking that all states, etc. are present...
+#>
+#> Checking inputs for unique regions, states...
+#> All regions present...
+#> All states present...
#> Values passed.
#>
#> Finished.
### Run custom scenarios
run3 <- run_fredi(inputsList=x_inputs)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
+#> Checking scenarios...
+#>
+#> Checking input values for slr inputs...
+#> Values passed.
+#>
+#> Checking input values for pop inputs...
+#> Checking that all states, etc. are present...
+#>
+#> Checking inputs for unique regions, states...
+#> All regions present...
+#> All states present...
+#> Values passed.
#> Creating SLR scenario from user inputs...
-#> No GDP scenario provided...Using default GDP scenario...
#> Creating population scenario from user inputs...
-#> Updating scalars...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -321,32 +343,37 @@ Examples
### Run for a single sector, with default inputs, no aggregation, and elasticity=1:
run4 <- run_fredi(sectorList="ATS Temperature-Related Mortality", aggLevels="none", elasticity=1)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from defaults...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
#> Formatting results...
#>
#> Finished.
### Set end year for analysis to 2110 -- messages user and returns a null value since default scenarios only have values out to 2100
run5 <- run_fredi(maxYear=2110)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Temperature scenario must have at least one non-missing value in or after the year 2110...
+#> Checking scenarios...
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
#>
-#> Exiting...
+#> Finished.
### Set end year for analysis to 2300 -- messages user and returns a null value since default scenarios only have values out to 2100)
run6 <- run_fredi(thru2300=TRUE)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Temperature scenario must have at least one non-missing value in or after the year 2300...
+#> Checking scenarios...
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
#>
-#> Exiting...
+#> Finished.
@@ -358,11 +385,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/run_fredi_sv.html b/docs/reference/run_fredi_sv.html
index 082f5c36..f234cad7 100644
--- a/docs/reference/run_fredi_sv.html
+++ b/docs/reference/run_fredi_sv.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -77,8 +77,7 @@
Usage
run_fredi_sv(
sector = NULL,
- driverInput = NULL,
- popInput = NULL,
+ inputsList = list(pop = NULL, temp = NULL, slr = NULL),
silent = TRUE,
.testing = FALSE
)
@@ -90,22 +89,22 @@ Argumentsget_sv_sectorInfo() for a list of available sectors).
-- driverInput
-A data frame of up to four custom scenarios for drivers (temperature or global mean sea level rise). driverInput
requires a data frame with columns of "year"
and "scenario"
. The data frame must also include a third column: "temp_C"
for temperature-driven sectors (containing temperature values in degrees Celsius of warming for the contiguous U.S.) or "slr_cm"
for sea level rise (SLR)-driven sectors (containing values for global mean sea level rise in centimeters). Run get_sv_sectorInfo(gcmOnly=TRUE)
to see temperature-driven sectors in the SV module and get_sv_sectorInfo(slrOnly=TRUE)
to see SLR-driven scenarios. Users can also pass a data frame with all four columns ("year"
, "scenario"
, "temp_C"
, and "slr_cm"
), in which case run_fredi_sv()
determines whether to use the "temp_C"
or "slr_cm"
column as the driver trajectory based on the specified sector. Driver inputs for all scenarios should start in the year 2000 or earlier. All scenarios must include at least two non-missing values (especially values before or at 2000 and at or after 2100). If any required columns are missing, run_fredi_sv()
will use the default temperature or sea level rise scenario from run_fredi()
. If the data frame passed to driverInput
has more than four unique scenarios, run_fredi_sv()
will only run the first four scenarios.
+- silent
+A logical (TRUE/FALSE
) value indicating the level of messaging desired by the user (defaults to silent=TRUE
)
-- popInput
-The input population scenario requires a data frame object with a single scenario of state-level population values.
The population scenario must have five columns with names "year"
, "region"
, "state"
, "postal"
, and "state_pop"
containing the year, the NCA region name, the state name, the postal code abbreviation (e.g., "ME" for "Maine") for the state, and the state population, respectively.
-popInput
only accepts a a single scenario, in contrast to driverInput
. In other words, run_fredi_sv()
uses the same population scenario for any and all driver scenarios passed to driverInput
.
-If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario.
+- inputsList=list(pop=NULL, temp=NULL, slr=NULL)
+A list with named elements (pop
, temp
, and/or slr
), each containing data frames of custom scenarios for state-level population, temperature, and/or global mean sea level rise (GMSL) trajectories, respectively, over a continuous period. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
pop. The input population scenario requires a data frame object with a single scenario of population values for each of the 48 U.S. states and the District of Columbia comprising the contiguous U.S. (CONUS).
The population scenario must have five columns with names "region"
, "state"
, "postal"
, "year"
, and "_pop"
containing the NCA region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
), the state name, the two-letter postal code abbreviation for the state (e.g., "ME"
for Maine), the year, and the state population, respectively.
+The input population scenario can only contain a single scenario, in contrast to values for temperature or SLR inputs. In other words, run_fredi_sv()
uses the same population scenario when running any and all of the temperature or SLR scenarios passed to run_fredi_sv()
.
+If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario (see documentation for popScenario).
Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (2100).
Population values must be greater than or equal to zero.
+
+temp or slr. The input temperature or SLR scenario should be a data frame containing one or more custom scenarios. These inputs should be formulated similarly to those for run_fredi()
and import_inputs()
, with an additional column (scenario
) indicating the unique scenario identifier. Temperature and/or SLR input scenarios must have at least one non-missing value in the year 2000 or earlier and at least one non-missing value in or after the final analysis year (2100).
temp. Temperature inputs are used by run_fredi_sv()
with temperature-driven sectors; run get_sv_sectorInfo(gcmOnly=TRUE)
to get a list of the temperature-driven sectors available for the SV module. Temperature inputs require a data frame with columns of year
, temp_C
, and scenario
, respectively containing the year associated with an observation, temperature values for CONUS in degrees Celsius of warming relative to a 1995 baseline (where 1995 is the central year of a 1986-2005 baseline period -- i.e., values should start at zero in the year 1995), and a unique scenario identifier. If no temperature scenario is specified (i.e., inputsList$temp
is NULL
) when running a temperature-driven sector, run_fredi_sv()
will use a default temperature scenario (see FrEDI:gcamScenarios).
+slr. SLR inputs are used by run_fredi_sv()
with sea level rise-driven sectors; run get_sv_sectorInfo(slrOnly=TRUE)
to get a list of the SLR-driven sectors available for the SV module. SLR inputs require a data frame with columns of year
, slr_cm
, and scenario
, respectively containing the global mean sea level rise in centimeters relative to a 2000 baseline (i.e., values should start at zero in the year 2000), and a unique scenario identifier. If no SLR scenario is specified (i.e., inputsList$slr
is NULL
) when running a temperature-driven sector: if a user has supplied a temperature scenario (i.e., inputsList$temp
is not NULL
), run_fredi_sv()
will calculate sea level rise values from the temperature inputs using the temps2slr()
function; if no temperature scenario is provided, run_fredi_sv
will use a default SLR scenario (see FrEDI:gcamScenarios).
+
-
-- silent
-A logical (TRUE/FALSE
) value indicating the level of messaging desired by the user (defaults to silent=TRUE
).
-
Value
@@ -117,17 +116,8 @@ Value
Details
run_fredi_sv()
projects annual climate change impacts for socially vulnerable (SV) populations throughout the 21st century (2010-2100) for available sectors, using default or user-specified population, temperature, and sea level rise (SLR) trajectories. run_fredi_sv()
is the main function for the FrEDI Social Vulnerability (SV) module in the FrEDI R package, described elsewhere (See https://epa.gov/cira/FrEDI for more information). The SV module extends the FrEDI framework to socially vulnerable populations using data underlying a 2021 U.S. Environmental Protection Agency (EPA) report on Climate Change and Social Vulnerability in the United States.
Users can run run_fredi_sv()
to generate annual physical impacts for SV groups for individual sectors. When running run_fredi_sv()
, users must specify one of the sectors in the SV module; use get_sv_sectorInfo()
for a list of available sectors.
-run_fredi_sv()
can be run with default population and climate (temperature and SLR) trajectories or use run_fredi_sv()
to run custom scenarios. Running run_fredi_sv()
with custom climate scenarios requires passing a data frame of scenarios to the driverInput
argument. run_fredi_sv()
can also be run with a custom population scenario by passing a data frame of regional population trajectories to the popInput
argument; unlike climate scenarios, run_fredi_sv()
will only run a single scenario at a time.
driverInput
can take a data frame containing up to four custom scenarios for drivers (temperature or global mean sea level rise). driverInput
requires a data frame with columns of "year"
and "scenario"
. The data frame must also include a third column: "temp_C"
for temperature-driven sectors (containing temperature values in degrees Celsius of warming for the contiguous U.S.) or "slr_cm"
for sea level rise (SLR)-driven sectors (containing values for global mean sea level rise in centimeters). Run get_sv_sectorInfo(gcmOnly = TRUE)
to see temperature-driven sectors in the SV module and get_sv_sectorInfo(slrOnly = TRUE)
to see SLR-driven scenarios. Users can also pass a data frame with all four columns ("year"
, "scenario"
, "temp_C"
, and "slr_cm"
), in which case run_fredi_sv()
determines whether to use the "temp_C"
or "slr_cm"
column as the driver trajectory based on the specified sector. If any required columns are missing, run_fredi_sv()
will use the default temperature or sea level rise scenario from run_fredi()
. If the data frame passed to driverInput
has more than four unique scenarios, run_fredi_sv()
will only run the first four scenarios.
Temperature inputs must be temperature change in degrees Celsius for the contiguous U.S. (use convertTemps()
to convert global temperatures to CONUS temperatures before passing to driverInput
) relative to a 1995 baseline (where 1995 is the central year of a 1986-2005 baseline period; values should start at zero in the year 1995).
-Sea level rise inputs must be in centimeters relative to a 2000 baseline (i.e., values should start at zero in the year 2000). Driver inputs for all scenarios should start in the year 2000 or earlier. All scenarios must include at least two non-missing values (especially values before or at 2000 and at or after 2100).
-
-The input population scenario requires a data frame object with a single scenario of state-level population values.
The population scenario must have five columns with names "year"
, "region"
, "state"
, "postal"
, and "state_pop"
containing the year, the NCA region name, the state name, the postal code abbreviation (e.g., "ME" for "Maine") for the state, and the state population, respectively.
-popInput
only accepts a a single scenario, in contrast to driverInput
. In other words, run_fredi_sv()
uses the same population scenario for any and all driver scenarios passed to driverInput
.
-If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario.
-Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (2100).
-Population values must be greater than or equal to zero.
-The default regional population scenario is drawn from the Integrated Climate and Land Use Scenarios version 2 (ICLUSv2) model (Bierwagen et al, 2010; EPA 2017) under the Median variant projection of United Nations (United Nations, 2015). Note that the FrEDI SV default population scenario differs from the default population scenario used by run_fredi()
.
-
-
The output of run_fredi_sv()
is an R data frame object containing average annual physical impacts for socially vulnerable groups, at the NCA region level and five-year increments.
+run_fredi_sv()
can be run with default population and climate (temperature and SLR) trajectories or use run_fredi_sv()
to run custom scenarios. Running run_fredi_sv()
with custom climate scenarios requires passing a data frame of scenarios to the driverInput
argument. run_fredi_sv()
can also be run with a custom population scenario by passing a data frame of regional population trajectories to the popInput
argument; unlike climate scenarios, run_fredi_sv()
will only run a single scenario at a time.
+The output of run_fredi_sv()
is an R data frame object containing average annual physical impacts for socially vulnerable groups, at the NCA region level and five-year increments.
References
@@ -141,163 +131,18 @@ References
Examples
- ### Run SV Module with defaults without specifying sector
-df_sv <- run_fredi_sv()
-#> [1] "Please select a sector: "
-#> [1] "1. Air Quality - Childhood Asthma"
-#> [1] "2. Air Quality - Premature Mortality"
-#> [1] "3. Labor"
-#> [1] "4. Extreme Temperature"
-#> [1] "5. Roads"
-#> [1] "6. Transportation Impacts from High Tide Flooding"
-#> [1] "7. Coastal Properties"
-#> Warning: type 29 is unimplemented in 'type2char'
-#> Error in readline(prompt = sector_msg3): INTEGER() can only be applied to a 'integer', not a 'unknown type #29'
-
-### Return a character vector with the names of all of the sectors in the FrEDI SV Module:
-get_sv_sectorInfo()
-#> [1] "Air Quality - Childhood Asthma"
-#> [2] "Air Quality - Premature Mortality"
-#> [3] "Coastal Properties"
-#> [4] "Extreme Temperature"
-#> [5] "Labor"
-#> [6] "Roads"
-#> [7] "Transportation Impacts from High Tide Flooding"
-
-### Return a data frame of all of the sectors in the FrEDI SV Module (sector names and additional information)
-get_sv_sectorInfo(description=T)
-#> sector modelType driverUnit
-#> 1 Air Quality - Childhood Asthma GCM degrees Celsius
-#> 2 Air Quality - Premature Mortality GCM degrees Celsius
-#> 3 Coastal Properties SLR cm
-#> 4 Extreme Temperature GCM degrees Celsius
-#> 5 Labor GCM degrees Celsius
-#> 6 Roads GCM degrees Celsius
-#> 7 Transportation Impacts from High Tide Flooding SLR cm
-#> impactUnit
-#> 1 Childhood asthma cases
-#> 2 Premature Mortality
-#> 3 Individuals threatened with total property loss
-#> 4 Mortality
-#> 5 Hours of labor lost
-#> 6 Hours of delay
-#> 7 Hours of delay
-#> variants
-#> 1 N/A
-#> 2 N/A
-#> 3 Without Adaptation, With Adaptation
-#> 4 N/A
-#> 5 N/A
-#> 6 No Adaptation, Proactive Adaptation
-#> 7 Without Adaptation, With Adaptation
-
-### Run SV Module with defaults for "Coastal Properties" without saving
-df_sv <- run_fredi_sv(sector="Coastal Properties")
-#> Running FrEDI SV for sector 'Coastal Properties':
-#>
-#> Preparing driver scenario...
-#> Using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#>
-#> Preparing population scenario...
-#> Using default population scenario...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Coastal Properties", variant="Without Adaptation", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#>
-#> Calculating impacts for sector="Coastal Properties", variant="With Adaptation", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-### Run SV Module with defaults for "Extreme Temperature" without saving
-df_sv <- run_fredi_sv(sector="Extreme Temperature")
-#> Running FrEDI SV for sector 'Extreme Temperature':
-#>
-#> Preparing driver scenario...
-#> Using default temperature scenario...
-#>
-#> Preparing population scenario...
-#> Using default population scenario...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-### Load temperature scenarios
-load(gcamScenarios)
-#> Error in load(gcamScenarios): bad 'file' argument
-
-### Load population scenario
-load(popScenario)
-#> Error in load(popScenario): bad 'file' argument
-
-### Run SV Module for "Extreme Temperature" with custom population and temperature scenarios
-df_sv <- run_fredi_sv(sector = "Extreme Temperature", driverInput = gcamScenarios, popInput = popScenario)
-#> Running FrEDI SV for sector 'Extreme Temperature':
-#> Checking `driverInput` values...
-#> Checking scenarios in `driverInput`...
-#> Warning: `driverInput` has more than four distinct scenarios!
-#> Only the first four scenarios will be used...
-#> Checking `driverInput` values for temperature scenario...
-#> All temperature scenario columns present...
-#> Checking `popInput` values...
-#> All population scenario columns present in `popInput`...
-#>
-#> Preparing driver scenario...
-#> Using temperature scenario from user inputs...
-#>
-#> Preparing population scenario...
-#> Creating population scenario from user inputs...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_20"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_30"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_50"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-
+
Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/import_inputs.html b/docs/reference/import_inputs.html
index 79a35d77..7c5a1903 100644
--- a/docs/reference/import_inputs.html
+++ b/docs/reference/import_inputs.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -76,33 +76,29 @@
Usage
import_inputs(
- tempfile = NULL,
- slrfile = NULL,
- gdpfile = NULL,
- popfile = NULL,
+ inputsList = list(gdp = NULL, pop = NULL, temp = NULL, slr = NULL, ch4 = NULL, nox =
+ NULL, o3 = NULL),
temptype = "conus",
- popArea = "state"
+ popArea = "state",
+ module = "fredi"
)
Arguments
- - tempfile=NULL
-A character string indicating the location of a CSV file containing a custom temperature scenario. The first column in the CSV should be named "year"
and contain years associated with the temperature estimates; the second column (named "temp_C"
) should contain values for temperatures (i.e., degrees of warming relative to a baseline year of 1995), in degrees Celsius. The temperature scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
-
-
-- slrfile=NULL
-A character string indicating the location of a CSV file containing a custom sea level rise scenario. The first column in the CSV should be named "year"
and contain years associated with the sea level rise estimates; second column should be named "slr_cm"
and contain values for global mean sea level rise (GMSL), in centimeters, above a baseline year of 2000. The SLR scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
-
-
-- gdpfile=NULL
-A character string indicating the location of a CSV file containing a custom scenario for U.S. gross domestic product (GDP). The first column in the CSV should be named "year"
and contains years associated with the GDP estimates; the second column (named "gdp_usd"
) should contain values for U.S. GDP in 2015 U.S. dollars (2015$ USD). The GDP scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
). Values for GDP in column "gdp_usd"
must be greater than or equal to zero.
-
-
-- popfile=NULL
-A character string indicating the location of a CSV file containing a custom population scenario for states and NCA regions. The first column should be named "year"
and contain years in the interval 2010 to 2300. The second column should be called "pop"
and contain population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument (for more information, see the popArea
argument, below.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year. If popArea = "national"
, only the year
and pop
columns are required.
+ - inputsList=list(gdp=NULL, pop=NULL, temp=NULL, slr=NULL, ch4=NULL, nox=NULL)
+A named list containing file paths to CSV files containing scenarios:
gdp A character string indicating the location of a CSV file containing a custom scenario for U.S. gross domestic product (GDP), for use with run_fredi()
or run_fredi_methane()
. The first column in the CSV should be named "year"
and contains years associated with the GDP estimates; the second column (named "gdp_usd"
) should contain values for U.S. GDP in 2015 U.S. dollars (2015$ USD). The GDP scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
or run_fredi_methane()
). Values for GDP in column "gdp_usd"
must be greater than or equal to zero.
+pop A character string indicating the location of a CSV file containing a custom population scenario for states and NCA regions, for use with run_fredi()
, run_fredi_sv()
, or run_fredi_methane()
. The first column should be named "year"
and contain years in the interval 2010 to 2300. The second column should be called "pop"
and contain population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument (for more information, see the popArea
argument, below.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year. If popArea = "national"
, only the year
and pop
columns are required.
If popArea = "state"
, the file must contain estimates for all CONUS states -- i.e., all states except Alaska and Hawaii must be present in the input file (estimates for Alaska and Hawaii are optional). If popArea = "regional"
, the file must contain estimates for all seven NCA regions.
-The population scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
). Values for population in column "pop"
must be greater than or equal to zero.
+The population scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
or run_fredi_methane()
). Values for population in column "pop"
must be greater than or equal to zero.
+
+temp A character string indicating the location of a CSV file containing a custom temperature scenario, for use with run_fredi()
or run_fredi_sv()
. The first column in the CSV should be named "year"
and contain years associated with the temperature estimates; the second column (named "temp_C"
) should contain values for temperatures (i.e., degrees of warming relative to a baseline era of 1986-2005), in degrees Celsius. The temperature scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
+slr A character string indicating the location of a CSV file containing a custom sea level rise scenario, for use with run_fredi()
or run_fredi_sv()
. The first column in the CSV should be named "year"
and contain years associated with the sea level rise estimates; the second column should be named "slr_cm"
and contain values for global mean sea level rise (GMSL), in centimeters, above a baseline year of 2000. The SLR scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
+o3 A character string indicating the location of a CSV file containing a custom scenario for changes in U.S. state-level ozone concentrations (relative to a 1986-2005 baseline era). The input ozone scenario requires changes in annual state-level ozone concentrations, by GCM model, in parts per trillion by volume (pptv) relative to a 1986-2005 baseline era. In other words, the input ozone scenario requires ozone concentrations specific to the state, GCM model, and year of the analysis.
The o3
input requires a data frame object with six columns with names "region"
, "state"
, "postal"
, "model"
, "year"
, and "O3_pptv"
containing the region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively), the state name, the two-character postal code abbreviation for the state, the GCM model name ("CanESM2"
, "GFDL-CM3"
, "GISS-E2-R"
, "HadGEM2-ES"
, and/or "MIROC5"
), the year, and the change in ozone concentration (in pptv) relative to a 1986-2005 baseline era.
+Ozone inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by the maxYear
argument).
+
+ch4 A character string indicating the location of a CSV file containing a custom scenario for changes in U.S. methane concentrations (relative to a 1986-2005 baseline era), at the national level, for use with run_fredi_methane()
. The first column in the CSV should be named "year"
and contain years associated with the national methane estimates; the second column should be named "CH4_ppbv"
and contain values for methane. The methane scenario must start in 2020 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi_methane()
).
+nox A character string indicating the location of a CSV file containing a custom scenario for U.S. NOx emission values, at the national level. The first column in the CSV should be named "year"
and contain years associated with the national NOx estimates; the second column should be named "Mt"
and contain values for NOx emissions, in megatons per year (Mt). The NOx scenario must start in 2020 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi_methane()
).
@@ -121,29 +117,41 @@ Value
import_inputs()
returns a list of named elements containing data frames with custom scenarios for temperature, GMSL, GDP, and regional population, respectively:
-List Index Description tempInput
Data frame containing a custom temperature scenario imported from the CSV file specified by tempfile
, with missing values removed. tempInput
has two columns with names "year"
and "temp_C"
, containing the year and CONUS temperatures in degrees Celsius, respectively. slrInput
Data frame containing a custom GMSL scenario imported from the CSV file specified by slrfile
, with missing values removed. slrInput
has two columns with names "year"
, and "slr_cm"
, containing the year and global mean sea level rise (GMSL) in centimeters, respectively. gdpInput
Data frame containing a custom GDP scenario imported from the CSV file specified by gdpfile
, with missing values removed. gdpInput
has two columns with names "year"
, and "gdp_usd"
, containing the year and the national GDP, respectively. popInput
Data frame containing a custom temperature scenario imported from the CSV file specified by popfile
, with missing values removed. popInput
has three columns with names "year"
, "region"
, "state"
, "postal"
, and "state_pop"
, containing the year, the NCA region name, and the state, the postal code abbreviation (e.g., postal = "ME"
for state = "Maine"
), and the state population, respectively.
+List Index Description gdp
Data frame containing a custom GDP scenario imported from the CSV file specified by inputsList$gdp
, with missing values removed. gdp
has two columns with names "year"
, and "gdp_usd"
, containing the year and the national GDP, respectively. pop
Data frame containing a custom temperature scenario imported from the CSV file specified by inputsList$pop
, with missing values removed. popInput
has three columns with names "year"
, "region"
, "state"
, "postal"
, and "pop"
, containing the year, the NCA region name, and the state, the postal code abbreviation (e.g., postal = "ME"
for state = "Maine"
), and the state population, respectively. temp
Data frame containing a custom temperature scenario imported from the CSV file specified by inputsList$temp
, with missing values removed. temp
has two columns with names "year"
and "temp_C"
, containing the year and CONUS temperatures in degrees Celsius, respectively. slr
Data frame containing a custom GMSL scenario imported from the CSV file specified by inputsList$slr
, with missing values removed. slr
has two columns with names "year"
, and "slr_cm"
, containing the year and global mean sea level rise (GMSL) in centimeters, respectively. o3
Data frame containing a custom scenario with changes in ozone concentrations imported from the CSV file specified by inputsList$temp
, with missing values removed. o3
has six columns with names "region"
, "state"
, "postal"
, "model"
, "year"
, and "O3_pptv"
containing the region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively), the state name, the two-character postal code abbreviation for the state, the GCM model name ("CanESM2"
, "GFDL-CM3"
, "GISS-E2-R"
, "HadGEM2-ES"
, and/or "MIROC5"
), the year, and the change in ozone concentration (in pptv) relative to a 1986-2005 baseline era. ch4
Data frame containing a custom scenario with changes in methane concentrations imported from the CSV file specified by inputsList$slr
, with missing values removed. ch4
has two columns with names "year"
, and "CH4_ppbv"
, containing the year and Change in U.S. methane concentrations, in parts per billion by volume (ppbv) relative to a 1995-2006 baseline era, respectively. nox
Data frame containing a custom NOx emissions scenario imported from the CSV file specified by inputsList$nox
, with missing values removed. nox
has two columns with names "year"
and "NOx_Mt"
, containing the year and U.S. national-level NOx emissions (in Mt), respectively.
Details
- This function enables users to import data on custom scenarios for use with temperature binning. Users specify path names to CSV files containing temperature, global mean sea level rise (GMSL), population, and gross domestic product (GDP) scenarios (tempfile
, slrfile
, gdpfile
, and popfile
, respectively). import_inputs()
reads in and formats any specified files as data frames and returns a list of data frames for imported scenarios.
-The CSV files should contain estimates aligned with the requirements of the run_fredi()
or ``
Temperature Scenario. The file specified by tempfile
must have two columns -- "year"
and "temp_C"
-- respectively containing the years associated with the temperature estimates and the temperatures (i.e., degrees of warming) in degrees Celsius relative to a baseline year of 1995 (i.e., the central year of a 1986-2005 reference period).
If values in "temp_C"
have global rather than CONUS-specific temperatures, users should specify temptype = "global"
when running import_inputs()
, and import_inputs()
will convert the temperatures to CONUS using convertTemps (with argument from = "global"
).
-Temperature inputs to run_fredi()
must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-
-SLR Scenario. The file specified by slrfile
must have two columns -- "year"
and "slr_cm"
-- respectively containing the years associated with the GMSL estimates and GMSL estimates, in centimeters, above a 2000 baseline year.
GMSL heights must be greater than or equal to zero.
-The SLR scenario must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-
-GDP Scenario. The file specified by gdpfile
must have two columns -- "year"
and "gdp_usd"
-- respectively containing the years associated with the GDP estimates and the estimates for U.S. GDP, in 2015$.
GDP values must be greater than or equal to zero.
+ This function enables users to import data on custom scenarios for use with temperature binning. Users provide a named list specifying path names to CSV files containing scenarios for gross domestic product (GDP) (for use with run_fredi()
or run_fredi_methane()
); population (for use with run_fredi()
, run_fredi_sv()
, or run_fredi_methane()
); temperature and/or global mean sea level rise (GMSL) (for use with run_fredi()
or run_fredi_sv()
); or methane or NOx (for use with run_fredi_methane()
). import_inputs()
reads in and formats any specified files as data frames and returns a list of data frames for imported scenarios.
+The CSV files should contain estimates aligned with the requirements of the run_fredi()
or ``
GDP Scenario. The file specified by inputsList$gdp
must have two columns -- "year"
and "gdp_usd"
-- respectively containing the years associated with the GDP estimates and the estimates for U.S. GDP, in 2015$.
GDP values must be greater than or equal to zero.
The GDP scenario must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-Population Scenario. The file specified by popfile
population must have at least two columns -- "year"
and "pop"
-- respectively containing the years associated with the population estimates and the population estimates. requires state-level population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year. If popArea = "national"
, only the year
and pop
columns are required.
+Population Scenario. The file specified by inputsList$pop
population must have at least two columns -- "year"
and "pop"
-- respectively containing the years associated with the population estimates and the population estimates. requires state-level population values. Whether a third column is required depends on the geographical scale of the data, as specified by the popArea
argument.
If popArea = "state"
, the third column should be called "state"
and contain the name of the state associated with each population estimate in a given year. If popArea = "regional"
, the third column should be called "region"
and contain the NCA Region label associated with each population estimate in a given year (one of "Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively). If popArea = "national"
, only the year
and pop
columns are required.
If popArea = "state"
, the file must contain estimates for all CONUS states -- i.e., all states except Alaska and Hawaii must be present in the input file (estimates for Alaska and Hawaii are optional). If popArea = "regional"
, the file must contain estimates for all seven NCA regions.
The population scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the maxYear
argument to run_fredi()
).
Population values must be greater than or equal to zero.
Population estimates must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
-
run_fredi()
requires a population scenario at the state level. If the population scenario is supplied to import_inputs()
at a geographical scale above the state level (i.e., if popArea = "national"
, popArea = "area"
, or popArea = "regional"
), import_inputs()
will calculate state-level estimates from the provided data:
If popArea = "national"
, import_inputs()
will use historical U.S. Census data for the period 2010--2023 to allocate total national population to CONUS and non-CONUS regions (i.e., Alaska and Hawaii); U.S. Census values from 2023 are applied in allocations for years after 2023. import_inputs()
then uses ICLUS data and projections for the period 2010--2100 to allocate CONUS population to specific NCA regions; ICLUS values from 2100 are applied in allocations for years after 2100.
+Temperature Scenario. The file specified by inputsList$temp
must have two columns -- "year"
and "temp_C"
-- respectively containing the years associated with the temperature estimates and the temperatures (i.e., degrees of warming) in degrees Celsius relative to a baseline year of 1995 (i.e., the central year of a 1986-2005 reference period).
If values in "temp_C"
have global rather than CONUS-specific temperatures, users should specify temptype = "global"
when running import_inputs()
, and import_inputs()
will convert the temperatures to CONUS using convertTemps (with argument from = "global"
).
+Temperature inputs to run_fredi()
must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
+
+SLR Scenario. The file specified by inputsList$slr
must have two columns -- "year"
and "slr_cm"
-- respectively containing the years associated with the GMSL estimates and GMSL estimates, in centimeters, above a 2000 baseline year.
GMSL heights must be greater than or equal to zero.
+The SLR scenario must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the run_fredi()
maxYear
argument).
+
+Ozone Scenario. The input ozone scenario requires changes in annual state-level ozone concentrations, by GCM model, in parts per trillion by volume (pptv) relative to a 1986-2005 baseline era. In other words, the input ozone scenario requires ozone concentrations specific to the state, GCM model, and year of the analysis.
o3
requires a data frame object with six columns with names "region"
, "state"
, "postal"
, "model"
, "year"
, and "O3_pptv"
containing the region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
for CONUS states, or "Alaska"
and "Hawaii"
for Alaska and Hawaii, respectively), the state name, the two-character postal code abbreviation for the state, the GCM model name ("CanESM2"
, "GFDL-CM3"
, "GISS-E2-R"
, "HadGEM2-ES"
, and/or "MIROC5"
), the year, and the change in ozone concentration (in pptv) relative to a 1986-2005 baseline era.
+Ozone inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+If inputs are specified for ozone and methane or NOx (i.e., !is.null(inputsList$o3) & (!is.null(inputsList$ch4) | !is.null(inputsList$nox))
), run_fredi_methane()
will use the ozone scenario in preference of the methane and NOx scenario.
+
+Methane Scenario. The input methane scenario requires changes in annual methane concentrations, at the national level, in parts per billion by volume (ppbv) relative to a 1986-2005 baseline era.
ch4
requires a data frame object with two columns with names "year"
and "CH4_ppbv"
containing the year and the change in methane concentration (in ppbv) relative to a 1986-2005 baseline era.
+Methane inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+run_fredi_methane()
will override a user-supplied methane scenario with a user-supplied ozone scenario; in other words, run_fredi_methane()
will use the ozone scenario in preference of the methane and NOx scenario.
+
+NOx Scenario. The input NOx scenario requires annual NOx emissions in the US, at the national level, in Megatons (MT) relative to a 1986-2005 baseline.
nox
requires a data frame object with two columns with names "year"
and "NOx_Mt"
containing the year and the change in NOx concentration (in Mt) relative to a 1986-2005 baseline era.
+NOx inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+run_fredi_methane()
will override a user-supplied methane scenario with a user-supplied ozone scenario; in other words, run_fredi_methane()
will use the ozone scenario in preference of the methane and NOx scenario.
+
+
run_fredi()
, run_fredi_sv()
, and run_fredi_methane()
each require a population scenario at the state level. If the population scenario is supplied to import_inputs()
at a geographical scale above the state level (i.e., if popArea = "national"
, popArea = "area"
, or popArea = "regional"
), import_inputs()
will calculate state-level estimates from the provided data:
If popArea = "national"
, import_inputs()
will use historical U.S. Census data for the period 2010--2023 to allocate total national population to CONUS and non-CONUS regions (i.e., Alaska and Hawaii); U.S. Census values from 2023 are applied in allocations for years after 2023. import_inputs()
then uses ICLUS data and projections for the period 2010--2100 to allocate CONUS population to specific NCA regions; ICLUS values from 2100 are applied in allocations for years after 2100.
If popArea = "national"
or popArea = "regional"
, import_inputs()
uses ICLUS data and projections for the period 2010--2100 to allocate population for each NCA region to the associated states; ICLUS values from 2100 are applied in allocations for years after 2100.
import_inputs()
outputs a list of data frame objects that can be passed to the main FREDI function run_fredi()
using the inputList
argument. For example, specify run_fredi(inputsList = x)
to generate impacts for a custom scenario x
(where x
is a list of data frames such as that output from import_inputs()
) (see run_fredi()
).
-All inputs to import_inputs()
are optional. If the user does not specify a file path for tempfile
, slrfile
, gdpfile
, or popfile
(or if there is are any errors reading in inputs from a file path), import_inputs()
outputs a list with a NULL
value for the associated list element. After reading in data from the specified CSV files, import_inputs()
performs basic checks and will also return a NULL
value for a particular list element if any of the checks fail.
+All inputs to import_inputs()
are optional. If the user does not specify particular named elements (or if there is are any errors reading in inputs from a file path), import_inputs()
outputs a list with a NULL
value for the associated list element. After reading in data from the specified CSV files, import_inputs()
performs basic checks and will also return a NULL
value for a particular list element if any of the checks fail.
When using import_inputs()
with run_fredi()
, run_fredi()
defaults back to the default scenarios for any elements of the inputs list that are NULL
or missing. In other words, running run_fredi(inputsList = list())
returns the same outputs as running run_fredi()
(see run_fredi()
).
@@ -162,8 +170,8 @@ Examples
### View example scenario names
scenariosPath |> list.files()
-#> [1] "GCAM_scenario.csv" "State ICLUS Population.csv"
-#> [3] "slr_from_GCAM.csv"
+#> [1] "gcamDefault.csv" "gcamScenarios.csv" "gdpDefault.csv"
+#> [4] "popDefault.csv"
### SLR Scenario File Name
slrInputFile <- scenariosPath |> file.path("slr_from_gcam.csv")
@@ -172,40 +180,28 @@ ExamplespopInputFile <- scenariosPath |> file.path("State ICLUS Population.csv")
### Import inputs
-example_inputsList <- import_inputs(slrfile=slrInputFile, popfile=popInputFile, popArea="state")
+example_inputsList <- import_inputs(inputsList=list(slr=slrInputFile, pop=popInputFile), popArea="state")
#>
#> In import_inputs():
#> Loading data...
#> User specified slrfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/slr_from_gcam.csv...
-#> Data loaded.
+#> File does not exist! Returning a null data frame for slr input.
#> User specified popfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/State ICLUS Population.csv...
-#> Data loaded.
+#> File does not exist! Returning a null data frame for pop input.
#>
#> Checking input values...
#>
-#> Checking input values for slr inputs...
-#> Values passed.
-#>
-#> Checking input values for pop inputs...
-#> Column "pop" not found in popfile data!
-#> Looking for columns with matches to the string "pop"...1 match found!
-#> Using column "state_pop", and renaming to "state_pop"...
-#> Values passed.
-#>
#> Finished.
### Use imports with FREDI:
df_x <- run_fredi(inputsList=example_inputsList)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from user inputs...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from user inputs...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -216,11 +212,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/index.html b/docs/reference/index.html
index d9dfde11..08aa75d4 100644
--- a/docs/reference/index.html
+++ b/docs/reference/index.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.1
+ 4.2.0
@@ -82,7 +82,7 @@ All functionsaggregate_impacts()
- Summarize and aggregate impacts from run_fredi()
(calculate national totals, average across models, sum impact types, and interpolate between impact year estimates)
+ Summarize and aggregate impacts from run_fredi()
(calculate national totals, average across models, sum impact types, and interpolate between impact year estimates)
-
convertTemps()
@@ -90,14 +90,14 @@ All functionsdefaultResults
+ gcamScenarios
- - Default outputs of
run_fredi()
A dataframe containing the default outputs of run_fredi()
+ - Six driver scenarios that can be passed as inputs to
run_fredi()
and run_fredi_sv()
-
-
gcamScenarios
+ gdpDefault
- - Six driver scenarios that can be passed as inputs to
run_fredi()
and run_fredi_sv()
+ - Scenario with values for U.S. Gross Domestic Product (GDP), which can be passed as an input to
run_fredi()
or run_fredi_methane()
.
-
get_sectorInfo()
@@ -107,7 +107,7 @@ All functionsget_sv_sectorInfo()
- - Retrieve a character vector of sectors available in the FrEDI Social Vulnerability (SV) module (run_fredi_sv) or a data frame with SV sectors and additional information.
+ - Retrieve a character vector of sectors available in the FrEDI Social Vulnerability (SV) module (run_fredi_sv) or a data frame with SV sectors and additional information.
-
import_inputs()
@@ -115,9 +115,9 @@ All functionspopScenario
+ popDefault
- - Population scenario to use as an input to
run_fredi()
and run_fredi_sv()
+ - U.S. state population scenario, which can be passed as an input to
run_fredi()
, run_fredi_sv()
, and/or FrEDI:run_fredi_methane()
.
-
run_fredi()
@@ -125,6 +125,11 @@ All functionsrun_fredi_methane()
+
+ - Project annual average impacts from methane, NOx, and ozone.
+
-
+
run_fredi_sv()
- Calculate climate change impacts on socially vulnerable (SV) populations throughout the 21st century for available sectors
diff --git a/docs/reference/popScenario.html b/docs/reference/popScenario.html
deleted file mode 100644
index cad31b4a..00000000
--- a/docs/reference/popScenario.html
+++ /dev/null
@@ -1,131 +0,0 @@
-
-Population scenario to use as an input to run_fredi() and run_fredi_sv() — popScenario • FrEDI
- Skip to contents
-
-
-
-
-
- Population scenario to use as an input to run_fredi()
and run_fredi_sv()
- Source: R/data.R
- popScenario.Rd
-
-
-
- A dataframe containing a population scenario to be passed as an input to run_fredi()
and run_fredi_sv()
.
-
-
-
-
-
- Format
- A data frame with 14,259 rows and 5 columns:
- year
-Year
-
-- region
-Region of U.S. ("Midwest", "Northeast", "Northern Plains", "Northwest", "Southeast", "Southern Plains", and "Southwest")
-
-- state
-One of 48 contiguous U.S. states or the District of Columbia
-
-- postal
-Postal code abbreviation associated with the state
-
-- state_pop
-State population for associated region and year
-
-
-
-
-
- Details
- This dataframe contains population projections at the state level from the Integrated Climate and Land Use Scenarios version 2 (ICLUSv2) model (Bierwagen et al, 2010; EPA 2017) under the Median variant projection of United Nations (2015).
-Bierwagen, B., D. M. Theobald, C. R. Pyke, A. Choate, P. Groth, J. V. Thomas, and P. Morefield. 2010. “National housing and impervious surface scenarios for integrated climate impact assessments.” Proc. Natl. Acad. Sci. 107 (49): 20887–20892. https://doi.org/10.1073/pnas.1002096107.
-EPA. 2017. Multi-Model Framework for Quantitative Sectoral Impacts Analysis: A technical report for the Fourth National Climate Assessment. U.S. Environmental Protection Agency, EPA 430-R-17-001.
-United Nations. 2015. World population prospects: The 2015 revision. New York: United Nations, Department of Economic and Social Affairs, Population Division.
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/reference/run_fredi.html b/docs/reference/run_fredi.html
index 09824b88..c5388b5f 100644
--- a/docs/reference/run_fredi.html
+++ b/docs/reference/run_fredi.html
@@ -12,7 +12,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -79,7 +79,7 @@
Usage
run_fredi(
- inputsList = list(tempInput = NULL, slrInput = NULL, gdpInput = NULL, popInput = NULL),
+ inputsList = list(temp = NULL, slr = NULL, gdp = NULL, pop = NULL),
sectorList = NULL,
aggLevels = c("national", "modelaverage", "impactyear", "impacttype"),
elasticity = 1,
@@ -93,8 +93,8 @@ Usage
Arguments
- - inputsList=NULL
-A list of named elements named elements (names(inputsList) = c("tempInput", "slrInput", "gdpInput", "popInput")
), each containing data frames of custom temperature, global mean sea level rise (GMSL), gross domestic product (GDP), and/or state-level population trajectories, respectively, over a continuous period in the range 2010 to 2300. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population and GDP scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
+ - inputsList=list(gdp=NULL, pop=NULL, temp=NULL, slr=NULL)
+A list with named elements (gdp
, pop
, temp
, and/or slr
), each containing data frames of custom scenarios for gross domestic product (GDP), state-level population, temperature, and/or global mean sea level rise (GMSL) trajectories, respectively, over a continuous period. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population and GDP scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
- sectorList=NULL
@@ -144,40 +144,40 @@ Value
Details
This function allows users to project annual average climate change impacts through 2300 (2010-2300) for available sectors. run_fredi()
is the main function in the FrEDI R package, described elsewhere (See https://epa.gov/cira/FrEDI for more information).
-Users can specify an optional list of custom scenarios with inputsList
(for more information on the format of inputs, see import_inputs()
). The function import_inputs()
can be used to importing custom scenarios from CSV files. import_inputs()
returns a list with elements tempInput
, slrInput
, gdpInput
, and popInput
, with each containing a data frame with a custom scenario for temperature, GMSL, GDP, and state-level population, respectively. If a user imports scenarios using import_inputs()
, they can pass the outputs of import_inputs()
directly to the run_fredi()
argument inputsList
. Note that the documentation for import_inputs()
can also provide additional guidance and specification on the formats for each scenario type.
-If inputsList = NULL
, run_fredi()
uses defaults for temperature, SLR, GDP, and population. Otherwise, run_fredi()
looks for a list object passed to the argument inputsList
. Within that list, run_fredi()
looks for list elements tempInput
, slrInput
, gdpInput
, and popInput
containing data frames with custom scenarios for temperature, GMSL, GDP, and state population, respectively. run_fredi()
will default back to the default scenarios for any list elements that empty or NULL
(in other words, running run_fredi(inputsList = list())
returns the same outputs as running run_fredi()
).
Temperature Inputs. The input temperature scenario requires CONUS temperatures in degrees Celsius relative to 1995 (degrees of warming relative to the baseline year--i.e., the central year of the 1986-2005 baseline). CONUS temperature values must be greater than or equal to zero degrees Celsius.
Users can convert global temperatures to CONUS temperatures using convertTemps(from = "global")
(or by specifying import_inputs(temptype = "global")
when using import_inputs()
to import a temperature scenario from a CSV file).
-tempInput
requires a data frame object with two columns with names "year"
, and "temp_C"
containing the year and CONUS temperatures in degrees Celsius, respectively.
-Temperature inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for temperature (i.e., inputsList = list(tempInput = NULL)
, run_fredi()
uses a default temperature scenario.
-
-SLR Inputs. The input SLR scenario requires values for changes in global mean sea level rise (GMSL) heights in centimeters (cm). GMSL heights must be greater than or equal to zero.
slrInput
requires a data frame object with two columns with names "year"
, "slr_cm"
containing the year and global mean sea level rise (GMSL) in centimeters, respectively.
-SLR inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for SLR (i.e., inputsList = list(slrInput = NULL)
, run_fredi()
first converts the input or default CONUS temperature scenario to global temperatures (using convertTemps()
) and then converts the global temperatures to a global mean sea level rise (GMSL) height in centimeters (using temps2slr()
).
-
-GDP Inputs. The input scenario for gross domestic product (GDP) requires national GDP values in 2015$. GDP values must be greater than or equal to zero.
gdpInput
requires a data frame object with two columns with names "year"
, and "gdp_usd"
containing the year and the national GDP, respectively. GDP values must be greater than or equal to zero.
+Users can specify an optional list of custom scenarios with inputsList
(for more information on the format of inputs, see import_inputs()
). The function import_inputs()
can be used to importing custom scenarios from CSV files. import_inputs()
returns a list with named elements gdp
, pop
, temp
, and slr
, with each containing a data frame with a custom scenario for GDP, state-level population, temperature, and/or GMSL respectively. If a user imports scenarios using import_inputs()
, they can pass the outputs of import_inputs()
directly to the run_fredi()
argument inputsList
. Note that the documentation for import_inputs()
can also provide additional guidance and specification on the formats for each scenario type.
+Otherwise, run_fredi()
looks for a list object passed to the argument inputsList
. Within that list, run_fredi()
looks for named list elements -- gdp
, pop
, temp
, and/or slr
-- each containing a data frame with a custom scenario for GDP, state population, temperature, and/or GMSL, respectively. If inputsList = NULL
or inputsList = list()
(default), run_fredi()
uses default trajectories for GDP, population, temperature, and SLR (see gdpDefault, popDefault, and gcamScenarios for more information). run_fredi()
will default back to the default scenarios for any list elements that empty or NULL
(in other words, running run_fredi(inputsList = list())
returns the same outputs as running run_fredi()
).
GDP Inputs. The input scenario for gross domestic product (GDP) requires national GDP values in 2015$. GDP values must be greater than or equal to zero.
gdp
requires a data frame object with two columns with names "year"
, and "gdp_usd"
containing the year and the national GDP, respectively. GDP values must be greater than or equal to zero.
GDP inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for GDP (i.e., inputsList = list(gdpInput = NULL)
, run_fredi()
uses a default GDP scenario.
+If the user does not specify an input scenario for GDP (i.e., inputsList = list(gdp = NULL)
, run_fredi()
uses a default GDP scenario.
-Population Inputs. The input population scenario requires state-level population values. Population values must be greater than or equal to zero.
popInput
requires a data frame object with five columns with names "region"
, "state"
, "postal"
, "year"
, and "state"
containing the year, the NCA region name, the state name, the postal code abbreviation for the state, and the state population, respectively.
+Population Inputs. The input population scenario requires state-level population values. Population values must be greater than or equal to zero.
pop
requires a data frame object with five columns with names "region"
, "state"
, "postal"
, "year"
, and "pop"
containing the year, the NCA region name (one of "Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
), the state name, the postal code abbreviation for the state, and the state population, respectively.
Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for population (i.e., inputsList = list(popInput = NULL)
, run_fredi()
uses a default population scenario.
+If the user does not specify an input scenario for population (i.e., inputsList = list(pop = NULL)
, run_fredi()
uses a default population scenario.
+
+Temperature Inputs. The input temperature scenario requires CONUS temperatures in degrees Celsius relative to 1995 (degrees of warming relative to the baseline year--i.e., the central year of the 1986-2005 baseline). CONUS temperature values must be greater than or equal to zero degrees Celsius.
Users can convert global temperatures to CONUS temperatures using convertTemps(from = "global")
(or by specifying import_inputs(temptype = "global")
when using import_inputs()
to import a temperature scenario from a CSV file).
+temp
requires a data frame object with two columns with names "year"
, and "temp_C"
containing the year and CONUS temperatures in degrees Celsius, respectively.
+Temperature inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+If the user does not specify an input scenario for temperature (i.e., inputsList = list(temp = NULL)
, run_fredi()
uses a default temperature scenario.
+
+SLR Inputs. The input SLR scenario requires values for changes in global mean sea level rise (GMSL) heights in centimeters (cm). GMSL heights must be greater than or equal to zero.
slr
requires a data frame object with two columns with names "year"
, "slr_cm"
containing the year and global mean sea level rise (GMSL) in centimeters, respectively.
+SLR inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+If the user does not specify an input scenario for SLR (i.e., inputsList = list(slr = NULL)
, run_fredi()
first converts the input or default CONUS temperature scenario to global temperatures (using convertTemps()
) and then converts the global temperatures to a global mean sea level rise (GMSL) height in centimeters (using temps2slr()
).
-
run_fredi()
linearly interpolates missing annual values for all input scenarios using non-missing values (each scenario requires at least two non-missing values as detailed above for each scenario type). After interpolation of the input scenarios, run_fredi()
subsets the input scenarios to values within the analysis period.
Temperatures are interpolated using 1995 as the baseline year (i.e., the central year of the 1986-2005 baseline) and GMSL is interpolated using 2000 as the baseline year. In other words, temperature (in degrees Celsius) is set to zero for the year 1995, whereas GMSL is set to zero for the year 2000. The interpolated temperature and GMSL scenarios are combined into a column called driverValue
, along with additional columns for year, the driver unit (column "driverUnit"
, with driverUnit = "degrees Celsius"
and driverUnit = "cm"
for temperature- and SLR-driven sectors, respectively), and the associated model type (column "model_type"
, with model_type = "GCM"
and model_type = "SLR"
for temperature- and SLR-driven sectors, respectively
-run_fredi()
calculations national population from state-level values and then calculates GDP per capita from values for GDP and national population. Values for state population, national population, national GDP (in 2015$), and national per capita GDP (in 2015$/capita) are provided in the results data frame in columns "state_pop"
, "national_pop"
, "gdp_usd"
, and "gdp_percap"
, respectively.
+
run_fredi()
linearly interpolates missing annual values for all input scenarios using non-missing values (each scenario requires at least two non-missing values as detailed above for each scenario type). After interpolation of the input scenarios, run_fredi()
subsets the input scenarios to values within the analysis period.
Temperatures are interpolated using 1995 as the baseline year (i.e., the central year of the 1986-2005 baseline) and GMSL is interpolated using 2000 as the baseline year. In other words, temperature (in degrees Celsius) is set to zero for the year 1995, whereas GMSL is set to zero for the year 2000. The interpolated temperature and GMSL scenarios are combined into a column called driverValue
, along with additional columns for year, the driver unit (column "driverUnit"
, with driverUnit = "degrees Celsius"
and driverUnit = "cm"
for temperature- and SLR-driven sectors, respectively), and the associated model type (column "model_type"
, with model_type = "GCM"
and model_type = "SLR"
for temperature- and SLR-driven sectors, respectively.
+run_fredi()
calculates national population from state-level values and then calculates GDP per capita from values for GDP and national population. Values for state population, national population, national GDP (in 2015$), and national per capita GDP (in 2015$/capita) are provided in the results data frame in columns "pop"
, "national_pop"
, "gdp_usd"
, and "gdp_percap"
, respectively.
By default, run_fredi()
will calculate impacts for all sectors included in the tool. Alternatively, users can pass a character vector specifying a single sector or a subset of sectors using the sectorList
argument. To see a list of sectors included within FrEDI, run get_sectorInfo()
. If sectorList = NULL
(default), all sectors are included.
By default, run_fredi()
calculates impacts starting in the year 2010 and ending in 2100. Specify an alternative end year for the analysis using the maxYear
argument. maxYear
has a default value of 2100
and minimum and maximum values of 2011
and 2300
, respectively. Alternatively, users can set argument thru2300 = TRUE
to override the maxYear
argument and set maxYear = 2300
. Note that the default scenarios included within FrEDI stop in the year 2100; users must provide custom input scenarios out to the desired end year and specify a maxYear >= 2100
(and maxYear <= 2300
) in order to return non-missing values for years after 2100.
Annual impacts for each sector, variant, impact type, and impact year combination included in the model are calculated by multiplying scaled climate impacts by a physical scalar and economic scalars and multipliers. Some sectors use Value of a Statistical Life (VSL) to adjust the value non-linearly over time. run_fredi()
uses a default value of elasticity = 1
to adjust VSL for applicable sectors and impacts (the default value of elasticity = 1
keeps VSL constant over time). A custom elasticity can be passed to the elasticity
argument. Applicable sectors and impacts are *Climate-Driven Changes in Air Quality (all impact types), ATS Temperature-Related Mortality (impactType = "N/A"
; i.e., all impact types), CIL Temperature-Related Mortality, Extreme Temperature (all impact types), Suicide (impactType = "N/A"
; i.e., all impact types), Southwest Dust (impactType = "All Mortality"
), Valley Fever (impactType = "Mortality"
), Vibriosis (impactType = "N/A"
; i.e., all impact types), and Wildfire (impactType = "Mortality"
).
run_fredi()
aggregates or summarizes results to level(s) of aggregation specified by the user (passed to aggLevels
) using the post-processing helper function aggregate_impacts()
. Users can specify all aggregation levels at once by specifying aggLevels = "all"
(default) or no aggregation levels (aggLevels = "none"
). Users can specify a single aggregation level or multiple aggregation levels by passing a single character string or character vector to aggLevels
. Options for aggregation include calculating national totals (aggLevels = "national"
), averaging across model types and models (aggLevels = "modelaverage"
), summing over all impact types (aggLevels = "impacttype"
), and interpolating between impact year estimates (aggLevels = "impactYear"
).
-If the user specifies aggLevels = "none"
, run_fredi()
returns a data frame with columns: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, "state_pop"
, "year"
, "physical_impacts"
, and "annual_impacts"
.
Columns "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, and "model"
all contain observation identifiers (sector name, variant, impact type, impact year, region, state, state postal code abbreviation, model type, and model, respectively).
+If the user specifies aggLevels = "none"
, run_fredi()
returns a data frame with columns: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, "pop"
, "year"
, "physical_impacts"
, and "annual_impacts"
.
Columns "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, and "model"
all contain observation identifiers (sector name, variant, impact type, impact year, region, state, state postal code abbreviation, model type, and model, respectively).
Columns "sectorprimary"
and "includeaggregate"
contain values that provide information about how to treat sectors and when aggregating over sectors (e.g., summing impacts across sectors). Note that FrEDI does not currently provide functionality to aggregate over sectors; this information is provided for user convenience.
Column "sectorprimary"
contains values indicating which variant to use as the primary one for each sector: sectorprimary = 1
for primary variants and sectorprimary = 0
for non-primary variants. When aggregating impacts over sectors, users should filter the outputs of run_fredi()
to variants with sectorprimary == 1
.
Column "includeaggregate"
contains values that provide information about how to treat sectors when aggregating over sectors (e.g., summing impacts across sectors). Sectors that have a value of includeaggregate == 0
should be dropped when aggregating results over sectors, to avoid potential double-counting of impacts for similar sectors. For instance, sectors ATS Temperature-Related Mortality, CIL Temperature-Related Mortality, and Extreme Temperature have values for temperature-related mortality. To avoid double counting, outputs of run_fredi()
should be filtered to values for which includeaggregate > 0
. Sectors with a value of includeaggregate > 0
can be included when aggregating over sectors; most sectors with a value of includeaggregate > 0
will have a value of includeaggregate = 1
. Values of includeaggregate > 1
flag additional information about sectors; currently, only the Suicide sector has a value of includeaggregate > 1
, with a value of includeaggregate = 2
. This flag indicates that the impacts from Suicide can be included when summing values across sectors, but may have some overlap with impacts from ATS Temperature-Related Mortality. For more information about the potential overlap between impacts for ATS Temperature-Related Mortality and Suicide, visit the technical documentation at https://epa.gov/cira/FrEDI/,
Columns "driverType"
, "driverUnit"
, and "driverValue"
contain information about the temperature and SLR scenarios.
-Columns "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "state_pop"
contain information about the GDP and population scenarios.
+Columns "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "pop"
contain information about the GDP and population scenarios.
Columns "physicalmeasure"
and "physical_impacts"
contain information about physical impacts.
Column "annual_impacts"
contains information on the economic value associated with annual impacts.
If the user specifies aggLevels = "all"
or other combinations of aggregation levels, run_fredi()
passes the results data frame and the aggLevels
argument to the aggregate_impacts()
function. aggregate_impacts()
then performs the following calculations, using the default grouping columns for the aggregate_impacts()
: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, and "year"
(note that the "variant"
column referred to below contains information about the variant name (or “N/A”
), as applicable).
-Aggregation Level Description impactyear
To aggregate over impact years, aggregate_impacts()
first separates results for sectors with only one impact year estimate (i.e., impactYear = "N/A"
) from from observations with multiple impact year estimates (i.e., sectors with results for both impactYear = "2010"
and impactYear = "2090"
). For these sectors with multiple impact years, physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
) are linearly interpolated between impact year estimates. For any model run years above 2090, annual results for sectors with multiple impact years return the 2090 estimate. The interpolated values are then row-bound to the results for sectors with a single impact year estimate, and column impactYear
set to impactYear = "Interpolation"
for all values. If "impactyear"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
aggregates over impact years before performing other types of aggregation. modelaverage
To aggregate over models for temperature-driven sectors, aggregate_impacts()
averages physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all GCM models present in the data. aggregate_impacts()
drops the column "model"
from the grouping columns when averaging over models. Averages exclude observations with missing values. However, If all values within a grouping are missing, the model average is set to NA
. The values in column "model"
are set to "Average"
for model averages and the model averages data frame is then row-bound to the main results data frame. For SLR-driven sectors, there is no need for additional model aggregation; these values already have model = "Interpolation"
. If "modelaverage"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years (if "impactyear"
present in aggLevels
or if aggLevels = "all"
) before aggregating over models. national
To aggregate values to the national level, aggregate_impacts()
sums physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all states present in the data. aggregate_impacts()
drops the columns "region"
, "state"
, and "postal"
when summing over states and regions. Years which have missing column data for all regions return as NA
. Values for columns "region"
, "state"
, and "postal"
are set to "National Total"
, All
, and US
, respectively. The data frame with national totals is then row-bound to the main results data frame. If "national"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years and/or models (if "impactyear"
and/or "modelaverage"
are present in aggLevels
or if aggLevels = "all"
) before aggregating over models. impacttype
To aggregate values over impact types, aggregate_impacts()
sums annual impacts (column "annual_impacts"
) across all impact types for each sector. aggregate_impacts()
drops the column "impactType"
and "physicalmeasure"
from the grouping columns when summing over impact types. Years which have missing column data for all impact types return as NA
. All values in column "impactType"
are set to "all"
. Aggregating over impact types, drops columns related to physical impacts (i.e., columns "physicalmeasure"
and "physical_impacts"
). These columns are dropped since aggregating over impact types for some sectors requires summing costs over different types of physical impacts, so reporting the physical impacts would be nonsensical.
After aggregating values, aggregate_impacts()
joins the data frame of impacts with information about "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "state_pop"
.
+Aggregation Level Description impactyear
To aggregate over impact years, aggregate_impacts()
first separates results for sectors with only one impact year estimate (i.e., impactYear = "N/A"
) from from observations with multiple impact year estimates (i.e., sectors with results for both impactYear = "2010"
and impactYear = "2090"
). For these sectors with multiple impact years, physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
) are linearly interpolated between impact year estimates. For any model run years above 2090, annual results for sectors with multiple impact years return the 2090 estimate. The interpolated values are then row-bound to the results for sectors with a single impact year estimate, and column impactYear
set to impactYear = "Interpolation"
for all values. If "impactyear"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
aggregates over impact years before performing other types of aggregation. modelaverage
To aggregate over models for temperature-driven sectors, aggregate_impacts()
averages physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all GCM models present in the data. aggregate_impacts()
drops the column "model"
from the grouping columns when averaging over models. Averages exclude observations with missing values. However, If all values within a grouping are missing, the model average is set to NA
. The values in column "model"
are set to "Average"
for model averages and the model averages data frame is then row-bound to the main results data frame. For SLR-driven sectors, there is no need for additional model aggregation; these values already have model = "Interpolation"
. If "modelaverage"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years (if "impactyear"
present in aggLevels
or if aggLevels = "all"
) before aggregating over models. national
To aggregate values to the national level, aggregate_impacts()
sums physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all states present in the data. aggregate_impacts()
drops the columns "region"
, "state"
, and "postal"
when summing over states and regions. Years which have missing column data for all regions return as NA
. Values for columns "region"
, "state"
, and "postal"
are set to "National Total"
, All
, and US
, respectively. The data frame with national totals is then row-bound to the main results data frame. If "national"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years and/or models (if "impactyear"
and/or "modelaverage"
are present in aggLevels
or if aggLevels = "all"
) before aggregating over models. impacttype
To aggregate values over impact types, aggregate_impacts()
sums annual impacts (column "annual_impacts"
) across all impact types for each sector. aggregate_impacts()
drops the column "impactType"
and "physicalmeasure"
from the grouping columns when summing over impact types. Years which have missing column data for all impact types return as NA
. All values in column "impactType"
are set to "all"
. Aggregating over impact types, drops columns related to physical impacts (i.e., columns "physicalmeasure"
and "physical_impacts"
). These columns are dropped since aggregating over impact types for some sectors requires summing costs over different types of physical impacts, so reporting the physical impacts would be nonsensical.
After aggregating values, aggregate_impacts()
joins the data frame of impacts with information about "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "pop"
.
If outputList = FALSE
(default), run_fredi()
returns a data frame of annual average impacts over the analysis period, for each sector, variant, impact type, impact year, region, state, model type ("GCM"
or "SLR"
), and model. If outputList = TRUE
, in addition to the data frame of impacts, run_fredi()
returns a list object containing information about values for function arguments, driver scenarios, and population and GDP scenarios.
@@ -190,16 +190,15 @@ Examples### Load FrEDI
require(FrEDI)
-### Run function with defaults (same as `defaultResults` dataset)
+### Run function with defaults
run1 <- run_fredi()
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from defaults...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -207,62 +206,71 @@ Examplesdata("gcamScenarios")
gcamScenarios |> glimpse()
#> Rows: 606
-#> Columns: 4
-#> $ year <int> 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2…
-#> $ temp_C <dbl> 0.1269649, 0.1575513, 0.1858310, 0.2101611, 0.2306551, 0.2444…
-#> $ slr_cm <dbl> 0.0000000, 0.2727356, 0.5552278, 0.8458496, 1.1430287, 1.4440…
-#> $ scenario <chr> "Hector_GCAM_v5.3_ECS_3.0_REF", "Hector_GCAM_v5.3_ECS_3.0_REF…
+#> Columns: 6
+#> $ year <int> 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20…
+#> $ temp_C_conus <dbl> 0.1804171, 0.2238804, 0.2640659, 0.2986389, 0.3277609, 0…
+#> $ temp_C_global <dbl> 0.1269649, 0.1575513, 0.1858310, 0.2101611, 0.2306551, 0…
+#> $ slr_cm <dbl> 0.0000000, 0.2727356, 0.5552278, 0.8458496, 1.1430287, 1…
+#> $ scenario <chr> "ECS_3.0_REF", "ECS_3.0_REF", "ECS_3.0_REF", "ECS_3.0_RE…
+#> $ model <chr> "Hector_GCAM_v5.3", "Hector_GCAM_v5.3", "Hector_GCAM_v5.…
### Load population scenario and glimpse data
-data(popScenario)
-popScenario |> glimpse()
+data("popDefault")
+popDefault |> glimpse()
#> Rows: 14,259
#> Columns: 5
-#> $ year <dbl> 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, …
#> $ region <chr> "Southeast", "Southeast", "Southeast", "Southeast", "Southea…
#> $ state <chr> "Alabama", "Alabama", "Alabama", "Alabama", "Alabama", "Alab…
#> $ postal <chr> "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", …
+#> $ year <int> 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, …
#> $ state_pop <dbl> 4779736, 4823623, 4867509, 4911396, 4955282, 4999169, 503604…
### Subset climate scenario
-temps1 <- gcamScenarios |> filter(scenario=="Hector_GCAM_v5.3_ECS_3.0_ref")
-temps1 <- temps1 |> mutate(temp_C = temp_C_global |> convertTemps(from="global"))
-#> Error in mutate(temps1, temp_C = convertTemps(temp_C_global, from = "global")): ℹ In argument: `temp_C = convertTemps(temp_C_global, from = "global")`.
-#> Caused by error:
-#> ! object 'temp_C_global' not found
-temps1 <- temps1 |> select(year, temp_C)
+temps1 <- gcamScenarios |> filter(scenario=="ECS_3.0_ref")
+temps1 <- temps1 |> select(year, temp_C_conus)
### Run custom scenario
-run2 <- run_fredi(inputsList=list(tempInput=temps1, popInput=popScenario))
-#> Checking input values...
-#> Creating temperature scenario from user inputs...
-#> Error in map(regions0, function(region_i) { df_i <- filter(data, region == region_i) x_i <- df_i[["year"]] y_i <- df_i[[column0]] new_i <- approx(x = x_i, y = y_i, xout = years, rule = rule, method = method) new_i <- as_tibble(new_i) new_i <- rename_at(new_i, c(cols0), ~cols1) new_i <- mutate(new_i, region = region_i) return(new_i)}): ℹ In index: 1.
-#> Caused by error in `approx()`:
-#> ! need at least two non-NA values to interpolate
+run2 <- run_fredi(inputsList=list(temp=temps1, pop=popDefault))
+#> Checking scenarios...
+#>
+#> Checking input values for pop inputs...
+#> Column "pop" not found in popfile data!
+#> Looking for columns with matches to the string "pop"...1 match found!
+#> Using column "", and renaming to "pop"...
+#> Data is missing the following required columns: state_pop!
+#> Dropping pop inputs from outputs.
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
+#>
+#> Finished.
### Load scenarios from file:
scenariosPath <- system.file(package="FrEDI") |> file.path("extdata","scenarios")
scenariosPath |> list.files()
-#> [1] "GCAM_scenario.csv" "State ICLUS Population.csv"
-#> [3] "slr_from_GCAM.csv"
+#> [1] "gcamDefault.csv" "gcamScenarios.csv" "gdpDefault.csv"
+#> [4] "popDefault.csv"
### SLR Scenario File Name
-slrInputFile <- scenariosPath |> file.path("slr_from_GCAM.csv")
+slrInputFile <- scenariosPath |> file.path("gcamDefault.csv")
### Population Scenario File Name
-popInputFile <- scenariosPath |> file.path("State ICLUS Population.csv")
+popInputFile <- scenariosPath |> file.path("popDefault.csv")
### Import inputs
-x_inputs <- import_inputs(slrfile=slrInputFile, popfile=popInputFile, popArea="state")
+x_inputs <- import_inputs(inputsList=list(slr=slrInputFile, pop=popInputFile), popArea="state")
#>
#> In import_inputs():
#> Loading data...
#> User specified slrfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/slr_from_GCAM.csv...
+#> Importing data from C:/Users/knoiva/AppData/Local/R/win-library/4.4/FrEDI/extdata/scenarios/gcamDefault.csv...
#> Data loaded.
#> User specified popfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/State ICLUS Population.csv...
+#> Importing data from C:/Users/knoiva/AppData/Local/R/win-library/4.4/FrEDI/extdata/scenarios/popDefault.csv...
#> Data loaded.
#>
#> Checking input values...
@@ -271,23 +279,37 @@ Examples#> Values passed.
#>
#> Checking input values for pop inputs...
-#> Column "pop" not found in popfile data!
-#> Looking for columns with matches to the string "pop"...1 match found!
-#> Using column "state_pop", and renaming to "state_pop"...
+#> Checking that all states, etc. are present...
+#>
+#> Checking inputs for unique regions, states...
+#> All regions present...
+#> All states present...
#> Values passed.
#>
#> Finished.
### Run custom scenarios
run3 <- run_fredi(inputsList=x_inputs)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
+#> Checking scenarios...
+#>
+#> Checking input values for slr inputs...
+#> Values passed.
+#>
+#> Checking input values for pop inputs...
+#> Checking that all states, etc. are present...
+#>
+#> Checking inputs for unique regions, states...
+#> All regions present...
+#> All states present...
+#> Values passed.
#> Creating SLR scenario from user inputs...
-#> No GDP scenario provided...Using default GDP scenario...
#> Creating population scenario from user inputs...
-#> Updating scalars...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -321,32 +343,37 @@ Examples
### Run for a single sector, with default inputs, no aggregation, and elasticity=1:
run4 <- run_fredi(sectorList="ATS Temperature-Related Mortality", aggLevels="none", elasticity=1)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from defaults...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
#> Formatting results...
#>
#> Finished.
### Set end year for analysis to 2110 -- messages user and returns a null value since default scenarios only have values out to 2100
run5 <- run_fredi(maxYear=2110)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Temperature scenario must have at least one non-missing value in or after the year 2110...
+#> Checking scenarios...
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
#>
-#> Exiting...
+#> Finished.
### Set end year for analysis to 2300 -- messages user and returns a null value since default scenarios only have values out to 2100)
run6 <- run_fredi(thru2300=TRUE)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Temperature scenario must have at least one non-missing value in or after the year 2300...
+#> Checking scenarios...
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
#>
-#> Exiting...
+#> Finished.
@@ -358,11 +385,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/run_fredi_sv.html b/docs/reference/run_fredi_sv.html
index 082f5c36..f234cad7 100644
--- a/docs/reference/run_fredi_sv.html
+++ b/docs/reference/run_fredi_sv.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -77,8 +77,7 @@
Usage
run_fredi_sv(
sector = NULL,
- driverInput = NULL,
- popInput = NULL,
+ inputsList = list(pop = NULL, temp = NULL, slr = NULL),
silent = TRUE,
.testing = FALSE
)
@@ -90,22 +89,22 @@ Argumentsget_sv_sectorInfo() for a list of available sectors).
-- driverInput
-A data frame of up to four custom scenarios for drivers (temperature or global mean sea level rise). driverInput
requires a data frame with columns of "year"
and "scenario"
. The data frame must also include a third column: "temp_C"
for temperature-driven sectors (containing temperature values in degrees Celsius of warming for the contiguous U.S.) or "slr_cm"
for sea level rise (SLR)-driven sectors (containing values for global mean sea level rise in centimeters). Run get_sv_sectorInfo(gcmOnly=TRUE)
to see temperature-driven sectors in the SV module and get_sv_sectorInfo(slrOnly=TRUE)
to see SLR-driven scenarios. Users can also pass a data frame with all four columns ("year"
, "scenario"
, "temp_C"
, and "slr_cm"
), in which case run_fredi_sv()
determines whether to use the "temp_C"
or "slr_cm"
column as the driver trajectory based on the specified sector. Driver inputs for all scenarios should start in the year 2000 or earlier. All scenarios must include at least two non-missing values (especially values before or at 2000 and at or after 2100). If any required columns are missing, run_fredi_sv()
will use the default temperature or sea level rise scenario from run_fredi()
. If the data frame passed to driverInput
has more than four unique scenarios, run_fredi_sv()
will only run the first four scenarios.
+- silent
+A logical (TRUE/FALSE
) value indicating the level of messaging desired by the user (defaults to silent=TRUE
)
-- popInput
-The input population scenario requires a data frame object with a single scenario of state-level population values.
The population scenario must have five columns with names "year"
, "region"
, "state"
, "postal"
, and "state_pop"
containing the year, the NCA region name, the state name, the postal code abbreviation (e.g., "ME" for "Maine") for the state, and the state population, respectively.
-popInput
only accepts a a single scenario, in contrast to driverInput
. In other words, run_fredi_sv()
uses the same population scenario for any and all driver scenarios passed to driverInput
.
-If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario.
+- inputsList=list(pop=NULL, temp=NULL, slr=NULL)
+A list with named elements (pop
, temp
, and/or slr
), each containing data frames of custom scenarios for state-level population, temperature, and/or global mean sea level rise (GMSL) trajectories, respectively, over a continuous period. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
pop. The input population scenario requires a data frame object with a single scenario of population values for each of the 48 U.S. states and the District of Columbia comprising the contiguous U.S. (CONUS).
The population scenario must have five columns with names "region"
, "state"
, "postal"
, "year"
, and "_pop"
containing the NCA region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
), the state name, the two-letter postal code abbreviation for the state (e.g., "ME"
for Maine), the year, and the state population, respectively.
+The input population scenario can only contain a single scenario, in contrast to values for temperature or SLR inputs. In other words, run_fredi_sv()
uses the same population scenario when running any and all of the temperature or SLR scenarios passed to run_fredi_sv()
.
+If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario (see documentation for popScenario).
Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (2100).
Population values must be greater than or equal to zero.
+
+temp or slr. The input temperature or SLR scenario should be a data frame containing one or more custom scenarios. These inputs should be formulated similarly to those for run_fredi()
and import_inputs()
, with an additional column (scenario
) indicating the unique scenario identifier. Temperature and/or SLR input scenarios must have at least one non-missing value in the year 2000 or earlier and at least one non-missing value in or after the final analysis year (2100).
temp. Temperature inputs are used by run_fredi_sv()
with temperature-driven sectors; run get_sv_sectorInfo(gcmOnly=TRUE)
to get a list of the temperature-driven sectors available for the SV module. Temperature inputs require a data frame with columns of year
, temp_C
, and scenario
, respectively containing the year associated with an observation, temperature values for CONUS in degrees Celsius of warming relative to a 1995 baseline (where 1995 is the central year of a 1986-2005 baseline period -- i.e., values should start at zero in the year 1995), and a unique scenario identifier. If no temperature scenario is specified (i.e., inputsList$temp
is NULL
) when running a temperature-driven sector, run_fredi_sv()
will use a default temperature scenario (see FrEDI:gcamScenarios).
+slr. SLR inputs are used by run_fredi_sv()
with sea level rise-driven sectors; run get_sv_sectorInfo(slrOnly=TRUE)
to get a list of the SLR-driven sectors available for the SV module. SLR inputs require a data frame with columns of year
, slr_cm
, and scenario
, respectively containing the global mean sea level rise in centimeters relative to a 2000 baseline (i.e., values should start at zero in the year 2000), and a unique scenario identifier. If no SLR scenario is specified (i.e., inputsList$slr
is NULL
) when running a temperature-driven sector: if a user has supplied a temperature scenario (i.e., inputsList$temp
is not NULL
), run_fredi_sv()
will calculate sea level rise values from the temperature inputs using the temps2slr()
function; if no temperature scenario is provided, run_fredi_sv
will use a default SLR scenario (see FrEDI:gcamScenarios).
+
-
-- silent
-A logical (TRUE/FALSE
) value indicating the level of messaging desired by the user (defaults to silent=TRUE
).
-
Value
@@ -117,17 +116,8 @@ Value
Details
run_fredi_sv()
projects annual climate change impacts for socially vulnerable (SV) populations throughout the 21st century (2010-2100) for available sectors, using default or user-specified population, temperature, and sea level rise (SLR) trajectories. run_fredi_sv()
is the main function for the FrEDI Social Vulnerability (SV) module in the FrEDI R package, described elsewhere (See https://epa.gov/cira/FrEDI for more information). The SV module extends the FrEDI framework to socially vulnerable populations using data underlying a 2021 U.S. Environmental Protection Agency (EPA) report on Climate Change and Social Vulnerability in the United States.
Users can run run_fredi_sv()
to generate annual physical impacts for SV groups for individual sectors. When running run_fredi_sv()
, users must specify one of the sectors in the SV module; use get_sv_sectorInfo()
for a list of available sectors.
-run_fredi_sv()
can be run with default population and climate (temperature and SLR) trajectories or use run_fredi_sv()
to run custom scenarios. Running run_fredi_sv()
with custom climate scenarios requires passing a data frame of scenarios to the driverInput
argument. run_fredi_sv()
can also be run with a custom population scenario by passing a data frame of regional population trajectories to the popInput
argument; unlike climate scenarios, run_fredi_sv()
will only run a single scenario at a time.
driverInput
can take a data frame containing up to four custom scenarios for drivers (temperature or global mean sea level rise). driverInput
requires a data frame with columns of "year"
and "scenario"
. The data frame must also include a third column: "temp_C"
for temperature-driven sectors (containing temperature values in degrees Celsius of warming for the contiguous U.S.) or "slr_cm"
for sea level rise (SLR)-driven sectors (containing values for global mean sea level rise in centimeters). Run get_sv_sectorInfo(gcmOnly = TRUE)
to see temperature-driven sectors in the SV module and get_sv_sectorInfo(slrOnly = TRUE)
to see SLR-driven scenarios. Users can also pass a data frame with all four columns ("year"
, "scenario"
, "temp_C"
, and "slr_cm"
), in which case run_fredi_sv()
determines whether to use the "temp_C"
or "slr_cm"
column as the driver trajectory based on the specified sector. If any required columns are missing, run_fredi_sv()
will use the default temperature or sea level rise scenario from run_fredi()
. If the data frame passed to driverInput
has more than four unique scenarios, run_fredi_sv()
will only run the first four scenarios.
Temperature inputs must be temperature change in degrees Celsius for the contiguous U.S. (use convertTemps()
to convert global temperatures to CONUS temperatures before passing to driverInput
) relative to a 1995 baseline (where 1995 is the central year of a 1986-2005 baseline period; values should start at zero in the year 1995).
-Sea level rise inputs must be in centimeters relative to a 2000 baseline (i.e., values should start at zero in the year 2000). Driver inputs for all scenarios should start in the year 2000 or earlier. All scenarios must include at least two non-missing values (especially values before or at 2000 and at or after 2100).
-
-The input population scenario requires a data frame object with a single scenario of state-level population values.
The population scenario must have five columns with names "year"
, "region"
, "state"
, "postal"
, and "state_pop"
containing the year, the NCA region name, the state name, the postal code abbreviation (e.g., "ME" for "Maine") for the state, and the state population, respectively.
-popInput
only accepts a a single scenario, in contrast to driverInput
. In other words, run_fredi_sv()
uses the same population scenario for any and all driver scenarios passed to driverInput
.
-If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario.
-Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (2100).
-Population values must be greater than or equal to zero.
-The default regional population scenario is drawn from the Integrated Climate and Land Use Scenarios version 2 (ICLUSv2) model (Bierwagen et al, 2010; EPA 2017) under the Median variant projection of United Nations (United Nations, 2015). Note that the FrEDI SV default population scenario differs from the default population scenario used by run_fredi()
.
-
-
The output of run_fredi_sv()
is an R data frame object containing average annual physical impacts for socially vulnerable groups, at the NCA region level and five-year increments.
+run_fredi_sv()
can be run with default population and climate (temperature and SLR) trajectories or use run_fredi_sv()
to run custom scenarios. Running run_fredi_sv()
with custom climate scenarios requires passing a data frame of scenarios to the driverInput
argument. run_fredi_sv()
can also be run with a custom population scenario by passing a data frame of regional population trajectories to the popInput
argument; unlike climate scenarios, run_fredi_sv()
will only run a single scenario at a time.
+The output of run_fredi_sv()
is an R data frame object containing average annual physical impacts for socially vulnerable groups, at the NCA region level and five-year increments.
References
@@ -141,163 +131,18 @@ References
Examples
- ### Run SV Module with defaults without specifying sector
-df_sv <- run_fredi_sv()
-#> [1] "Please select a sector: "
-#> [1] "1. Air Quality - Childhood Asthma"
-#> [1] "2. Air Quality - Premature Mortality"
-#> [1] "3. Labor"
-#> [1] "4. Extreme Temperature"
-#> [1] "5. Roads"
-#> [1] "6. Transportation Impacts from High Tide Flooding"
-#> [1] "7. Coastal Properties"
-#> Warning: type 29 is unimplemented in 'type2char'
-#> Error in readline(prompt = sector_msg3): INTEGER() can only be applied to a 'integer', not a 'unknown type #29'
-
-### Return a character vector with the names of all of the sectors in the FrEDI SV Module:
-get_sv_sectorInfo()
-#> [1] "Air Quality - Childhood Asthma"
-#> [2] "Air Quality - Premature Mortality"
-#> [3] "Coastal Properties"
-#> [4] "Extreme Temperature"
-#> [5] "Labor"
-#> [6] "Roads"
-#> [7] "Transportation Impacts from High Tide Flooding"
-
-### Return a data frame of all of the sectors in the FrEDI SV Module (sector names and additional information)
-get_sv_sectorInfo(description=T)
-#> sector modelType driverUnit
-#> 1 Air Quality - Childhood Asthma GCM degrees Celsius
-#> 2 Air Quality - Premature Mortality GCM degrees Celsius
-#> 3 Coastal Properties SLR cm
-#> 4 Extreme Temperature GCM degrees Celsius
-#> 5 Labor GCM degrees Celsius
-#> 6 Roads GCM degrees Celsius
-#> 7 Transportation Impacts from High Tide Flooding SLR cm
-#> impactUnit
-#> 1 Childhood asthma cases
-#> 2 Premature Mortality
-#> 3 Individuals threatened with total property loss
-#> 4 Mortality
-#> 5 Hours of labor lost
-#> 6 Hours of delay
-#> 7 Hours of delay
-#> variants
-#> 1 N/A
-#> 2 N/A
-#> 3 Without Adaptation, With Adaptation
-#> 4 N/A
-#> 5 N/A
-#> 6 No Adaptation, Proactive Adaptation
-#> 7 Without Adaptation, With Adaptation
-
-### Run SV Module with defaults for "Coastal Properties" without saving
-df_sv <- run_fredi_sv(sector="Coastal Properties")
-#> Running FrEDI SV for sector 'Coastal Properties':
-#>
-#> Preparing driver scenario...
-#> Using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#>
-#> Preparing population scenario...
-#> Using default population scenario...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Coastal Properties", variant="Without Adaptation", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#>
-#> Calculating impacts for sector="Coastal Properties", variant="With Adaptation", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-### Run SV Module with defaults for "Extreme Temperature" without saving
-df_sv <- run_fredi_sv(sector="Extreme Temperature")
-#> Running FrEDI SV for sector 'Extreme Temperature':
-#>
-#> Preparing driver scenario...
-#> Using default temperature scenario...
-#>
-#> Preparing population scenario...
-#> Using default population scenario...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-### Load temperature scenarios
-load(gcamScenarios)
-#> Error in load(gcamScenarios): bad 'file' argument
-
-### Load population scenario
-load(popScenario)
-#> Error in load(popScenario): bad 'file' argument
-
-### Run SV Module for "Extreme Temperature" with custom population and temperature scenarios
-df_sv <- run_fredi_sv(sector = "Extreme Temperature", driverInput = gcamScenarios, popInput = popScenario)
-#> Running FrEDI SV for sector 'Extreme Temperature':
-#> Checking `driverInput` values...
-#> Checking scenarios in `driverInput`...
-#> Warning: `driverInput` has more than four distinct scenarios!
-#> Only the first four scenarios will be used...
-#> Checking `driverInput` values for temperature scenario...
-#> All temperature scenario columns present...
-#> Checking `popInput` values...
-#> All population scenario columns present in `popInput`...
-#>
-#> Preparing driver scenario...
-#> Using temperature scenario from user inputs...
-#>
-#> Preparing population scenario...
-#> Creating population scenario from user inputs...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_20"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_30"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_50"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-
+
Usage
import_inputs(
- tempfile = NULL,
- slrfile = NULL,
- gdpfile = NULL,
- popfile = NULL,
+ inputsList = list(gdp = NULL, pop = NULL, temp = NULL, slr = NULL, ch4 = NULL, nox =
+ NULL, o3 = NULL),
temptype = "conus",
- popArea = "state"
+ popArea = "state",
+ module = "fredi"
)
Arguments
-- tempfile=NULL -
A character string indicating the location of a CSV file containing a custom temperature scenario. The first column in the CSV should be named
"year"
and contain years associated with the temperature estimates; the second column (named"temp_C"
) should contain values for temperatures (i.e., degrees of warming relative to a baseline year of 1995), in degrees Celsius. The temperature scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by themaxYear
argument torun_fredi()
).
-
-
-- slrfile=NULL -
A character string indicating the location of a CSV file containing a custom sea level rise scenario. The first column in the CSV should be named
"year"
and contain years associated with the sea level rise estimates; second column should be named "slr_cm"
and contain values for global mean sea level rise (GMSL), in centimeters, above a baseline year of 2000. The SLR scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by themaxYear
argument torun_fredi()
).
-
-
-- gdpfile=NULL -
A character string indicating the location of a CSV file containing a custom scenario for U.S. gross domestic product (GDP). The first column in the CSV should be named
"year"
and contains years associated with the GDP estimates; the second column (named"gdp_usd"
) should contain values for U.S. GDP in 2015 U.S. dollars (2015$ USD). The GDP scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by themaxYear
argument torun_fredi()
). Values for GDP in column"gdp_usd"
must be greater than or equal to zero.
-
-
-- popfile=NULL -
A character string indicating the location of a CSV file containing a custom population scenario for states and NCA regions. The first column should be named
"year"
and contain years in the interval 2010 to 2300. The second column should be called"pop"
and contain population values. Whether a third column is required depends on the geographical scale of the data, as specified by thepopArea
argument (for more information, see thepopArea
argument, below.If
popArea = "state"
, the third column should be called"state"
and contain the name of the state associated with each population estimate in a given year. IfpopArea = "regional"
, the third column should be called"region"
and contain the NCA Region label associated with each population estimate in a given year. IfpopArea = "national"
, only theyear
andpop
columns are required.
+ - inputsList=list(gdp=NULL, pop=NULL, temp=NULL, slr=NULL, ch4=NULL, nox=NULL) +
A named list containing file paths to CSV files containing scenarios:
gdp A character string indicating the location of a CSV file containing a custom scenario for U.S. gross domestic product (GDP), for use with
run_fredi()
orrun_fredi_methane()
. The first column in the CSV should be named"year"
and contains years associated with the GDP estimates; the second column (named"gdp_usd"
) should contain values for U.S. GDP in 2015 U.S. dollars (2015$ USD). The GDP scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by themaxYear
argument torun_fredi()
orrun_fredi_methane()
). Values for GDP in column"gdp_usd"
must be greater than or equal to zero.
+pop A character string indicating the location of a CSV file containing a custom population scenario for states and NCA regions, for use with
run_fredi()
,run_fredi_sv()
, orrun_fredi_methane()
. The first column should be named"year"
and contain years in the interval 2010 to 2300. The second column should be called"pop"
and contain population values. Whether a third column is required depends on the geographical scale of the data, as specified by thepopArea
argument (for more information, see thepopArea
argument, below.If
popArea = "state"
, the third column should be called"state"
and contain the name of the state associated with each population estimate in a given year. IfpopArea = "regional"
, the third column should be called"region"
and contain the NCA Region label associated with each population estimate in a given year. IfpopArea = "national"
, only theyear
andpop
columns are required.If
popArea = "state"
, the file must contain estimates for all CONUS states -- i.e., all states except Alaska and Hawaii must be present in the input file (estimates for Alaska and Hawaii are optional). IfpopArea = "regional"
, the file must contain estimates for all seven NCA regions.
-The population scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the
maxYear
argument torun_fredi()
). Values for population in column"pop"
must be greater than or equal to zero.
+The population scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the
maxYear
argument torun_fredi()
orrun_fredi_methane()
). Values for population in column"pop"
must be greater than or equal to zero.
+
+temp A character string indicating the location of a CSV file containing a custom temperature scenario, for use with
run_fredi()
orrun_fredi_sv()
. The first column in the CSV should be named"year"
and contain years associated with the temperature estimates; the second column (named"temp_C"
) should contain values for temperatures (i.e., degrees of warming relative to a baseline era of 1986-2005), in degrees Celsius. The temperature scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by themaxYear
argument torun_fredi()
).
+slr A character string indicating the location of a CSV file containing a custom sea level rise scenario, for use with
run_fredi()
orrun_fredi_sv()
. The first column in the CSV should be named"year"
and contain years associated with the sea level rise estimates; the second column should be named "slr_cm"
and contain values for global mean sea level rise (GMSL), in centimeters, above a baseline year of 2000. The SLR scenario must start in 2000 or earlier and end at or after the maximum model run year (e.g., as specified by themaxYear
argument torun_fredi()
).
+o3 A character string indicating the location of a CSV file containing a custom scenario for changes in U.S. state-level ozone concentrations (relative to a 1986-2005 baseline era). The input ozone scenario requires changes in annual state-level ozone concentrations, by GCM model, in parts per trillion by volume (pptv) relative to a 1986-2005 baseline era. In other words, the input ozone scenario requires ozone concentrations specific to the state, GCM model, and year of the analysis.
The
o3
input requires a data frame object with six columns with names"region"
,"state"
,"postal"
,"model"
,"year"
, and"O3_pptv"
containing the region name ("Midwest"
,"Northeast"
,"Northern Plains"
,"Northwest"
,"Southeast"
,"Southern Plains"
, or"Southwest"
for CONUS states, or"Alaska"
and"Hawaii"
for Alaska and Hawaii, respectively), the state name, the two-character postal code abbreviation for the state, the GCM model name ("CanESM2"
,"GFDL-CM3"
,"GISS-E2-R"
,"HadGEM2-ES"
, and/or"MIROC5"
), the year, and the change in ozone concentration (in pptv) relative to a 1986-2005 baseline era.
+Ozone inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by the
maxYear
argument).
+
+ch4 A character string indicating the location of a CSV file containing a custom scenario for changes in U.S. methane concentrations (relative to a 1986-2005 baseline era), at the national level, for use with
run_fredi_methane()
. The first column in the CSV should be named"year"
and contain years associated with the national methane estimates; the second column should be named "CH4_ppbv"
and contain values for methane. The methane scenario must start in 2020 or earlier and end at or after the maximum model run year (e.g., as specified by themaxYear
argument torun_fredi_methane()
).
+nox A character string indicating the location of a CSV file containing a custom scenario for U.S. NOx emission values, at the national level. The first column in the CSV should be named
"year"
and contain years associated with the national NOx estimates; the second column should be named "Mt"
and contain values for NOx emissions, in megatons per year (Mt). The NOx scenario must start in 2020 or earlier and end at or after the maximum model run year (e.g., as specified by themaxYear
argument torun_fredi_methane()
).
@@ -121,29 +117,41 @@
Value
import_inputs()
returns a list of named elements containing data frames with custom scenarios for temperature, GMSL, GDP, and regional population, respectively: -List Index Description tempInput
Data frame containing a custom temperature scenario imported from the CSV file specified by tempfile
, with missing values removed.tempInput
has two columns with names"year"
and"temp_C"
, containing the year and CONUS temperatures in degrees Celsius, respectively.slrInput
Data frame containing a custom GMSL scenario imported from the CSV file specified by slrfile
, with missing values removed.slrInput
has two columns with names"year"
, and"slr_cm"
, containing the year and global mean sea level rise (GMSL) in centimeters, respectively.gdpInput
Data frame containing a custom GDP scenario imported from the CSV file specified by gdpfile
, with missing values removed.gdpInput
has two columns with names"year"
, and"gdp_usd"
, containing the year and the national GDP, respectively.popInput
Data frame containing a custom temperature scenario imported from the CSV file specified by popfile
, with missing values removed.popInput
has three columns with names"year"
,"region"
,"state"
,"postal"
, and"state_pop"
, containing the year, the NCA region name, and the state, the postal code abbreviation (e.g.,postal = "ME"
forstate = "Maine"
), and the state population, respectively.
List Index | Description |
gdp | Data frame containing a custom GDP scenario imported from the CSV file specified by inputsList$gdp , with missing values removed. gdp has two columns with names "year" , and "gdp_usd" , containing the year and the national GDP, respectively. |
pop | Data frame containing a custom temperature scenario imported from the CSV file specified by inputsList$pop , with missing values removed. popInput has three columns with names "year" , "region" , "state" , "postal" , and "pop" , containing the year, the NCA region name, and the state, the postal code abbreviation (e.g., postal = "ME" for state = "Maine" ), and the state population, respectively. |
temp | Data frame containing a custom temperature scenario imported from the CSV file specified by inputsList$temp , with missing values removed. temp has two columns with names "year" and "temp_C" , containing the year and CONUS temperatures in degrees Celsius, respectively. |
slr | Data frame containing a custom GMSL scenario imported from the CSV file specified by inputsList$slr , with missing values removed. slr has two columns with names "year" , and "slr_cm" , containing the year and global mean sea level rise (GMSL) in centimeters, respectively. |
o3 | Data frame containing a custom scenario with changes in ozone concentrations imported from the CSV file specified by inputsList$temp , with missing values removed. o3 has six columns with names "region" , "state" , "postal" , "model" , "year" , and "O3_pptv" containing the region name ("Midwest" , "Northeast" , "Northern Plains" , "Northwest" , "Southeast" , "Southern Plains" , or "Southwest" for CONUS states, or "Alaska" and "Hawaii" for Alaska and Hawaii, respectively), the state name, the two-character postal code abbreviation for the state, the GCM model name ("CanESM2" , "GFDL-CM3" , "GISS-E2-R" , "HadGEM2-ES" , and/or "MIROC5" ), the year, and the change in ozone concentration (in pptv) relative to a 1986-2005 baseline era. |
ch4 | Data frame containing a custom scenario with changes in methane concentrations imported from the CSV file specified by inputsList$slr , with missing values removed. ch4 has two columns with names "year" , and "CH4_ppbv" , containing the year and Change in U.S. methane concentrations, in parts per billion by volume (ppbv) relative to a 1995-2006 baseline era, respectively. |
nox | Data frame containing a custom NOx emissions scenario imported from the CSV file specified by inputsList$nox , with missing values removed. nox has two columns with names "year" and "NOx_Mt" , containing the year and U.S. national-level NOx emissions (in Mt), respectively. |
Details
-This function enables users to import data on custom scenarios for use with temperature binning. Users specify path names to CSV files containing temperature, global mean sea level rise (GMSL), population, and gross domestic product (GDP) scenarios (tempfile
, slrfile
, gdpfile
, and popfile
, respectively). import_inputs()
reads in and formats any specified files as data frames and returns a list of data frames for imported scenarios.
The CSV files should contain estimates aligned with the requirements of the run_fredi()
or ``
Temperature Scenario. The file specified by
tempfile
must have two columns --"year"
and"temp_C"
-- respectively containing the years associated with the temperature estimates and the temperatures (i.e., degrees of warming) in degrees Celsius relative to a baseline year of 1995 (i.e., the central year of a 1986-2005 reference period).If values in
"temp_C"
have global rather than CONUS-specific temperatures, users should specifytemptype = "global"
when runningimport_inputs()
, andimport_inputs()
will convert the temperatures to CONUS using convertTemps (with argumentfrom = "global"
).
-Temperature inputs to
run_fredi()
must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by therun_fredi()
maxYear
argument).
-
-SLR Scenario. The file specified by
slrfile
must have two columns --"year"
and"slr_cm"
-- respectively containing the years associated with the GMSL estimates and GMSL estimates, in centimeters, above a 2000 baseline year.GMSL heights must be greater than or equal to zero.
-The SLR scenario must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the
run_fredi()
maxYear
argument).
-
-GDP Scenario. The file specified by
gdpfile
must have two columns --"year"
and"gdp_usd"
-- respectively containing the years associated with the GDP estimates and the estimates for U.S. GDP, in 2015$.GDP values must be greater than or equal to zero.
+ GDP Scenario. The file specified by
inputsList$gdp
must have two columns --"year"
and"gdp_usd"
-- respectively containing the years associated with the GDP estimates and the estimates for U.S. GDP, in 2015$.GDP values must be greater than or equal to zero.
The GDP scenario must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by the
run_fredi()
maxYear
argument).
-Population Scenario. The file specified by
popfile
population must have at least two columns --"year"
and"pop"
-- respectively containing the years associated with the population estimates and the population estimates. requires state-level population values. Whether a third column is required depends on the geographical scale of the data, as specified by thepopArea
argument.If
popArea = "state"
, the third column should be called"state"
and contain the name of the state associated with each population estimate in a given year. IfpopArea = "regional"
, the third column should be called"region"
and contain the NCA Region label associated with each population estimate in a given year. IfpopArea = "national"
, only theyear
andpop
columns are required.
+Population Scenario. The file specified by
inputsList$pop
population must have at least two columns --"year"
and"pop"
-- respectively containing the years associated with the population estimates and the population estimates. requires state-level population values. Whether a third column is required depends on the geographical scale of the data, as specified by thepopArea
argument.If
popArea = "state"
, the third column should be called"state"
and contain the name of the state associated with each population estimate in a given year. IfpopArea = "regional"
, the third column should be called"region"
and contain the NCA Region label associated with each population estimate in a given year (one of"Midwest"
,"Northeast"
,"Northern Plains"
,"Northwest"
,"Southeast"
,"Southern Plains"
, or"Southwest"
for CONUS states, or"Alaska"
and"Hawaii"
for Alaska and Hawaii, respectively). IfpopArea = "national"
, only theyear
andpop
columns are required.If
popArea = "state"
, the file must contain estimates for all CONUS states -- i.e., all states except Alaska and Hawaii must be present in the input file (estimates for Alaska and Hawaii are optional). IfpopArea = "regional"
, the file must contain estimates for all seven NCA regions.The population scenario must start in 2010 or earlier and end at or after the maximum model run year (e.g., as specified by the
maxYear
argument torun_fredi()
).Population values must be greater than or equal to zero.
Population estimates must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by the
run_fredi()
maxYear
argument).
-
run_fredi()
requires a population scenario at the state level. If the population scenario is supplied toimport_inputs()
at a geographical scale above the state level (i.e., ifpopArea = "national"
,popArea = "area"
, orpopArea = "regional"
),import_inputs()
will calculate state-level estimates from the provided data:If
popArea = "national"
,import_inputs()
will use historical U.S. Census data for the period 2010--2023 to allocate total national population to CONUS and non-CONUS regions (i.e., Alaska and Hawaii); U.S. Census values from 2023 are applied in allocations for years after 2023.import_inputs()
then uses ICLUS data and projections for the period 2010--2100 to allocate CONUS population to specific NCA regions; ICLUS values from 2100 are applied in allocations for years after 2100.
+Temperature Scenario. The file specified by
inputsList$temp
must have two columns --"year"
and"temp_C"
-- respectively containing the years associated with the temperature estimates and the temperatures (i.e., degrees of warming) in degrees Celsius relative to a baseline year of 1995 (i.e., the central year of a 1986-2005 reference period).If values in
"temp_C"
have global rather than CONUS-specific temperatures, users should specifytemptype = "global"
when runningimport_inputs()
, andimport_inputs()
will convert the temperatures to CONUS using convertTemps (with argumentfrom = "global"
).
+Temperature inputs to
run_fredi()
must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by therun_fredi()
maxYear
argument).
+
+SLR Scenario. The file specified by
inputsList$slr
must have two columns --"year"
and"slr_cm"
-- respectively containing the years associated with the GMSL estimates and GMSL estimates, in centimeters, above a 2000 baseline year.GMSL heights must be greater than or equal to zero.
+The SLR scenario must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by the
run_fredi()
maxYear
argument).
+
+Ozone Scenario. The input ozone scenario requires changes in annual state-level ozone concentrations, by GCM model, in parts per trillion by volume (pptv) relative to a 1986-2005 baseline era. In other words, the input ozone scenario requires ozone concentrations specific to the state, GCM model, and year of the analysis.
o3
requires a data frame object with six columns with names"region"
,"state"
,"postal"
,"model"
,"year"
, and"O3_pptv"
containing the region name ("Midwest"
,"Northeast"
,"Northern Plains"
,"Northwest"
,"Southeast"
,"Southern Plains"
, or"Southwest"
for CONUS states, or"Alaska"
and"Hawaii"
for Alaska and Hawaii, respectively), the state name, the two-character postal code abbreviation for the state, the GCM model name ("CanESM2"
,"GFDL-CM3"
,"GISS-E2-R"
,"HadGEM2-ES"
, and/or"MIROC5"
), the year, and the change in ozone concentration (in pptv) relative to a 1986-2005 baseline era.
+Ozone inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by
maxYear
).
+If inputs are specified for ozone and methane or NOx (i.e.,
!is.null(inputsList$o3) & (!is.null(inputsList$ch4) | !is.null(inputsList$nox))
),run_fredi_methane()
will use the ozone scenario in preference of the methane and NOx scenario.
+
+Methane Scenario. The input methane scenario requires changes in annual methane concentrations, at the national level, in parts per billion by volume (ppbv) relative to a 1986-2005 baseline era.
ch4
requires a data frame object with two columns with names"year"
and"CH4_ppbv"
containing the year and the change in methane concentration (in ppbv) relative to a 1986-2005 baseline era.
+Methane inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by
maxYear
).
+run_fredi_methane()
will override a user-supplied methane scenario with a user-supplied ozone scenario; in other words,run_fredi_methane()
will use the ozone scenario in preference of the methane and NOx scenario.
+
+NOx Scenario. The input NOx scenario requires annual NOx emissions in the US, at the national level, in Megatons (MT) relative to a 1986-2005 baseline.
nox
requires a data frame object with two columns with names"year"
and"NOx_Mt"
containing the year and the change in NOx concentration (in Mt) relative to a 1986-2005 baseline era.
+NOx inputs must have at least one non-missing value in 2020 or earlier and at least one non-missing value in or after the final analysis year (as specified by
maxYear
).
+run_fredi_methane()
will override a user-supplied methane scenario with a user-supplied ozone scenario; in other words,run_fredi_methane()
will use the ozone scenario in preference of the methane and NOx scenario.
+
+
run_fredi()
,run_fredi_sv()
, andrun_fredi_methane()
each require a population scenario at the state level. If the population scenario is supplied toimport_inputs()
at a geographical scale above the state level (i.e., ifpopArea = "national"
,popArea = "area"
, orpopArea = "regional"
),import_inputs()
will calculate state-level estimates from the provided data:If
popArea = "national"
,import_inputs()
will use historical U.S. Census data for the period 2010--2023 to allocate total national population to CONUS and non-CONUS regions (i.e., Alaska and Hawaii); U.S. Census values from 2023 are applied in allocations for years after 2023.import_inputs()
then uses ICLUS data and projections for the period 2010--2100 to allocate CONUS population to specific NCA regions; ICLUS values from 2100 are applied in allocations for years after 2100.If
popArea = "national"
orpopArea = "regional"
,import_inputs()
uses ICLUS data and projections for the period 2010--2100 to allocate population for each NCA region to the associated states; ICLUS values from 2100 are applied in allocations for years after 2100.
-import_inputs()
outputs a list of data frame objects that can be passed to the main FREDI functionrun_fredi()
using theinputList
argument. For example, specifyrun_fredi(inputsList = x)
to generate impacts for a custom scenariox
(wherex
is a list of data frames such as that output fromimport_inputs()
) (seerun_fredi()
).All inputs to
+import_inputs()
are optional. If the user does not specify a file path fortempfile
,slrfile
,gdpfile
, orpopfile
(or if there is are any errors reading in inputs from a file path),import_inputs()
outputs a list with aNULL
value for the associated list element. After reading in data from the specified CSV files,import_inputs()
performs basic checks and will also return aNULL
value for a particular list element if any of the checks fail.All inputs to
import_inputs()
are optional. If the user does not specify particular named elements (or if there is are any errors reading in inputs from a file path),import_inputs()
outputs a list with aNULL
value for the associated list element. After reading in data from the specified CSV files,import_inputs()
performs basic checks and will also return aNULL
value for a particular list element if any of the checks fail.When using
import_inputs()
withrun_fredi()
,run_fredi()
defaults back to the default scenarios for any elements of the inputs list that areNULL
or missing. In other words, runningrun_fredi(inputsList = list())
returns the same outputs as runningrun_fredi()
(seerun_fredi()
).
This function enables users to import data on custom scenarios for use with temperature binning. Users provide a named list specifying path names to CSV files containing scenarios for gross domestic product (GDP) (for use with
+run_fredi()
orrun_fredi_methane()
); population (for use withrun_fredi()
,run_fredi_sv()
, orrun_fredi_methane()
); temperature and/or global mean sea level rise (GMSL) (for use withrun_fredi()
orrun_fredi_sv()
); or methane or NOx (for use withrun_fredi_methane()
).import_inputs()
reads in and formats any specified files as data frames and returns a list of data frames for imported scenarios.The CSV files should contain estimates aligned with the requirements of the
run_fredi()
or ``
Examples
### View example scenario names
scenariosPath |> list.files()
-#> [1] "GCAM_scenario.csv" "State ICLUS Population.csv"
-#> [3] "slr_from_GCAM.csv"
+#> [1] "gcamDefault.csv" "gcamScenarios.csv" "gdpDefault.csv"
+#> [4] "popDefault.csv"
### SLR Scenario File Name
slrInputFile <- scenariosPath |> file.path("slr_from_gcam.csv")
@@ -172,40 +180,28 @@ ExamplespopInputFile <- scenariosPath |> file.path("State ICLUS Population.csv")
### Import inputs
-example_inputsList <- import_inputs(slrfile=slrInputFile, popfile=popInputFile, popArea="state")
+example_inputsList <- import_inputs(inputsList=list(slr=slrInputFile, pop=popInputFile), popArea="state")
#>
#> In import_inputs():
#> Loading data...
#> User specified slrfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/slr_from_gcam.csv...
-#> Data loaded.
+#> File does not exist! Returning a null data frame for slr input.
#> User specified popfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/State ICLUS Population.csv...
-#> Data loaded.
+#> File does not exist! Returning a null data frame for pop input.
#>
#> Checking input values...
#>
-#> Checking input values for slr inputs...
-#> Values passed.
-#>
-#> Checking input values for pop inputs...
-#> Column "pop" not found in popfile data!
-#> Looking for columns with matches to the string "pop"...1 match found!
-#> Using column "state_pop", and renaming to "state_pop"...
-#> Values passed.
-#>
#> Finished.
### Use imports with FREDI:
df_x <- run_fredi(inputsList=example_inputsList)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from user inputs...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from user inputs...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -216,11 +212,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
All functionsaggregate_impacts()
- Summarize and aggregate impacts from run_fredi()
(calculate national totals, average across models, sum impact types, and interpolate between impact year estimates)
+ Summarize and aggregate impacts from run_fredi()
(calculate national totals, average across models, sum impact types, and interpolate between impact year estimates)
-
convertTemps()
@@ -90,14 +90,14 @@ All functionsdefaultResults
+ gcamScenarios
- - Default outputs of
run_fredi()
A dataframe containing the default outputs of run_fredi()
+ - Six driver scenarios that can be passed as inputs to
run_fredi()
and run_fredi_sv()
-
-
gcamScenarios
+ gdpDefault
- - Six driver scenarios that can be passed as inputs to
run_fredi()
and run_fredi_sv()
+ - Scenario with values for U.S. Gross Domestic Product (GDP), which can be passed as an input to
run_fredi()
or run_fredi_methane()
.
-
get_sectorInfo()
@@ -107,7 +107,7 @@ All functionsget_sv_sectorInfo()
- - Retrieve a character vector of sectors available in the FrEDI Social Vulnerability (SV) module (run_fredi_sv) or a data frame with SV sectors and additional information.
+ - Retrieve a character vector of sectors available in the FrEDI Social Vulnerability (SV) module (run_fredi_sv) or a data frame with SV sectors and additional information.
-
import_inputs()
@@ -115,9 +115,9 @@ All functionspopScenario
+ popDefault
- - Population scenario to use as an input to
run_fredi()
and run_fredi_sv()
+ - U.S. state population scenario, which can be passed as an input to
run_fredi()
, run_fredi_sv()
, and/or FrEDI:run_fredi_methane()
.
-
run_fredi()
@@ -125,6 +125,11 @@ All functionsrun_fredi_methane()
+
+ - Project annual average impacts from methane, NOx, and ozone.
+
-
+
run_fredi_sv()
- Calculate climate change impacts on socially vulnerable (SV) populations throughout the 21st century for available sectors
diff --git a/docs/reference/popScenario.html b/docs/reference/popScenario.html
deleted file mode 100644
index cad31b4a..00000000
--- a/docs/reference/popScenario.html
+++ /dev/null
@@ -1,131 +0,0 @@
-
-Population scenario to use as an input to run_fredi() and run_fredi_sv() — popScenario • FrEDI
- Skip to contents
-
-
-
-
-
- Population scenario to use as an input to run_fredi()
and run_fredi_sv()
- Source: R/data.R
- popScenario.Rd
-
-
-
- A dataframe containing a population scenario to be passed as an input to run_fredi()
and run_fredi_sv()
.
-
-
-
-
-
- Format
- A data frame with 14,259 rows and 5 columns:
- year
-Year
-
-- region
-Region of U.S. ("Midwest", "Northeast", "Northern Plains", "Northwest", "Southeast", "Southern Plains", and "Southwest")
-
-- state
-One of 48 contiguous U.S. states or the District of Columbia
-
-- postal
-Postal code abbreviation associated with the state
-
-- state_pop
-State population for associated region and year
-
-
-
-
-
- Details
- This dataframe contains population projections at the state level from the Integrated Climate and Land Use Scenarios version 2 (ICLUSv2) model (Bierwagen et al, 2010; EPA 2017) under the Median variant projection of United Nations (2015).
-Bierwagen, B., D. M. Theobald, C. R. Pyke, A. Choate, P. Groth, J. V. Thomas, and P. Morefield. 2010. “National housing and impervious surface scenarios for integrated climate impact assessments.” Proc. Natl. Acad. Sci. 107 (49): 20887–20892. https://doi.org/10.1073/pnas.1002096107.
-EPA. 2017. Multi-Model Framework for Quantitative Sectoral Impacts Analysis: A technical report for the Fourth National Climate Assessment. U.S. Environmental Protection Agency, EPA 430-R-17-001.
-United Nations. 2015. World population prospects: The 2015 revision. New York: United Nations, Department of Economic and Social Affairs, Population Division.
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/reference/run_fredi.html b/docs/reference/run_fredi.html
index 09824b88..c5388b5f 100644
--- a/docs/reference/run_fredi.html
+++ b/docs/reference/run_fredi.html
@@ -12,7 +12,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -79,7 +79,7 @@
Usage
run_fredi(
- inputsList = list(tempInput = NULL, slrInput = NULL, gdpInput = NULL, popInput = NULL),
+ inputsList = list(temp = NULL, slr = NULL, gdp = NULL, pop = NULL),
sectorList = NULL,
aggLevels = c("national", "modelaverage", "impactyear", "impacttype"),
elasticity = 1,
@@ -93,8 +93,8 @@ Usage
Arguments
- - inputsList=NULL
-A list of named elements named elements (names(inputsList) = c("tempInput", "slrInput", "gdpInput", "popInput")
), each containing data frames of custom temperature, global mean sea level rise (GMSL), gross domestic product (GDP), and/or state-level population trajectories, respectively, over a continuous period in the range 2010 to 2300. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population and GDP scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
+ - inputsList=list(gdp=NULL, pop=NULL, temp=NULL, slr=NULL)
+A list with named elements (gdp
, pop
, temp
, and/or slr
), each containing data frames of custom scenarios for gross domestic product (GDP), state-level population, temperature, and/or global mean sea level rise (GMSL) trajectories, respectively, over a continuous period. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population and GDP scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
- sectorList=NULL
@@ -144,40 +144,40 @@ Value
Details
This function allows users to project annual average climate change impacts through 2300 (2010-2300) for available sectors. run_fredi()
is the main function in the FrEDI R package, described elsewhere (See https://epa.gov/cira/FrEDI for more information).
-Users can specify an optional list of custom scenarios with inputsList
(for more information on the format of inputs, see import_inputs()
). The function import_inputs()
can be used to importing custom scenarios from CSV files. import_inputs()
returns a list with elements tempInput
, slrInput
, gdpInput
, and popInput
, with each containing a data frame with a custom scenario for temperature, GMSL, GDP, and state-level population, respectively. If a user imports scenarios using import_inputs()
, they can pass the outputs of import_inputs()
directly to the run_fredi()
argument inputsList
. Note that the documentation for import_inputs()
can also provide additional guidance and specification on the formats for each scenario type.
-If inputsList = NULL
, run_fredi()
uses defaults for temperature, SLR, GDP, and population. Otherwise, run_fredi()
looks for a list object passed to the argument inputsList
. Within that list, run_fredi()
looks for list elements tempInput
, slrInput
, gdpInput
, and popInput
containing data frames with custom scenarios for temperature, GMSL, GDP, and state population, respectively. run_fredi()
will default back to the default scenarios for any list elements that empty or NULL
(in other words, running run_fredi(inputsList = list())
returns the same outputs as running run_fredi()
).
Temperature Inputs. The input temperature scenario requires CONUS temperatures in degrees Celsius relative to 1995 (degrees of warming relative to the baseline year--i.e., the central year of the 1986-2005 baseline). CONUS temperature values must be greater than or equal to zero degrees Celsius.
Users can convert global temperatures to CONUS temperatures using convertTemps(from = "global")
(or by specifying import_inputs(temptype = "global")
when using import_inputs()
to import a temperature scenario from a CSV file).
-tempInput
requires a data frame object with two columns with names "year"
, and "temp_C"
containing the year and CONUS temperatures in degrees Celsius, respectively.
-Temperature inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for temperature (i.e., inputsList = list(tempInput = NULL)
, run_fredi()
uses a default temperature scenario.
-
-SLR Inputs. The input SLR scenario requires values for changes in global mean sea level rise (GMSL) heights in centimeters (cm). GMSL heights must be greater than or equal to zero.
slrInput
requires a data frame object with two columns with names "year"
, "slr_cm"
containing the year and global mean sea level rise (GMSL) in centimeters, respectively.
-SLR inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for SLR (i.e., inputsList = list(slrInput = NULL)
, run_fredi()
first converts the input or default CONUS temperature scenario to global temperatures (using convertTemps()
) and then converts the global temperatures to a global mean sea level rise (GMSL) height in centimeters (using temps2slr()
).
-
-GDP Inputs. The input scenario for gross domestic product (GDP) requires national GDP values in 2015$. GDP values must be greater than or equal to zero.
gdpInput
requires a data frame object with two columns with names "year"
, and "gdp_usd"
containing the year and the national GDP, respectively. GDP values must be greater than or equal to zero.
+Users can specify an optional list of custom scenarios with inputsList
(for more information on the format of inputs, see import_inputs()
). The function import_inputs()
can be used to importing custom scenarios from CSV files. import_inputs()
returns a list with named elements gdp
, pop
, temp
, and slr
, with each containing a data frame with a custom scenario for GDP, state-level population, temperature, and/or GMSL respectively. If a user imports scenarios using import_inputs()
, they can pass the outputs of import_inputs()
directly to the run_fredi()
argument inputsList
. Note that the documentation for import_inputs()
can also provide additional guidance and specification on the formats for each scenario type.
+Otherwise, run_fredi()
looks for a list object passed to the argument inputsList
. Within that list, run_fredi()
looks for named list elements -- gdp
, pop
, temp
, and/or slr
-- each containing a data frame with a custom scenario for GDP, state population, temperature, and/or GMSL, respectively. If inputsList = NULL
or inputsList = list()
(default), run_fredi()
uses default trajectories for GDP, population, temperature, and SLR (see gdpDefault, popDefault, and gcamScenarios for more information). run_fredi()
will default back to the default scenarios for any list elements that empty or NULL
(in other words, running run_fredi(inputsList = list())
returns the same outputs as running run_fredi()
).
GDP Inputs. The input scenario for gross domestic product (GDP) requires national GDP values in 2015$. GDP values must be greater than or equal to zero.
gdp
requires a data frame object with two columns with names "year"
, and "gdp_usd"
containing the year and the national GDP, respectively. GDP values must be greater than or equal to zero.
GDP inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for GDP (i.e., inputsList = list(gdpInput = NULL)
, run_fredi()
uses a default GDP scenario.
+If the user does not specify an input scenario for GDP (i.e., inputsList = list(gdp = NULL)
, run_fredi()
uses a default GDP scenario.
-Population Inputs. The input population scenario requires state-level population values. Population values must be greater than or equal to zero.
popInput
requires a data frame object with five columns with names "region"
, "state"
, "postal"
, "year"
, and "state"
containing the year, the NCA region name, the state name, the postal code abbreviation for the state, and the state population, respectively.
+Population Inputs. The input population scenario requires state-level population values. Population values must be greater than or equal to zero.
pop
requires a data frame object with five columns with names "region"
, "state"
, "postal"
, "year"
, and "pop"
containing the year, the NCA region name (one of "Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
), the state name, the postal code abbreviation for the state, and the state population, respectively.
Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for population (i.e., inputsList = list(popInput = NULL)
, run_fredi()
uses a default population scenario.
+If the user does not specify an input scenario for population (i.e., inputsList = list(pop = NULL)
, run_fredi()
uses a default population scenario.
+
+Temperature Inputs. The input temperature scenario requires CONUS temperatures in degrees Celsius relative to 1995 (degrees of warming relative to the baseline year--i.e., the central year of the 1986-2005 baseline). CONUS temperature values must be greater than or equal to zero degrees Celsius.
Users can convert global temperatures to CONUS temperatures using convertTemps(from = "global")
(or by specifying import_inputs(temptype = "global")
when using import_inputs()
to import a temperature scenario from a CSV file).
+temp
requires a data frame object with two columns with names "year"
, and "temp_C"
containing the year and CONUS temperatures in degrees Celsius, respectively.
+Temperature inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+If the user does not specify an input scenario for temperature (i.e., inputsList = list(temp = NULL)
, run_fredi()
uses a default temperature scenario.
+
+SLR Inputs. The input SLR scenario requires values for changes in global mean sea level rise (GMSL) heights in centimeters (cm). GMSL heights must be greater than or equal to zero.
slr
requires a data frame object with two columns with names "year"
, "slr_cm"
containing the year and global mean sea level rise (GMSL) in centimeters, respectively.
+SLR inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+If the user does not specify an input scenario for SLR (i.e., inputsList = list(slr = NULL)
, run_fredi()
first converts the input or default CONUS temperature scenario to global temperatures (using convertTemps()
) and then converts the global temperatures to a global mean sea level rise (GMSL) height in centimeters (using temps2slr()
).
-
run_fredi()
linearly interpolates missing annual values for all input scenarios using non-missing values (each scenario requires at least two non-missing values as detailed above for each scenario type). After interpolation of the input scenarios, run_fredi()
subsets the input scenarios to values within the analysis period.
Temperatures are interpolated using 1995 as the baseline year (i.e., the central year of the 1986-2005 baseline) and GMSL is interpolated using 2000 as the baseline year. In other words, temperature (in degrees Celsius) is set to zero for the year 1995, whereas GMSL is set to zero for the year 2000. The interpolated temperature and GMSL scenarios are combined into a column called driverValue
, along with additional columns for year, the driver unit (column "driverUnit"
, with driverUnit = "degrees Celsius"
and driverUnit = "cm"
for temperature- and SLR-driven sectors, respectively), and the associated model type (column "model_type"
, with model_type = "GCM"
and model_type = "SLR"
for temperature- and SLR-driven sectors, respectively
-run_fredi()
calculations national population from state-level values and then calculates GDP per capita from values for GDP and national population. Values for state population, national population, national GDP (in 2015$), and national per capita GDP (in 2015$/capita) are provided in the results data frame in columns "state_pop"
, "national_pop"
, "gdp_usd"
, and "gdp_percap"
, respectively.
+
run_fredi()
linearly interpolates missing annual values for all input scenarios using non-missing values (each scenario requires at least two non-missing values as detailed above for each scenario type). After interpolation of the input scenarios, run_fredi()
subsets the input scenarios to values within the analysis period.
Temperatures are interpolated using 1995 as the baseline year (i.e., the central year of the 1986-2005 baseline) and GMSL is interpolated using 2000 as the baseline year. In other words, temperature (in degrees Celsius) is set to zero for the year 1995, whereas GMSL is set to zero for the year 2000. The interpolated temperature and GMSL scenarios are combined into a column called driverValue
, along with additional columns for year, the driver unit (column "driverUnit"
, with driverUnit = "degrees Celsius"
and driverUnit = "cm"
for temperature- and SLR-driven sectors, respectively), and the associated model type (column "model_type"
, with model_type = "GCM"
and model_type = "SLR"
for temperature- and SLR-driven sectors, respectively.
+run_fredi()
calculates national population from state-level values and then calculates GDP per capita from values for GDP and national population. Values for state population, national population, national GDP (in 2015$), and national per capita GDP (in 2015$/capita) are provided in the results data frame in columns "pop"
, "national_pop"
, "gdp_usd"
, and "gdp_percap"
, respectively.
By default, run_fredi()
will calculate impacts for all sectors included in the tool. Alternatively, users can pass a character vector specifying a single sector or a subset of sectors using the sectorList
argument. To see a list of sectors included within FrEDI, run get_sectorInfo()
. If sectorList = NULL
(default), all sectors are included.
By default, run_fredi()
calculates impacts starting in the year 2010 and ending in 2100. Specify an alternative end year for the analysis using the maxYear
argument. maxYear
has a default value of 2100
and minimum and maximum values of 2011
and 2300
, respectively. Alternatively, users can set argument thru2300 = TRUE
to override the maxYear
argument and set maxYear = 2300
. Note that the default scenarios included within FrEDI stop in the year 2100; users must provide custom input scenarios out to the desired end year and specify a maxYear >= 2100
(and maxYear <= 2300
) in order to return non-missing values for years after 2100.
Annual impacts for each sector, variant, impact type, and impact year combination included in the model are calculated by multiplying scaled climate impacts by a physical scalar and economic scalars and multipliers. Some sectors use Value of a Statistical Life (VSL) to adjust the value non-linearly over time. run_fredi()
uses a default value of elasticity = 1
to adjust VSL for applicable sectors and impacts (the default value of elasticity = 1
keeps VSL constant over time). A custom elasticity can be passed to the elasticity
argument. Applicable sectors and impacts are *Climate-Driven Changes in Air Quality (all impact types), ATS Temperature-Related Mortality (impactType = "N/A"
; i.e., all impact types), CIL Temperature-Related Mortality, Extreme Temperature (all impact types), Suicide (impactType = "N/A"
; i.e., all impact types), Southwest Dust (impactType = "All Mortality"
), Valley Fever (impactType = "Mortality"
), Vibriosis (impactType = "N/A"
; i.e., all impact types), and Wildfire (impactType = "Mortality"
).
run_fredi()
aggregates or summarizes results to level(s) of aggregation specified by the user (passed to aggLevels
) using the post-processing helper function aggregate_impacts()
. Users can specify all aggregation levels at once by specifying aggLevels = "all"
(default) or no aggregation levels (aggLevels = "none"
). Users can specify a single aggregation level or multiple aggregation levels by passing a single character string or character vector to aggLevels
. Options for aggregation include calculating national totals (aggLevels = "national"
), averaging across model types and models (aggLevels = "modelaverage"
), summing over all impact types (aggLevels = "impacttype"
), and interpolating between impact year estimates (aggLevels = "impactYear"
).
-If the user specifies aggLevels = "none"
, run_fredi()
returns a data frame with columns: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, "state_pop"
, "year"
, "physical_impacts"
, and "annual_impacts"
.
Columns "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, and "model"
all contain observation identifiers (sector name, variant, impact type, impact year, region, state, state postal code abbreviation, model type, and model, respectively).
+If the user specifies aggLevels = "none"
, run_fredi()
returns a data frame with columns: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, "pop"
, "year"
, "physical_impacts"
, and "annual_impacts"
.
Columns "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, and "model"
all contain observation identifiers (sector name, variant, impact type, impact year, region, state, state postal code abbreviation, model type, and model, respectively).
Columns "sectorprimary"
and "includeaggregate"
contain values that provide information about how to treat sectors and when aggregating over sectors (e.g., summing impacts across sectors). Note that FrEDI does not currently provide functionality to aggregate over sectors; this information is provided for user convenience.
Column "sectorprimary"
contains values indicating which variant to use as the primary one for each sector: sectorprimary = 1
for primary variants and sectorprimary = 0
for non-primary variants. When aggregating impacts over sectors, users should filter the outputs of run_fredi()
to variants with sectorprimary == 1
.
Column "includeaggregate"
contains values that provide information about how to treat sectors when aggregating over sectors (e.g., summing impacts across sectors). Sectors that have a value of includeaggregate == 0
should be dropped when aggregating results over sectors, to avoid potential double-counting of impacts for similar sectors. For instance, sectors ATS Temperature-Related Mortality, CIL Temperature-Related Mortality, and Extreme Temperature have values for temperature-related mortality. To avoid double counting, outputs of run_fredi()
should be filtered to values for which includeaggregate > 0
. Sectors with a value of includeaggregate > 0
can be included when aggregating over sectors; most sectors with a value of includeaggregate > 0
will have a value of includeaggregate = 1
. Values of includeaggregate > 1
flag additional information about sectors; currently, only the Suicide sector has a value of includeaggregate > 1
, with a value of includeaggregate = 2
. This flag indicates that the impacts from Suicide can be included when summing values across sectors, but may have some overlap with impacts from ATS Temperature-Related Mortality. For more information about the potential overlap between impacts for ATS Temperature-Related Mortality and Suicide, visit the technical documentation at https://epa.gov/cira/FrEDI/,
Columns "driverType"
, "driverUnit"
, and "driverValue"
contain information about the temperature and SLR scenarios.
-Columns "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "state_pop"
contain information about the GDP and population scenarios.
+Columns "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "pop"
contain information about the GDP and population scenarios.
Columns "physicalmeasure"
and "physical_impacts"
contain information about physical impacts.
Column "annual_impacts"
contains information on the economic value associated with annual impacts.
If the user specifies aggLevels = "all"
or other combinations of aggregation levels, run_fredi()
passes the results data frame and the aggLevels
argument to the aggregate_impacts()
function. aggregate_impacts()
then performs the following calculations, using the default grouping columns for the aggregate_impacts()
: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, and "year"
(note that the "variant"
column referred to below contains information about the variant name (or “N/A”
), as applicable).
-Aggregation Level Description impactyear
To aggregate over impact years, aggregate_impacts()
first separates results for sectors with only one impact year estimate (i.e., impactYear = "N/A"
) from from observations with multiple impact year estimates (i.e., sectors with results for both impactYear = "2010"
and impactYear = "2090"
). For these sectors with multiple impact years, physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
) are linearly interpolated between impact year estimates. For any model run years above 2090, annual results for sectors with multiple impact years return the 2090 estimate. The interpolated values are then row-bound to the results for sectors with a single impact year estimate, and column impactYear
set to impactYear = "Interpolation"
for all values. If "impactyear"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
aggregates over impact years before performing other types of aggregation. modelaverage
To aggregate over models for temperature-driven sectors, aggregate_impacts()
averages physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all GCM models present in the data. aggregate_impacts()
drops the column "model"
from the grouping columns when averaging over models. Averages exclude observations with missing values. However, If all values within a grouping are missing, the model average is set to NA
. The values in column "model"
are set to "Average"
for model averages and the model averages data frame is then row-bound to the main results data frame. For SLR-driven sectors, there is no need for additional model aggregation; these values already have model = "Interpolation"
. If "modelaverage"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years (if "impactyear"
present in aggLevels
or if aggLevels = "all"
) before aggregating over models. national
To aggregate values to the national level, aggregate_impacts()
sums physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all states present in the data. aggregate_impacts()
drops the columns "region"
, "state"
, and "postal"
when summing over states and regions. Years which have missing column data for all regions return as NA
. Values for columns "region"
, "state"
, and "postal"
are set to "National Total"
, All
, and US
, respectively. The data frame with national totals is then row-bound to the main results data frame. If "national"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years and/or models (if "impactyear"
and/or "modelaverage"
are present in aggLevels
or if aggLevels = "all"
) before aggregating over models. impacttype
To aggregate values over impact types, aggregate_impacts()
sums annual impacts (column "annual_impacts"
) across all impact types for each sector. aggregate_impacts()
drops the column "impactType"
and "physicalmeasure"
from the grouping columns when summing over impact types. Years which have missing column data for all impact types return as NA
. All values in column "impactType"
are set to "all"
. Aggregating over impact types, drops columns related to physical impacts (i.e., columns "physicalmeasure"
and "physical_impacts"
). These columns are dropped since aggregating over impact types for some sectors requires summing costs over different types of physical impacts, so reporting the physical impacts would be nonsensical.
After aggregating values, aggregate_impacts()
joins the data frame of impacts with information about "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "state_pop"
.
+Aggregation Level Description impactyear
To aggregate over impact years, aggregate_impacts()
first separates results for sectors with only one impact year estimate (i.e., impactYear = "N/A"
) from from observations with multiple impact year estimates (i.e., sectors with results for both impactYear = "2010"
and impactYear = "2090"
). For these sectors with multiple impact years, physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
) are linearly interpolated between impact year estimates. For any model run years above 2090, annual results for sectors with multiple impact years return the 2090 estimate. The interpolated values are then row-bound to the results for sectors with a single impact year estimate, and column impactYear
set to impactYear = "Interpolation"
for all values. If "impactyear"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
aggregates over impact years before performing other types of aggregation. modelaverage
To aggregate over models for temperature-driven sectors, aggregate_impacts()
averages physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all GCM models present in the data. aggregate_impacts()
drops the column "model"
from the grouping columns when averaging over models. Averages exclude observations with missing values. However, If all values within a grouping are missing, the model average is set to NA
. The values in column "model"
are set to "Average"
for model averages and the model averages data frame is then row-bound to the main results data frame. For SLR-driven sectors, there is no need for additional model aggregation; these values already have model = "Interpolation"
. If "modelaverage"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years (if "impactyear"
present in aggLevels
or if aggLevels = "all"
) before aggregating over models. national
To aggregate values to the national level, aggregate_impacts()
sums physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all states present in the data. aggregate_impacts()
drops the columns "region"
, "state"
, and "postal"
when summing over states and regions. Years which have missing column data for all regions return as NA
. Values for columns "region"
, "state"
, and "postal"
are set to "National Total"
, All
, and US
, respectively. The data frame with national totals is then row-bound to the main results data frame. If "national"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years and/or models (if "impactyear"
and/or "modelaverage"
are present in aggLevels
or if aggLevels = "all"
) before aggregating over models. impacttype
To aggregate values over impact types, aggregate_impacts()
sums annual impacts (column "annual_impacts"
) across all impact types for each sector. aggregate_impacts()
drops the column "impactType"
and "physicalmeasure"
from the grouping columns when summing over impact types. Years which have missing column data for all impact types return as NA
. All values in column "impactType"
are set to "all"
. Aggregating over impact types, drops columns related to physical impacts (i.e., columns "physicalmeasure"
and "physical_impacts"
). These columns are dropped since aggregating over impact types for some sectors requires summing costs over different types of physical impacts, so reporting the physical impacts would be nonsensical.
After aggregating values, aggregate_impacts()
joins the data frame of impacts with information about "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "pop"
.
If outputList = FALSE
(default), run_fredi()
returns a data frame of annual average impacts over the analysis period, for each sector, variant, impact type, impact year, region, state, model type ("GCM"
or "SLR"
), and model. If outputList = TRUE
, in addition to the data frame of impacts, run_fredi()
returns a list object containing information about values for function arguments, driver scenarios, and population and GDP scenarios.
@@ -190,16 +190,15 @@ Examples### Load FrEDI
require(FrEDI)
-### Run function with defaults (same as `defaultResults` dataset)
+### Run function with defaults
run1 <- run_fredi()
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from defaults...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -207,62 +206,71 @@ Examplesdata("gcamScenarios")
gcamScenarios |> glimpse()
#> Rows: 606
-#> Columns: 4
-#> $ year <int> 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2…
-#> $ temp_C <dbl> 0.1269649, 0.1575513, 0.1858310, 0.2101611, 0.2306551, 0.2444…
-#> $ slr_cm <dbl> 0.0000000, 0.2727356, 0.5552278, 0.8458496, 1.1430287, 1.4440…
-#> $ scenario <chr> "Hector_GCAM_v5.3_ECS_3.0_REF", "Hector_GCAM_v5.3_ECS_3.0_REF…
+#> Columns: 6
+#> $ year <int> 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20…
+#> $ temp_C_conus <dbl> 0.1804171, 0.2238804, 0.2640659, 0.2986389, 0.3277609, 0…
+#> $ temp_C_global <dbl> 0.1269649, 0.1575513, 0.1858310, 0.2101611, 0.2306551, 0…
+#> $ slr_cm <dbl> 0.0000000, 0.2727356, 0.5552278, 0.8458496, 1.1430287, 1…
+#> $ scenario <chr> "ECS_3.0_REF", "ECS_3.0_REF", "ECS_3.0_REF", "ECS_3.0_RE…
+#> $ model <chr> "Hector_GCAM_v5.3", "Hector_GCAM_v5.3", "Hector_GCAM_v5.…
### Load population scenario and glimpse data
-data(popScenario)
-popScenario |> glimpse()
+data("popDefault")
+popDefault |> glimpse()
#> Rows: 14,259
#> Columns: 5
-#> $ year <dbl> 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, …
#> $ region <chr> "Southeast", "Southeast", "Southeast", "Southeast", "Southea…
#> $ state <chr> "Alabama", "Alabama", "Alabama", "Alabama", "Alabama", "Alab…
#> $ postal <chr> "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", …
+#> $ year <int> 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, …
#> $ state_pop <dbl> 4779736, 4823623, 4867509, 4911396, 4955282, 4999169, 503604…
### Subset climate scenario
-temps1 <- gcamScenarios |> filter(scenario=="Hector_GCAM_v5.3_ECS_3.0_ref")
-temps1 <- temps1 |> mutate(temp_C = temp_C_global |> convertTemps(from="global"))
-#> Error in mutate(temps1, temp_C = convertTemps(temp_C_global, from = "global")): ℹ In argument: `temp_C = convertTemps(temp_C_global, from = "global")`.
-#> Caused by error:
-#> ! object 'temp_C_global' not found
-temps1 <- temps1 |> select(year, temp_C)
+temps1 <- gcamScenarios |> filter(scenario=="ECS_3.0_ref")
+temps1 <- temps1 |> select(year, temp_C_conus)
### Run custom scenario
-run2 <- run_fredi(inputsList=list(tempInput=temps1, popInput=popScenario))
-#> Checking input values...
-#> Creating temperature scenario from user inputs...
-#> Error in map(regions0, function(region_i) { df_i <- filter(data, region == region_i) x_i <- df_i[["year"]] y_i <- df_i[[column0]] new_i <- approx(x = x_i, y = y_i, xout = years, rule = rule, method = method) new_i <- as_tibble(new_i) new_i <- rename_at(new_i, c(cols0), ~cols1) new_i <- mutate(new_i, region = region_i) return(new_i)}): ℹ In index: 1.
-#> Caused by error in `approx()`:
-#> ! need at least two non-NA values to interpolate
+run2 <- run_fredi(inputsList=list(temp=temps1, pop=popDefault))
+#> Checking scenarios...
+#>
+#> Checking input values for pop inputs...
+#> Column "pop" not found in popfile data!
+#> Looking for columns with matches to the string "pop"...1 match found!
+#> Using column "", and renaming to "pop"...
+#> Data is missing the following required columns: state_pop!
+#> Dropping pop inputs from outputs.
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
+#>
+#> Finished.
### Load scenarios from file:
scenariosPath <- system.file(package="FrEDI") |> file.path("extdata","scenarios")
scenariosPath |> list.files()
-#> [1] "GCAM_scenario.csv" "State ICLUS Population.csv"
-#> [3] "slr_from_GCAM.csv"
+#> [1] "gcamDefault.csv" "gcamScenarios.csv" "gdpDefault.csv"
+#> [4] "popDefault.csv"
### SLR Scenario File Name
-slrInputFile <- scenariosPath |> file.path("slr_from_GCAM.csv")
+slrInputFile <- scenariosPath |> file.path("gcamDefault.csv")
### Population Scenario File Name
-popInputFile <- scenariosPath |> file.path("State ICLUS Population.csv")
+popInputFile <- scenariosPath |> file.path("popDefault.csv")
### Import inputs
-x_inputs <- import_inputs(slrfile=slrInputFile, popfile=popInputFile, popArea="state")
+x_inputs <- import_inputs(inputsList=list(slr=slrInputFile, pop=popInputFile), popArea="state")
#>
#> In import_inputs():
#> Loading data...
#> User specified slrfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/slr_from_GCAM.csv...
+#> Importing data from C:/Users/knoiva/AppData/Local/R/win-library/4.4/FrEDI/extdata/scenarios/gcamDefault.csv...
#> Data loaded.
#> User specified popfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/State ICLUS Population.csv...
+#> Importing data from C:/Users/knoiva/AppData/Local/R/win-library/4.4/FrEDI/extdata/scenarios/popDefault.csv...
#> Data loaded.
#>
#> Checking input values...
@@ -271,23 +279,37 @@ Examples#> Values passed.
#>
#> Checking input values for pop inputs...
-#> Column "pop" not found in popfile data!
-#> Looking for columns with matches to the string "pop"...1 match found!
-#> Using column "state_pop", and renaming to "state_pop"...
+#> Checking that all states, etc. are present...
+#>
+#> Checking inputs for unique regions, states...
+#> All regions present...
+#> All states present...
#> Values passed.
#>
#> Finished.
### Run custom scenarios
run3 <- run_fredi(inputsList=x_inputs)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
+#> Checking scenarios...
+#>
+#> Checking input values for slr inputs...
+#> Values passed.
+#>
+#> Checking input values for pop inputs...
+#> Checking that all states, etc. are present...
+#>
+#> Checking inputs for unique regions, states...
+#> All regions present...
+#> All states present...
+#> Values passed.
#> Creating SLR scenario from user inputs...
-#> No GDP scenario provided...Using default GDP scenario...
#> Creating population scenario from user inputs...
-#> Updating scalars...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -321,32 +343,37 @@ Examples
### Run for a single sector, with default inputs, no aggregation, and elasticity=1:
run4 <- run_fredi(sectorList="ATS Temperature-Related Mortality", aggLevels="none", elasticity=1)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from defaults...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
#> Formatting results...
#>
#> Finished.
### Set end year for analysis to 2110 -- messages user and returns a null value since default scenarios only have values out to 2100
run5 <- run_fredi(maxYear=2110)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Temperature scenario must have at least one non-missing value in or after the year 2110...
+#> Checking scenarios...
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
#>
-#> Exiting...
+#> Finished.
### Set end year for analysis to 2300 -- messages user and returns a null value since default scenarios only have values out to 2100)
run6 <- run_fredi(thru2300=TRUE)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Temperature scenario must have at least one non-missing value in or after the year 2300...
+#> Checking scenarios...
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
#>
-#> Exiting...
+#> Finished.
@@ -358,11 +385,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
diff --git a/docs/reference/run_fredi_sv.html b/docs/reference/run_fredi_sv.html
index 082f5c36..f234cad7 100644
--- a/docs/reference/run_fredi_sv.html
+++ b/docs/reference/run_fredi_sv.html
@@ -10,7 +10,7 @@
FrEDI
- 4.1.0
+ 4.2.0
@@ -77,8 +77,7 @@
Usage
run_fredi_sv(
sector = NULL,
- driverInput = NULL,
- popInput = NULL,
+ inputsList = list(pop = NULL, temp = NULL, slr = NULL),
silent = TRUE,
.testing = FALSE
)
@@ -90,22 +89,22 @@ Argumentsget_sv_sectorInfo() for a list of available sectors).
-- driverInput
-A data frame of up to four custom scenarios for drivers (temperature or global mean sea level rise). driverInput
requires a data frame with columns of "year"
and "scenario"
. The data frame must also include a third column: "temp_C"
for temperature-driven sectors (containing temperature values in degrees Celsius of warming for the contiguous U.S.) or "slr_cm"
for sea level rise (SLR)-driven sectors (containing values for global mean sea level rise in centimeters). Run get_sv_sectorInfo(gcmOnly=TRUE)
to see temperature-driven sectors in the SV module and get_sv_sectorInfo(slrOnly=TRUE)
to see SLR-driven scenarios. Users can also pass a data frame with all four columns ("year"
, "scenario"
, "temp_C"
, and "slr_cm"
), in which case run_fredi_sv()
determines whether to use the "temp_C"
or "slr_cm"
column as the driver trajectory based on the specified sector. Driver inputs for all scenarios should start in the year 2000 or earlier. All scenarios must include at least two non-missing values (especially values before or at 2000 and at or after 2100). If any required columns are missing, run_fredi_sv()
will use the default temperature or sea level rise scenario from run_fredi()
. If the data frame passed to driverInput
has more than four unique scenarios, run_fredi_sv()
will only run the first four scenarios.
+- silent
+A logical (TRUE/FALSE
) value indicating the level of messaging desired by the user (defaults to silent=TRUE
)
-- popInput
-The input population scenario requires a data frame object with a single scenario of state-level population values.
The population scenario must have five columns with names "year"
, "region"
, "state"
, "postal"
, and "state_pop"
containing the year, the NCA region name, the state name, the postal code abbreviation (e.g., "ME" for "Maine") for the state, and the state population, respectively.
-popInput
only accepts a a single scenario, in contrast to driverInput
. In other words, run_fredi_sv()
uses the same population scenario for any and all driver scenarios passed to driverInput
.
-If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario.
+- inputsList=list(pop=NULL, temp=NULL, slr=NULL)
+A list with named elements (pop
, temp
, and/or slr
), each containing data frames of custom scenarios for state-level population, temperature, and/or global mean sea level rise (GMSL) trajectories, respectively, over a continuous period. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
pop. The input population scenario requires a data frame object with a single scenario of population values for each of the 48 U.S. states and the District of Columbia comprising the contiguous U.S. (CONUS).
The population scenario must have five columns with names "region"
, "state"
, "postal"
, "year"
, and "_pop"
containing the NCA region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
), the state name, the two-letter postal code abbreviation for the state (e.g., "ME"
for Maine), the year, and the state population, respectively.
+The input population scenario can only contain a single scenario, in contrast to values for temperature or SLR inputs. In other words, run_fredi_sv()
uses the same population scenario when running any and all of the temperature or SLR scenarios passed to run_fredi_sv()
.
+If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario (see documentation for popScenario).
Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (2100).
Population values must be greater than or equal to zero.
+
+temp or slr. The input temperature or SLR scenario should be a data frame containing one or more custom scenarios. These inputs should be formulated similarly to those for run_fredi()
and import_inputs()
, with an additional column (scenario
) indicating the unique scenario identifier. Temperature and/or SLR input scenarios must have at least one non-missing value in the year 2000 or earlier and at least one non-missing value in or after the final analysis year (2100).
temp. Temperature inputs are used by run_fredi_sv()
with temperature-driven sectors; run get_sv_sectorInfo(gcmOnly=TRUE)
to get a list of the temperature-driven sectors available for the SV module. Temperature inputs require a data frame with columns of year
, temp_C
, and scenario
, respectively containing the year associated with an observation, temperature values for CONUS in degrees Celsius of warming relative to a 1995 baseline (where 1995 is the central year of a 1986-2005 baseline period -- i.e., values should start at zero in the year 1995), and a unique scenario identifier. If no temperature scenario is specified (i.e., inputsList$temp
is NULL
) when running a temperature-driven sector, run_fredi_sv()
will use a default temperature scenario (see FrEDI:gcamScenarios).
+slr. SLR inputs are used by run_fredi_sv()
with sea level rise-driven sectors; run get_sv_sectorInfo(slrOnly=TRUE)
to get a list of the SLR-driven sectors available for the SV module. SLR inputs require a data frame with columns of year
, slr_cm
, and scenario
, respectively containing the global mean sea level rise in centimeters relative to a 2000 baseline (i.e., values should start at zero in the year 2000), and a unique scenario identifier. If no SLR scenario is specified (i.e., inputsList$slr
is NULL
) when running a temperature-driven sector: if a user has supplied a temperature scenario (i.e., inputsList$temp
is not NULL
), run_fredi_sv()
will calculate sea level rise values from the temperature inputs using the temps2slr()
function; if no temperature scenario is provided, run_fredi_sv
will use a default SLR scenario (see FrEDI:gcamScenarios).
+
-
-- silent
-A logical (TRUE/FALSE
) value indicating the level of messaging desired by the user (defaults to silent=TRUE
).
-
Value
@@ -117,17 +116,8 @@ Value
Details
run_fredi_sv()
projects annual climate change impacts for socially vulnerable (SV) populations throughout the 21st century (2010-2100) for available sectors, using default or user-specified population, temperature, and sea level rise (SLR) trajectories. run_fredi_sv()
is the main function for the FrEDI Social Vulnerability (SV) module in the FrEDI R package, described elsewhere (See https://epa.gov/cira/FrEDI for more information). The SV module extends the FrEDI framework to socially vulnerable populations using data underlying a 2021 U.S. Environmental Protection Agency (EPA) report on Climate Change and Social Vulnerability in the United States.
Users can run run_fredi_sv()
to generate annual physical impacts for SV groups for individual sectors. When running run_fredi_sv()
, users must specify one of the sectors in the SV module; use get_sv_sectorInfo()
for a list of available sectors.
-run_fredi_sv()
can be run with default population and climate (temperature and SLR) trajectories or use run_fredi_sv()
to run custom scenarios. Running run_fredi_sv()
with custom climate scenarios requires passing a data frame of scenarios to the driverInput
argument. run_fredi_sv()
can also be run with a custom population scenario by passing a data frame of regional population trajectories to the popInput
argument; unlike climate scenarios, run_fredi_sv()
will only run a single scenario at a time.
driverInput
can take a data frame containing up to four custom scenarios for drivers (temperature or global mean sea level rise). driverInput
requires a data frame with columns of "year"
and "scenario"
. The data frame must also include a third column: "temp_C"
for temperature-driven sectors (containing temperature values in degrees Celsius of warming for the contiguous U.S.) or "slr_cm"
for sea level rise (SLR)-driven sectors (containing values for global mean sea level rise in centimeters). Run get_sv_sectorInfo(gcmOnly = TRUE)
to see temperature-driven sectors in the SV module and get_sv_sectorInfo(slrOnly = TRUE)
to see SLR-driven scenarios. Users can also pass a data frame with all four columns ("year"
, "scenario"
, "temp_C"
, and "slr_cm"
), in which case run_fredi_sv()
determines whether to use the "temp_C"
or "slr_cm"
column as the driver trajectory based on the specified sector. If any required columns are missing, run_fredi_sv()
will use the default temperature or sea level rise scenario from run_fredi()
. If the data frame passed to driverInput
has more than four unique scenarios, run_fredi_sv()
will only run the first four scenarios.
Temperature inputs must be temperature change in degrees Celsius for the contiguous U.S. (use convertTemps()
to convert global temperatures to CONUS temperatures before passing to driverInput
) relative to a 1995 baseline (where 1995 is the central year of a 1986-2005 baseline period; values should start at zero in the year 1995).
-Sea level rise inputs must be in centimeters relative to a 2000 baseline (i.e., values should start at zero in the year 2000). Driver inputs for all scenarios should start in the year 2000 or earlier. All scenarios must include at least two non-missing values (especially values before or at 2000 and at or after 2100).
-
-The input population scenario requires a data frame object with a single scenario of state-level population values.
The population scenario must have five columns with names "year"
, "region"
, "state"
, "postal"
, and "state_pop"
containing the year, the NCA region name, the state name, the postal code abbreviation (e.g., "ME" for "Maine") for the state, and the state population, respectively.
-popInput
only accepts a a single scenario, in contrast to driverInput
. In other words, run_fredi_sv()
uses the same population scenario for any and all driver scenarios passed to driverInput
.
-If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario.
-Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (2100).
-Population values must be greater than or equal to zero.
-The default regional population scenario is drawn from the Integrated Climate and Land Use Scenarios version 2 (ICLUSv2) model (Bierwagen et al, 2010; EPA 2017) under the Median variant projection of United Nations (United Nations, 2015). Note that the FrEDI SV default population scenario differs from the default population scenario used by run_fredi()
.
-
-
The output of run_fredi_sv()
is an R data frame object containing average annual physical impacts for socially vulnerable groups, at the NCA region level and five-year increments.
+run_fredi_sv()
can be run with default population and climate (temperature and SLR) trajectories or use run_fredi_sv()
to run custom scenarios. Running run_fredi_sv()
with custom climate scenarios requires passing a data frame of scenarios to the driverInput
argument. run_fredi_sv()
can also be run with a custom population scenario by passing a data frame of regional population trajectories to the popInput
argument; unlike climate scenarios, run_fredi_sv()
will only run a single scenario at a time.
+The output of run_fredi_sv()
is an R data frame object containing average annual physical impacts for socially vulnerable groups, at the NCA region level and five-year increments.
References
@@ -141,163 +131,18 @@ References
Examples
- ### Run SV Module with defaults without specifying sector
-df_sv <- run_fredi_sv()
-#> [1] "Please select a sector: "
-#> [1] "1. Air Quality - Childhood Asthma"
-#> [1] "2. Air Quality - Premature Mortality"
-#> [1] "3. Labor"
-#> [1] "4. Extreme Temperature"
-#> [1] "5. Roads"
-#> [1] "6. Transportation Impacts from High Tide Flooding"
-#> [1] "7. Coastal Properties"
-#> Warning: type 29 is unimplemented in 'type2char'
-#> Error in readline(prompt = sector_msg3): INTEGER() can only be applied to a 'integer', not a 'unknown type #29'
-
-### Return a character vector with the names of all of the sectors in the FrEDI SV Module:
-get_sv_sectorInfo()
-#> [1] "Air Quality - Childhood Asthma"
-#> [2] "Air Quality - Premature Mortality"
-#> [3] "Coastal Properties"
-#> [4] "Extreme Temperature"
-#> [5] "Labor"
-#> [6] "Roads"
-#> [7] "Transportation Impacts from High Tide Flooding"
-
-### Return a data frame of all of the sectors in the FrEDI SV Module (sector names and additional information)
-get_sv_sectorInfo(description=T)
-#> sector modelType driverUnit
-#> 1 Air Quality - Childhood Asthma GCM degrees Celsius
-#> 2 Air Quality - Premature Mortality GCM degrees Celsius
-#> 3 Coastal Properties SLR cm
-#> 4 Extreme Temperature GCM degrees Celsius
-#> 5 Labor GCM degrees Celsius
-#> 6 Roads GCM degrees Celsius
-#> 7 Transportation Impacts from High Tide Flooding SLR cm
-#> impactUnit
-#> 1 Childhood asthma cases
-#> 2 Premature Mortality
-#> 3 Individuals threatened with total property loss
-#> 4 Mortality
-#> 5 Hours of labor lost
-#> 6 Hours of delay
-#> 7 Hours of delay
-#> variants
-#> 1 N/A
-#> 2 N/A
-#> 3 Without Adaptation, With Adaptation
-#> 4 N/A
-#> 5 N/A
-#> 6 No Adaptation, Proactive Adaptation
-#> 7 Without Adaptation, With Adaptation
-
-### Run SV Module with defaults for "Coastal Properties" without saving
-df_sv <- run_fredi_sv(sector="Coastal Properties")
-#> Running FrEDI SV for sector 'Coastal Properties':
-#>
-#> Preparing driver scenario...
-#> Using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#>
-#> Preparing population scenario...
-#> Using default population scenario...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Coastal Properties", variant="Without Adaptation", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#>
-#> Calculating impacts for sector="Coastal Properties", variant="With Adaptation", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-### Run SV Module with defaults for "Extreme Temperature" without saving
-df_sv <- run_fredi_sv(sector="Extreme Temperature")
-#> Running FrEDI SV for sector 'Extreme Temperature':
-#>
-#> Preparing driver scenario...
-#> Using default temperature scenario...
-#>
-#> Preparing population scenario...
-#> Using default population scenario...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-### Load temperature scenarios
-load(gcamScenarios)
-#> Error in load(gcamScenarios): bad 'file' argument
-
-### Load population scenario
-load(popScenario)
-#> Error in load(popScenario): bad 'file' argument
-
-### Run SV Module for "Extreme Temperature" with custom population and temperature scenarios
-df_sv <- run_fredi_sv(sector = "Extreme Temperature", driverInput = gcamScenarios, popInput = popScenario)
-#> Running FrEDI SV for sector 'Extreme Temperature':
-#> Checking `driverInput` values...
-#> Checking scenarios in `driverInput`...
-#> Warning: `driverInput` has more than four distinct scenarios!
-#> Only the first four scenarios will be used...
-#> Checking `driverInput` values for temperature scenario...
-#> All temperature scenario columns present...
-#> Checking `popInput` values...
-#> All population scenario columns present in `popInput`...
-#>
-#> Preparing driver scenario...
-#> Using temperature scenario from user inputs...
-#>
-#> Preparing population scenario...
-#> Creating population scenario from user inputs...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_20"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_30"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_50"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-
+
run_fredi()
(calculate national totals, average across models, sum impact types, and interpolate between impact year estimates)run_fredi()
(calculate national totals, average across models, sum impact types, and interpolate between impact year estimates)convertTemps()
@@ -90,14 +90,14 @@ All functionsdefaultResults
+ gcamScenarios
run_fredi()
A dataframe containing the default outputs of run_fredi()
run_fredi()
and run_fredi_sv()
gcamScenarios
+ gdpDefault
run_fredi()
and run_fredi_sv()
run_fredi()
or run_fredi_methane()
.get_sectorInfo()
@@ -107,7 +107,7 @@ All functionsget_sv_sectorInfo()
import_inputs()
@@ -115,9 +115,9 @@ All functionspopScenario
+ popDefault
run_fredi()
and run_fredi_sv()
run_fredi()
, run_fredi_sv()
, and/or FrEDI:run_fredi_methane()
.run_fredi()
@@ -125,6 +125,11 @@ All functionsrun_fredi_methane() +
run_fredi_sv()
Population scenario to use as an input to run_fredi()
and run_fredi_sv()
- Source: R/data.R
- popScenario.Rd
A dataframe containing a population scenario to be passed as an input to run_fredi()
and run_fredi_sv()
.
Format
-A data frame with 14,259 rows and 5 columns:
- year -
Year
-
-- region -
Region of U.S. ("Midwest", "Northeast", "Northern Plains", "Northwest", "Southeast", "Southern Plains", and "Southwest")
-
-- state -
One of 48 contiguous U.S. states or the District of Columbia
-
-- postal -
Postal code abbreviation associated with the state
-
-- state_pop -
State population for associated region and year
-
-
-
Details
-This dataframe contains population projections at the state level from the Integrated Climate and Land Use Scenarios version 2 (ICLUSv2) model (Bierwagen et al, 2010; EPA 2017) under the Median variant projection of United Nations (2015).
-Bierwagen, B., D. M. Theobald, C. R. Pyke, A. Choate, P. Groth, J. V. Thomas, and P. Morefield. 2010. “National housing and impervious surface scenarios for integrated climate impact assessments.” Proc. Natl. Acad. Sci. 107 (49): 20887–20892. https://doi.org/10.1073/pnas.1002096107.
-EPA. 2017. Multi-Model Framework for Quantitative Sectoral Impacts Analysis: A technical report for the Fourth National Climate Assessment. U.S. Environmental Protection Agency, EPA 430-R-17-001.
-United Nations. 2015. World population prospects: The 2015 revision. New York: United Nations, Department of Economic and Social Affairs, Population Division.
-Usage
run_fredi(
- inputsList = list(tempInput = NULL, slrInput = NULL, gdpInput = NULL, popInput = NULL),
+ inputsList = list(temp = NULL, slr = NULL, gdp = NULL, pop = NULL),
sectorList = NULL,
aggLevels = c("national", "modelaverage", "impactyear", "impacttype"),
elasticity = 1,
@@ -93,8 +93,8 @@ Usage
Arguments
- - inputsList=NULL
-A list of named elements named elements (names(inputsList) = c("tempInput", "slrInput", "gdpInput", "popInput")
), each containing data frames of custom temperature, global mean sea level rise (GMSL), gross domestic product (GDP), and/or state-level population trajectories, respectively, over a continuous period in the range 2010 to 2300. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population and GDP scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
+ - inputsList=list(gdp=NULL, pop=NULL, temp=NULL, slr=NULL)
+A list with named elements (gdp
, pop
, temp
, and/or slr
), each containing data frames of custom scenarios for gross domestic product (GDP), state-level population, temperature, and/or global mean sea level rise (GMSL) trajectories, respectively, over a continuous period. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population and GDP scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
- sectorList=NULL
@@ -144,40 +144,40 @@ Value
Details
This function allows users to project annual average climate change impacts through 2300 (2010-2300) for available sectors. run_fredi()
is the main function in the FrEDI R package, described elsewhere (See https://epa.gov/cira/FrEDI for more information).
-Users can specify an optional list of custom scenarios with inputsList
(for more information on the format of inputs, see import_inputs()
). The function import_inputs()
can be used to importing custom scenarios from CSV files. import_inputs()
returns a list with elements tempInput
, slrInput
, gdpInput
, and popInput
, with each containing a data frame with a custom scenario for temperature, GMSL, GDP, and state-level population, respectively. If a user imports scenarios using import_inputs()
, they can pass the outputs of import_inputs()
directly to the run_fredi()
argument inputsList
. Note that the documentation for import_inputs()
can also provide additional guidance and specification on the formats for each scenario type.
-If inputsList = NULL
, run_fredi()
uses defaults for temperature, SLR, GDP, and population. Otherwise, run_fredi()
looks for a list object passed to the argument inputsList
. Within that list, run_fredi()
looks for list elements tempInput
, slrInput
, gdpInput
, and popInput
containing data frames with custom scenarios for temperature, GMSL, GDP, and state population, respectively. run_fredi()
will default back to the default scenarios for any list elements that empty or NULL
(in other words, running run_fredi(inputsList = list())
returns the same outputs as running run_fredi()
).
Temperature Inputs. The input temperature scenario requires CONUS temperatures in degrees Celsius relative to 1995 (degrees of warming relative to the baseline year--i.e., the central year of the 1986-2005 baseline). CONUS temperature values must be greater than or equal to zero degrees Celsius.
Users can convert global temperatures to CONUS temperatures using convertTemps(from = "global")
(or by specifying import_inputs(temptype = "global")
when using import_inputs()
to import a temperature scenario from a CSV file).
-tempInput
requires a data frame object with two columns with names "year"
, and "temp_C"
containing the year and CONUS temperatures in degrees Celsius, respectively.
-Temperature inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for temperature (i.e., inputsList = list(tempInput = NULL)
, run_fredi()
uses a default temperature scenario.
-
-SLR Inputs. The input SLR scenario requires values for changes in global mean sea level rise (GMSL) heights in centimeters (cm). GMSL heights must be greater than or equal to zero.
slrInput
requires a data frame object with two columns with names "year"
, "slr_cm"
containing the year and global mean sea level rise (GMSL) in centimeters, respectively.
-SLR inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for SLR (i.e., inputsList = list(slrInput = NULL)
, run_fredi()
first converts the input or default CONUS temperature scenario to global temperatures (using convertTemps()
) and then converts the global temperatures to a global mean sea level rise (GMSL) height in centimeters (using temps2slr()
).
-
-GDP Inputs. The input scenario for gross domestic product (GDP) requires national GDP values in 2015$. GDP values must be greater than or equal to zero.
gdpInput
requires a data frame object with two columns with names "year"
, and "gdp_usd"
containing the year and the national GDP, respectively. GDP values must be greater than or equal to zero.
+Users can specify an optional list of custom scenarios with inputsList
(for more information on the format of inputs, see import_inputs()
). The function import_inputs()
can be used to importing custom scenarios from CSV files. import_inputs()
returns a list with named elements gdp
, pop
, temp
, and slr
, with each containing a data frame with a custom scenario for GDP, state-level population, temperature, and/or GMSL respectively. If a user imports scenarios using import_inputs()
, they can pass the outputs of import_inputs()
directly to the run_fredi()
argument inputsList
. Note that the documentation for import_inputs()
can also provide additional guidance and specification on the formats for each scenario type.
+Otherwise, run_fredi()
looks for a list object passed to the argument inputsList
. Within that list, run_fredi()
looks for named list elements -- gdp
, pop
, temp
, and/or slr
-- each containing a data frame with a custom scenario for GDP, state population, temperature, and/or GMSL, respectively. If inputsList = NULL
or inputsList = list()
(default), run_fredi()
uses default trajectories for GDP, population, temperature, and SLR (see gdpDefault, popDefault, and gcamScenarios for more information). run_fredi()
will default back to the default scenarios for any list elements that empty or NULL
(in other words, running run_fredi(inputsList = list())
returns the same outputs as running run_fredi()
).
GDP Inputs. The input scenario for gross domestic product (GDP) requires national GDP values in 2015$. GDP values must be greater than or equal to zero.
gdp
requires a data frame object with two columns with names "year"
, and "gdp_usd"
containing the year and the national GDP, respectively. GDP values must be greater than or equal to zero.
GDP inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for GDP (i.e., inputsList = list(gdpInput = NULL)
, run_fredi()
uses a default GDP scenario.
+If the user does not specify an input scenario for GDP (i.e., inputsList = list(gdp = NULL)
, run_fredi()
uses a default GDP scenario.
-Population Inputs. The input population scenario requires state-level population values. Population values must be greater than or equal to zero.
popInput
requires a data frame object with five columns with names "region"
, "state"
, "postal"
, "year"
, and "state"
containing the year, the NCA region name, the state name, the postal code abbreviation for the state, and the state population, respectively.
+Population Inputs. The input population scenario requires state-level population values. Population values must be greater than or equal to zero.
pop
requires a data frame object with five columns with names "region"
, "state"
, "postal"
, "year"
, and "pop"
containing the year, the NCA region name (one of "Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
), the state name, the postal code abbreviation for the state, and the state population, respectively.
Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
-If the user does not specify an input scenario for population (i.e., inputsList = list(popInput = NULL)
, run_fredi()
uses a default population scenario.
+If the user does not specify an input scenario for population (i.e., inputsList = list(pop = NULL)
, run_fredi()
uses a default population scenario.
+
+Temperature Inputs. The input temperature scenario requires CONUS temperatures in degrees Celsius relative to 1995 (degrees of warming relative to the baseline year--i.e., the central year of the 1986-2005 baseline). CONUS temperature values must be greater than or equal to zero degrees Celsius.
Users can convert global temperatures to CONUS temperatures using convertTemps(from = "global")
(or by specifying import_inputs(temptype = "global")
when using import_inputs()
to import a temperature scenario from a CSV file).
+temp
requires a data frame object with two columns with names "year"
, and "temp_C"
containing the year and CONUS temperatures in degrees Celsius, respectively.
+Temperature inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+If the user does not specify an input scenario for temperature (i.e., inputsList = list(temp = NULL)
, run_fredi()
uses a default temperature scenario.
+
+SLR Inputs. The input SLR scenario requires values for changes in global mean sea level rise (GMSL) heights in centimeters (cm). GMSL heights must be greater than or equal to zero.
slr
requires a data frame object with two columns with names "year"
, "slr_cm"
containing the year and global mean sea level rise (GMSL) in centimeters, respectively.
+SLR inputs must have at least one non-missing value in 2000 or earlier and at least one non-missing value in or after the final analysis year (as specified by maxYear
).
+If the user does not specify an input scenario for SLR (i.e., inputsList = list(slr = NULL)
, run_fredi()
first converts the input or default CONUS temperature scenario to global temperatures (using convertTemps()
) and then converts the global temperatures to a global mean sea level rise (GMSL) height in centimeters (using temps2slr()
).
-
run_fredi()
linearly interpolates missing annual values for all input scenarios using non-missing values (each scenario requires at least two non-missing values as detailed above for each scenario type). After interpolation of the input scenarios, run_fredi()
subsets the input scenarios to values within the analysis period.
Temperatures are interpolated using 1995 as the baseline year (i.e., the central year of the 1986-2005 baseline) and GMSL is interpolated using 2000 as the baseline year. In other words, temperature (in degrees Celsius) is set to zero for the year 1995, whereas GMSL is set to zero for the year 2000. The interpolated temperature and GMSL scenarios are combined into a column called driverValue
, along with additional columns for year, the driver unit (column "driverUnit"
, with driverUnit = "degrees Celsius"
and driverUnit = "cm"
for temperature- and SLR-driven sectors, respectively), and the associated model type (column "model_type"
, with model_type = "GCM"
and model_type = "SLR"
for temperature- and SLR-driven sectors, respectively
-run_fredi()
calculations national population from state-level values and then calculates GDP per capita from values for GDP and national population. Values for state population, national population, national GDP (in 2015$), and national per capita GDP (in 2015$/capita) are provided in the results data frame in columns "state_pop"
, "national_pop"
, "gdp_usd"
, and "gdp_percap"
, respectively.
+
run_fredi()
linearly interpolates missing annual values for all input scenarios using non-missing values (each scenario requires at least two non-missing values as detailed above for each scenario type). After interpolation of the input scenarios, run_fredi()
subsets the input scenarios to values within the analysis period.
Temperatures are interpolated using 1995 as the baseline year (i.e., the central year of the 1986-2005 baseline) and GMSL is interpolated using 2000 as the baseline year. In other words, temperature (in degrees Celsius) is set to zero for the year 1995, whereas GMSL is set to zero for the year 2000. The interpolated temperature and GMSL scenarios are combined into a column called driverValue
, along with additional columns for year, the driver unit (column "driverUnit"
, with driverUnit = "degrees Celsius"
and driverUnit = "cm"
for temperature- and SLR-driven sectors, respectively), and the associated model type (column "model_type"
, with model_type = "GCM"
and model_type = "SLR"
for temperature- and SLR-driven sectors, respectively.
+run_fredi()
calculates national population from state-level values and then calculates GDP per capita from values for GDP and national population. Values for state population, national population, national GDP (in 2015$), and national per capita GDP (in 2015$/capita) are provided in the results data frame in columns "pop"
, "national_pop"
, "gdp_usd"
, and "gdp_percap"
, respectively.
By default, run_fredi()
will calculate impacts for all sectors included in the tool. Alternatively, users can pass a character vector specifying a single sector or a subset of sectors using the sectorList
argument. To see a list of sectors included within FrEDI, run get_sectorInfo()
. If sectorList = NULL
(default), all sectors are included.
By default, run_fredi()
calculates impacts starting in the year 2010 and ending in 2100. Specify an alternative end year for the analysis using the maxYear
argument. maxYear
has a default value of 2100
and minimum and maximum values of 2011
and 2300
, respectively. Alternatively, users can set argument thru2300 = TRUE
to override the maxYear
argument and set maxYear = 2300
. Note that the default scenarios included within FrEDI stop in the year 2100; users must provide custom input scenarios out to the desired end year and specify a maxYear >= 2100
(and maxYear <= 2300
) in order to return non-missing values for years after 2100.
Annual impacts for each sector, variant, impact type, and impact year combination included in the model are calculated by multiplying scaled climate impacts by a physical scalar and economic scalars and multipliers. Some sectors use Value of a Statistical Life (VSL) to adjust the value non-linearly over time. run_fredi()
uses a default value of elasticity = 1
to adjust VSL for applicable sectors and impacts (the default value of elasticity = 1
keeps VSL constant over time). A custom elasticity can be passed to the elasticity
argument. Applicable sectors and impacts are *Climate-Driven Changes in Air Quality (all impact types), ATS Temperature-Related Mortality (impactType = "N/A"
; i.e., all impact types), CIL Temperature-Related Mortality, Extreme Temperature (all impact types), Suicide (impactType = "N/A"
; i.e., all impact types), Southwest Dust (impactType = "All Mortality"
), Valley Fever (impactType = "Mortality"
), Vibriosis (impactType = "N/A"
; i.e., all impact types), and Wildfire (impactType = "Mortality"
).
run_fredi()
aggregates or summarizes results to level(s) of aggregation specified by the user (passed to aggLevels
) using the post-processing helper function aggregate_impacts()
. Users can specify all aggregation levels at once by specifying aggLevels = "all"
(default) or no aggregation levels (aggLevels = "none"
). Users can specify a single aggregation level or multiple aggregation levels by passing a single character string or character vector to aggLevels
. Options for aggregation include calculating national totals (aggLevels = "national"
), averaging across model types and models (aggLevels = "modelaverage"
), summing over all impact types (aggLevels = "impacttype"
), and interpolating between impact year estimates (aggLevels = "impactYear"
).
-If the user specifies aggLevels = "none"
, run_fredi()
returns a data frame with columns: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, "state_pop"
, "year"
, "physical_impacts"
, and "annual_impacts"
.
Columns "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, and "model"
all contain observation identifiers (sector name, variant, impact type, impact year, region, state, state postal code abbreviation, model type, and model, respectively).
+If the user specifies aggLevels = "none"
, run_fredi()
returns a data frame with columns: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, "pop"
, "year"
, "physical_impacts"
, and "annual_impacts"
.
Columns "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, and "model"
all contain observation identifiers (sector name, variant, impact type, impact year, region, state, state postal code abbreviation, model type, and model, respectively).
Columns "sectorprimary"
and "includeaggregate"
contain values that provide information about how to treat sectors and when aggregating over sectors (e.g., summing impacts across sectors). Note that FrEDI does not currently provide functionality to aggregate over sectors; this information is provided for user convenience.
Column "sectorprimary"
contains values indicating which variant to use as the primary one for each sector: sectorprimary = 1
for primary variants and sectorprimary = 0
for non-primary variants. When aggregating impacts over sectors, users should filter the outputs of run_fredi()
to variants with sectorprimary == 1
.
Column "includeaggregate"
contains values that provide information about how to treat sectors when aggregating over sectors (e.g., summing impacts across sectors). Sectors that have a value of includeaggregate == 0
should be dropped when aggregating results over sectors, to avoid potential double-counting of impacts for similar sectors. For instance, sectors ATS Temperature-Related Mortality, CIL Temperature-Related Mortality, and Extreme Temperature have values for temperature-related mortality. To avoid double counting, outputs of run_fredi()
should be filtered to values for which includeaggregate > 0
. Sectors with a value of includeaggregate > 0
can be included when aggregating over sectors; most sectors with a value of includeaggregate > 0
will have a value of includeaggregate = 1
. Values of includeaggregate > 1
flag additional information about sectors; currently, only the Suicide sector has a value of includeaggregate > 1
, with a value of includeaggregate = 2
. This flag indicates that the impacts from Suicide can be included when summing values across sectors, but may have some overlap with impacts from ATS Temperature-Related Mortality. For more information about the potential overlap between impacts for ATS Temperature-Related Mortality and Suicide, visit the technical documentation at https://epa.gov/cira/FrEDI/,
Columns "driverType"
, "driverUnit"
, and "driverValue"
contain information about the temperature and SLR scenarios.
-Columns "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "state_pop"
contain information about the GDP and population scenarios.
+Columns "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "pop"
contain information about the GDP and population scenarios.
Columns "physicalmeasure"
and "physical_impacts"
contain information about physical impacts.
Column "annual_impacts"
contains information on the economic value associated with annual impacts.
If the user specifies aggLevels = "all"
or other combinations of aggregation levels, run_fredi()
passes the results data frame and the aggLevels
argument to the aggregate_impacts()
function. aggregate_impacts()
then performs the following calculations, using the default grouping columns for the aggregate_impacts()
: "sector"
, "variant"
, "impactType"
, "impactYear"
, "region"
, "state"
, "postal"
, "model_type"
, "model"
, "sectorprimary"
, "includeaggregate"
, "physicalmeasure"
, and "year"
(note that the "variant"
column referred to below contains information about the variant name (or “N/A”
), as applicable).
-Aggregation Level Description impactyear
To aggregate over impact years, aggregate_impacts()
first separates results for sectors with only one impact year estimate (i.e., impactYear = "N/A"
) from from observations with multiple impact year estimates (i.e., sectors with results for both impactYear = "2010"
and impactYear = "2090"
). For these sectors with multiple impact years, physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
) are linearly interpolated between impact year estimates. For any model run years above 2090, annual results for sectors with multiple impact years return the 2090 estimate. The interpolated values are then row-bound to the results for sectors with a single impact year estimate, and column impactYear
set to impactYear = "Interpolation"
for all values. If "impactyear"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
aggregates over impact years before performing other types of aggregation. modelaverage
To aggregate over models for temperature-driven sectors, aggregate_impacts()
averages physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all GCM models present in the data. aggregate_impacts()
drops the column "model"
from the grouping columns when averaging over models. Averages exclude observations with missing values. However, If all values within a grouping are missing, the model average is set to NA
. The values in column "model"
are set to "Average"
for model averages and the model averages data frame is then row-bound to the main results data frame. For SLR-driven sectors, there is no need for additional model aggregation; these values already have model = "Interpolation"
. If "modelaverage"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years (if "impactyear"
present in aggLevels
or if aggLevels = "all"
) before aggregating over models. national
To aggregate values to the national level, aggregate_impacts()
sums physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all states present in the data. aggregate_impacts()
drops the columns "region"
, "state"
, and "postal"
when summing over states and regions. Years which have missing column data for all regions return as NA
. Values for columns "region"
, "state"
, and "postal"
are set to "National Total"
, All
, and US
, respectively. The data frame with national totals is then row-bound to the main results data frame. If "national"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years and/or models (if "impactyear"
and/or "modelaverage"
are present in aggLevels
or if aggLevels = "all"
) before aggregating over models. impacttype
To aggregate values over impact types, aggregate_impacts()
sums annual impacts (column "annual_impacts"
) across all impact types for each sector. aggregate_impacts()
drops the column "impactType"
and "physicalmeasure"
from the grouping columns when summing over impact types. Years which have missing column data for all impact types return as NA
. All values in column "impactType"
are set to "all"
. Aggregating over impact types, drops columns related to physical impacts (i.e., columns "physicalmeasure"
and "physical_impacts"
). These columns are dropped since aggregating over impact types for some sectors requires summing costs over different types of physical impacts, so reporting the physical impacts would be nonsensical.
After aggregating values, aggregate_impacts()
joins the data frame of impacts with information about "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "state_pop"
.
+Aggregation Level Description impactyear
To aggregate over impact years, aggregate_impacts()
first separates results for sectors with only one impact year estimate (i.e., impactYear = "N/A"
) from from observations with multiple impact year estimates (i.e., sectors with results for both impactYear = "2010"
and impactYear = "2090"
). For these sectors with multiple impact years, physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
) are linearly interpolated between impact year estimates. For any model run years above 2090, annual results for sectors with multiple impact years return the 2090 estimate. The interpolated values are then row-bound to the results for sectors with a single impact year estimate, and column impactYear
set to impactYear = "Interpolation"
for all values. If "impactyear"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
aggregates over impact years before performing other types of aggregation. modelaverage
To aggregate over models for temperature-driven sectors, aggregate_impacts()
averages physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all GCM models present in the data. aggregate_impacts()
drops the column "model"
from the grouping columns when averaging over models. Averages exclude observations with missing values. However, If all values within a grouping are missing, the model average is set to NA
. The values in column "model"
are set to "Average"
for model averages and the model averages data frame is then row-bound to the main results data frame. For SLR-driven sectors, there is no need for additional model aggregation; these values already have model = "Interpolation"
. If "modelaverage"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years (if "impactyear"
present in aggLevels
or if aggLevels = "all"
) before aggregating over models. national
To aggregate values to the national level, aggregate_impacts()
sums physical impacts and annual costs (columns "physical_impacts"
and "annual_impacts"
, respectively) across all states present in the data. aggregate_impacts()
drops the columns "region"
, "state"
, and "postal"
when summing over states and regions. Years which have missing column data for all regions return as NA
. Values for columns "region"
, "state"
, and "postal"
are set to "National Total"
, All
, and US
, respectively. The data frame with national totals is then row-bound to the main results data frame. If "national"
is included in aggLevels
(e.g., aggLevels = "all"
), aggregate_impacts()
first aggregates over impact years and/or models (if "impactyear"
and/or "modelaverage"
are present in aggLevels
or if aggLevels = "all"
) before aggregating over models. impacttype
To aggregate values over impact types, aggregate_impacts()
sums annual impacts (column "annual_impacts"
) across all impact types for each sector. aggregate_impacts()
drops the column "impactType"
and "physicalmeasure"
from the grouping columns when summing over impact types. Years which have missing column data for all impact types return as NA
. All values in column "impactType"
are set to "all"
. Aggregating over impact types, drops columns related to physical impacts (i.e., columns "physicalmeasure"
and "physical_impacts"
). These columns are dropped since aggregating over impact types for some sectors requires summing costs over different types of physical impacts, so reporting the physical impacts would be nonsensical.
After aggregating values, aggregate_impacts()
joins the data frame of impacts with information about "driverType"
, "driverUnit"
, "driverValue"
, "gdp_usd"
, "national_pop"
, "gdp_percap"
, and "pop"
.
If outputList = FALSE
(default), run_fredi()
returns a data frame of annual average impacts over the analysis period, for each sector, variant, impact type, impact year, region, state, model type ("GCM"
or "SLR"
), and model. If outputList = TRUE
, in addition to the data frame of impacts, run_fredi()
returns a list object containing information about values for function arguments, driver scenarios, and population and GDP scenarios.
@@ -190,16 +190,15 @@ Examples### Load FrEDI
require(FrEDI)
-### Run function with defaults (same as `defaultResults` dataset)
+### Run function with defaults
run1 <- run_fredi()
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from defaults...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -207,62 +206,71 @@ Examplesdata("gcamScenarios")
gcamScenarios |> glimpse()
#> Rows: 606
-#> Columns: 4
-#> $ year <int> 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2…
-#> $ temp_C <dbl> 0.1269649, 0.1575513, 0.1858310, 0.2101611, 0.2306551, 0.2444…
-#> $ slr_cm <dbl> 0.0000000, 0.2727356, 0.5552278, 0.8458496, 1.1430287, 1.4440…
-#> $ scenario <chr> "Hector_GCAM_v5.3_ECS_3.0_REF", "Hector_GCAM_v5.3_ECS_3.0_REF…
+#> Columns: 6
+#> $ year <int> 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20…
+#> $ temp_C_conus <dbl> 0.1804171, 0.2238804, 0.2640659, 0.2986389, 0.3277609, 0…
+#> $ temp_C_global <dbl> 0.1269649, 0.1575513, 0.1858310, 0.2101611, 0.2306551, 0…
+#> $ slr_cm <dbl> 0.0000000, 0.2727356, 0.5552278, 0.8458496, 1.1430287, 1…
+#> $ scenario <chr> "ECS_3.0_REF", "ECS_3.0_REF", "ECS_3.0_REF", "ECS_3.0_RE…
+#> $ model <chr> "Hector_GCAM_v5.3", "Hector_GCAM_v5.3", "Hector_GCAM_v5.…
### Load population scenario and glimpse data
-data(popScenario)
-popScenario |> glimpse()
+data("popDefault")
+popDefault |> glimpse()
#> Rows: 14,259
#> Columns: 5
-#> $ year <dbl> 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, …
#> $ region <chr> "Southeast", "Southeast", "Southeast", "Southeast", "Southea…
#> $ state <chr> "Alabama", "Alabama", "Alabama", "Alabama", "Alabama", "Alab…
#> $ postal <chr> "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", …
+#> $ year <int> 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, …
#> $ state_pop <dbl> 4779736, 4823623, 4867509, 4911396, 4955282, 4999169, 503604…
### Subset climate scenario
-temps1 <- gcamScenarios |> filter(scenario=="Hector_GCAM_v5.3_ECS_3.0_ref")
-temps1 <- temps1 |> mutate(temp_C = temp_C_global |> convertTemps(from="global"))
-#> Error in mutate(temps1, temp_C = convertTemps(temp_C_global, from = "global")): ℹ In argument: `temp_C = convertTemps(temp_C_global, from = "global")`.
-#> Caused by error:
-#> ! object 'temp_C_global' not found
-temps1 <- temps1 |> select(year, temp_C)
+temps1 <- gcamScenarios |> filter(scenario=="ECS_3.0_ref")
+temps1 <- temps1 |> select(year, temp_C_conus)
### Run custom scenario
-run2 <- run_fredi(inputsList=list(tempInput=temps1, popInput=popScenario))
-#> Checking input values...
-#> Creating temperature scenario from user inputs...
-#> Error in map(regions0, function(region_i) { df_i <- filter(data, region == region_i) x_i <- df_i[["year"]] y_i <- df_i[[column0]] new_i <- approx(x = x_i, y = y_i, xout = years, rule = rule, method = method) new_i <- as_tibble(new_i) new_i <- rename_at(new_i, c(cols0), ~cols1) new_i <- mutate(new_i, region = region_i) return(new_i)}): ℹ In index: 1.
-#> Caused by error in `approx()`:
-#> ! need at least two non-NA values to interpolate
+run2 <- run_fredi(inputsList=list(temp=temps1, pop=popDefault))
+#> Checking scenarios...
+#>
+#> Checking input values for pop inputs...
+#> Column "pop" not found in popfile data!
+#> Looking for columns with matches to the string "pop"...1 match found!
+#> Using column "", and renaming to "pop"...
+#> Data is missing the following required columns: state_pop!
+#> Dropping pop inputs from outputs.
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
+#>
+#> Finished.
### Load scenarios from file:
scenariosPath <- system.file(package="FrEDI") |> file.path("extdata","scenarios")
scenariosPath |> list.files()
-#> [1] "GCAM_scenario.csv" "State ICLUS Population.csv"
-#> [3] "slr_from_GCAM.csv"
+#> [1] "gcamDefault.csv" "gcamScenarios.csv" "gdpDefault.csv"
+#> [4] "popDefault.csv"
### SLR Scenario File Name
-slrInputFile <- scenariosPath |> file.path("slr_from_GCAM.csv")
+slrInputFile <- scenariosPath |> file.path("gcamDefault.csv")
### Population Scenario File Name
-popInputFile <- scenariosPath |> file.path("State ICLUS Population.csv")
+popInputFile <- scenariosPath |> file.path("popDefault.csv")
### Import inputs
-x_inputs <- import_inputs(slrfile=slrInputFile, popfile=popInputFile, popArea="state")
+x_inputs <- import_inputs(inputsList=list(slr=slrInputFile, pop=popInputFile), popArea="state")
#>
#> In import_inputs():
#> Loading data...
#> User specified slrfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/slr_from_GCAM.csv...
+#> Importing data from C:/Users/knoiva/AppData/Local/R/win-library/4.4/FrEDI/extdata/scenarios/gcamDefault.csv...
#> Data loaded.
#> User specified popfile...
-#> Importing data from C:/Program Files/R/R-4.4.0/library/FrEDI/extdata/scenarios/State ICLUS Population.csv...
+#> Importing data from C:/Users/knoiva/AppData/Local/R/win-library/4.4/FrEDI/extdata/scenarios/popDefault.csv...
#> Data loaded.
#>
#> Checking input values...
@@ -271,23 +279,37 @@ Examples#> Values passed.
#>
#> Checking input values for pop inputs...
-#> Column "pop" not found in popfile data!
-#> Looking for columns with matches to the string "pop"...1 match found!
-#> Using column "state_pop", and renaming to "state_pop"...
+#> Checking that all states, etc. are present...
+#>
+#> Checking inputs for unique regions, states...
+#> All regions present...
+#> All states present...
#> Values passed.
#>
#> Finished.
### Run custom scenarios
run3 <- run_fredi(inputsList=x_inputs)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
+#> Checking scenarios...
+#>
+#> Checking input values for slr inputs...
+#> Values passed.
+#>
+#> Checking input values for pop inputs...
+#> Checking that all states, etc. are present...
+#>
+#> Checking inputs for unique regions, states...
+#> All regions present...
+#> All states present...
+#> Values passed.
#> Creating SLR scenario from user inputs...
-#> No GDP scenario provided...Using default GDP scenario...
#> Creating population scenario from user inputs...
-#> Updating scalars...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
#> Formatting results...
+#> Aggregating impacts...
#>
#> Finished.
@@ -321,32 +343,37 @@ Examples
### Run for a single sector, with default inputs, no aggregation, and elasticity=1:
run4 <- run_fredi(sectorList="ATS Temperature-Related Mortality", aggLevels="none", elasticity=1)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#> No GDP scenario provided...Using default GDP scenario...
-#> Creating population scenario from defaults...
-#> Updating scalars...
+#> Checking scenarios...
#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
#> Formatting results...
#>
#> Finished.
### Set end year for analysis to 2110 -- messages user and returns a null value since default scenarios only have values out to 2100
run5 <- run_fredi(maxYear=2110)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Temperature scenario must have at least one non-missing value in or after the year 2110...
+#> Checking scenarios...
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
#>
-#> Exiting...
+#> Finished.
### Set end year for analysis to 2300 -- messages user and returns a null value since default scenarios only have values out to 2100)
run6 <- run_fredi(thru2300=TRUE)
-#> Checking input values...
-#> No temperature scenario provided...using default temperature scenario...
-#> Temperature scenario must have at least one non-missing value in or after the year 2300...
+#> Checking scenarios...
+#> Calculating impacts...
+#> Formatting initial results...
+#> Calculating temperature-driven scaled impacts...
+#> Calculating SLR-driven scaled impacts...
+#> Formatting results...
+#> Aggregating impacts...
#>
-#> Exiting...
+#> Finished.
@@ -358,11 +385,11 @@ Examples
- Developed by Corinne Hartin, Erin McDuffie, Karen Noiva.
+ Developed by Corinne Hartin, Erin McDuffie, Marcus Sarofim, Karen Noiva.
Usage
run_fredi_sv(
sector = NULL,
- driverInput = NULL,
- popInput = NULL,
+ inputsList = list(pop = NULL, temp = NULL, slr = NULL),
silent = TRUE,
.testing = FALSE
)
Argumentsget_sv_sectorInfo() for a list of available sectors).
-- driverInput
-A data frame of up to four custom scenarios for drivers (temperature or global mean sea level rise). driverInput
requires a data frame with columns of "year"
and "scenario"
. The data frame must also include a third column: "temp_C"
for temperature-driven sectors (containing temperature values in degrees Celsius of warming for the contiguous U.S.) or "slr_cm"
for sea level rise (SLR)-driven sectors (containing values for global mean sea level rise in centimeters). Run get_sv_sectorInfo(gcmOnly=TRUE)
to see temperature-driven sectors in the SV module and get_sv_sectorInfo(slrOnly=TRUE)
to see SLR-driven scenarios. Users can also pass a data frame with all four columns ("year"
, "scenario"
, "temp_C"
, and "slr_cm"
), in which case run_fredi_sv()
determines whether to use the "temp_C"
or "slr_cm"
column as the driver trajectory based on the specified sector. Driver inputs for all scenarios should start in the year 2000 or earlier. All scenarios must include at least two non-missing values (especially values before or at 2000 and at or after 2100). If any required columns are missing, run_fredi_sv()
will use the default temperature or sea level rise scenario from run_fredi()
. If the data frame passed to driverInput
has more than four unique scenarios, run_fredi_sv()
will only run the first four scenarios.
+- silent
+A logical (TRUE/FALSE
) value indicating the level of messaging desired by the user (defaults to silent=TRUE
)
-- popInput
-The input population scenario requires a data frame object with a single scenario of state-level population values.
The population scenario must have five columns with names "year"
, "region"
, "state"
, "postal"
, and "state_pop"
containing the year, the NCA region name, the state name, the postal code abbreviation (e.g., "ME" for "Maine") for the state, and the state population, respectively.
-popInput
only accepts a a single scenario, in contrast to driverInput
. In other words, run_fredi_sv()
uses the same population scenario for any and all driver scenarios passed to driverInput
.
-If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario.
+- inputsList=list(pop=NULL, temp=NULL, slr=NULL)
+A list with named elements (pop
, temp
, and/or slr
), each containing data frames of custom scenarios for state-level population, temperature, and/or global mean sea level rise (GMSL) trajectories, respectively, over a continuous period. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, see import_inputs()
.
pop. The input population scenario requires a data frame object with a single scenario of population values for each of the 48 U.S. states and the District of Columbia comprising the contiguous U.S. (CONUS).
The population scenario must have five columns with names "region"
, "state"
, "postal"
, "year"
, and "_pop"
containing the NCA region name ("Midwest"
, "Northeast"
, "Northern Plains"
, "Northwest"
, "Southeast"
, "Southern Plains"
, or "Southwest"
), the state name, the two-letter postal code abbreviation for the state (e.g., "ME"
for Maine), the year, and the state population, respectively.
+The input population scenario can only contain a single scenario, in contrast to values for temperature or SLR inputs. In other words, run_fredi_sv()
uses the same population scenario when running any and all of the temperature or SLR scenarios passed to run_fredi_sv()
.
+If the user does not specify an input scenario for population (i.e., popInput = NULL
, run_fredi_sv()
uses a default population scenario (see documentation for popScenario).
Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (2100).
Population values must be greater than or equal to zero.
+
+temp or slr. The input temperature or SLR scenario should be a data frame containing one or more custom scenarios. These inputs should be formulated similarly to those for run_fredi()
and import_inputs()
, with an additional column (scenario
) indicating the unique scenario identifier. Temperature and/or SLR input scenarios must have at least one non-missing value in the year 2000 or earlier and at least one non-missing value in or after the final analysis year (2100).
temp. Temperature inputs are used by run_fredi_sv()
with temperature-driven sectors; run get_sv_sectorInfo(gcmOnly=TRUE)
to get a list of the temperature-driven sectors available for the SV module. Temperature inputs require a data frame with columns of year
, temp_C
, and scenario
, respectively containing the year associated with an observation, temperature values for CONUS in degrees Celsius of warming relative to a 1995 baseline (where 1995 is the central year of a 1986-2005 baseline period -- i.e., values should start at zero in the year 1995), and a unique scenario identifier. If no temperature scenario is specified (i.e., inputsList$temp
is NULL
) when running a temperature-driven sector, run_fredi_sv()
will use a default temperature scenario (see FrEDI:gcamScenarios).
+slr. SLR inputs are used by run_fredi_sv()
with sea level rise-driven sectors; run get_sv_sectorInfo(slrOnly=TRUE)
to get a list of the SLR-driven sectors available for the SV module. SLR inputs require a data frame with columns of year
, slr_cm
, and scenario
, respectively containing the global mean sea level rise in centimeters relative to a 2000 baseline (i.e., values should start at zero in the year 2000), and a unique scenario identifier. If no SLR scenario is specified (i.e., inputsList$slr
is NULL
) when running a temperature-driven sector: if a user has supplied a temperature scenario (i.e., inputsList$temp
is not NULL
), run_fredi_sv()
will calculate sea level rise values from the temperature inputs using the temps2slr()
function; if no temperature scenario is provided, run_fredi_sv
will use a default SLR scenario (see FrEDI:gcamScenarios).
+
-
-- silent
-A logical (TRUE/FALSE
) value indicating the level of messaging desired by the user (defaults to silent=TRUE
).
-
A data frame of up to four custom scenarios for drivers (temperature or global mean sea level rise). driverInput
requires a data frame with columns of "year"
and "scenario"
. The data frame must also include a third column: "temp_C"
for temperature-driven sectors (containing temperature values in degrees Celsius of warming for the contiguous U.S.) or "slr_cm"
for sea level rise (SLR)-driven sectors (containing values for global mean sea level rise in centimeters). Run get_sv_sectorInfo(gcmOnly=TRUE)
to see temperature-driven sectors in the SV module and get_sv_sectorInfo(slrOnly=TRUE)
to see SLR-driven scenarios. Users can also pass a data frame with all four columns ("year"
, "scenario"
, "temp_C"
, and "slr_cm"
), in which case run_fredi_sv()
determines whether to use the "temp_C"
or "slr_cm"
column as the driver trajectory based on the specified sector. Driver inputs for all scenarios should start in the year 2000 or earlier. All scenarios must include at least two non-missing values (especially values before or at 2000 and at or after 2100). If any required columns are missing, run_fredi_sv()
will use the default temperature or sea level rise scenario from run_fredi()
. If the data frame passed to driverInput
has more than four unique scenarios, run_fredi_sv()
will only run the first four scenarios.
A logical (TRUE/FALSE
) value indicating the level of messaging desired by the user (defaults to silent=TRUE
)
The input population scenario requires a data frame object with a single scenario of state-level population values.
The population scenario must have five columns with names
"year"
,"region"
,"state"
,"postal"
, and"state_pop"
containing the year, the NCA region name, the state name, the postal code abbreviation (e.g., "ME" for "Maine") for the state, and the state population, respectively.
-popInput
only accepts a a single scenario, in contrast todriverInput
. In other words,run_fredi_sv()
uses the same population scenario for any and all driver scenarios passed todriverInput
.
-If the user does not specify an input scenario for population (i.e.,
popInput = NULL
,run_fredi_sv()
uses a default population scenario.
+- inputsList=list(pop=NULL, temp=NULL, slr=NULL) +
A list with named elements (
pop
,temp
, and/orslr
), each containing data frames of custom scenarios for state-level population, temperature, and/or global mean sea level rise (GMSL) trajectories, respectively, over a continuous period. Temperature and sea level rise inputs should start in 2000 or earlier. Values for population scenarios can start in 2010 or earlier. Values for each scenario type must be within reasonable ranges. For more information, seeimport_inputs()
.pop. The input population scenario requires a data frame object with a single scenario of population values for each of the 48 U.S. states and the District of Columbia comprising the contiguous U.S. (CONUS).
The population scenario must have five columns with names
"region"
,"state"
,"postal"
,"year"
, and"_pop"
containing the NCA region name ("Midwest"
,"Northeast"
,"Northern Plains"
,"Northwest"
,"Southeast"
,"Southern Plains"
, or"Southwest"
), the state name, the two-letter postal code abbreviation for the state (e.g.,"ME"
for Maine), the year, and the state population, respectively.
+The input population scenario can only contain a single scenario, in contrast to values for temperature or SLR inputs. In other words,
run_fredi_sv()
uses the same population scenario when running any and all of the temperature or SLR scenarios passed torun_fredi_sv()
.
+If the user does not specify an input scenario for population (i.e.,
popInput = NULL
,run_fredi_sv()
uses a default population scenario (see documentation for popScenario).Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (2100).
Population values must be greater than or equal to zero.
+
+temp or slr. The input temperature or SLR scenario should be a data frame containing one or more custom scenarios. These inputs should be formulated similarly to those for
run_fredi()
andimport_inputs()
, with an additional column (scenario
) indicating the unique scenario identifier. Temperature and/or SLR input scenarios must have at least one non-missing value in the year 2000 or earlier and at least one non-missing value in or after the final analysis year (2100).temp. Temperature inputs are used by
run_fredi_sv()
with temperature-driven sectors; runget_sv_sectorInfo(gcmOnly=TRUE)
to get a list of the temperature-driven sectors available for the SV module. Temperature inputs require a data frame with columns ofyear
,temp_C
, andscenario
, respectively containing the year associated with an observation, temperature values for CONUS in degrees Celsius of warming relative to a 1995 baseline (where 1995 is the central year of a 1986-2005 baseline period -- i.e., values should start at zero in the year 1995), and a unique scenario identifier. If no temperature scenario is specified (i.e.,inputsList$temp
isNULL
) when running a temperature-driven sector,run_fredi_sv()
will use a default temperature scenario (see FrEDI:gcamScenarios).
+slr. SLR inputs are used by
run_fredi_sv()
with sea level rise-driven sectors; runget_sv_sectorInfo(slrOnly=TRUE)
to get a list of the SLR-driven sectors available for the SV module. SLR inputs require a data frame with columns ofyear
,slr_cm
, andscenario
, respectively containing the global mean sea level rise in centimeters relative to a 2000 baseline (i.e., values should start at zero in the year 2000), and a unique scenario identifier. If no SLR scenario is specified (i.e.,inputsList$slr
isNULL
) when running a temperature-driven sector: if a user has supplied a temperature scenario (i.e.,inputsList$temp
is notNULL
),run_fredi_sv()
will calculate sea level rise values from the temperature inputs using thetemps2slr()
function; if no temperature scenario is provided,run_fredi_sv
will use a default SLR scenario (see FrEDI:gcamScenarios).
+
-
-- silent -
A logical (
TRUE/FALSE
) value indicating the level of messaging desired by the user (defaults tosilent=TRUE
).
-
Value
@@ -117,17 +116,8 @@Value
Detailsrun_fredi_sv()
projects annual climate change impacts for socially vulnerable (SV) populations throughout the 21st century (2010-2100) for available sectors, using default or user-specified population, temperature, and sea level rise (SLR) trajectories. run_fredi_sv()
is the main function for the FrEDI Social Vulnerability (SV) module in the FrEDI R package, described elsewhere (See https://epa.gov/cira/FrEDI for more information). The SV module extends the FrEDI framework to socially vulnerable populations using data underlying a 2021 U.S. Environmental Protection Agency (EPA) report on Climate Change and Social Vulnerability in the United States.
Users can run run_fredi_sv()
to generate annual physical impacts for SV groups for individual sectors. When running run_fredi_sv()
, users must specify one of the sectors in the SV module; use get_sv_sectorInfo()
for a list of available sectors.
run_fredi_sv()
can be run with default population and climate (temperature and SLR) trajectories or use run_fredi_sv()
to run custom scenarios. Running run_fredi_sv()
with custom climate scenarios requires passing a data frame of scenarios to the driverInput
argument. run_fredi_sv()
can also be run with a custom population scenario by passing a data frame of regional population trajectories to the popInput
argument; unlike climate scenarios, run_fredi_sv()
will only run a single scenario at a time.
driverInput
can take a data frame containing up to four custom scenarios for drivers (temperature or global mean sea level rise).driverInput
requires a data frame with columns of"year"
and"scenario"
. The data frame must also include a third column:"temp_C"
for temperature-driven sectors (containing temperature values in degrees Celsius of warming for the contiguous U.S.) or"slr_cm"
for sea level rise (SLR)-driven sectors (containing values for global mean sea level rise in centimeters). Runget_sv_sectorInfo(gcmOnly = TRUE)
to see temperature-driven sectors in the SV module andget_sv_sectorInfo(slrOnly = TRUE)
to see SLR-driven scenarios. Users can also pass a data frame with all four columns ("year"
,"scenario"
,"temp_C"
, and"slr_cm"
), in which caserun_fredi_sv()
determines whether to use the"temp_C"
or"slr_cm"
column as the driver trajectory based on the specified sector. If any required columns are missing,run_fredi_sv()
will use the default temperature or sea level rise scenario fromrun_fredi()
. If the data frame passed todriverInput
has more than four unique scenarios,run_fredi_sv()
will only run the first four scenarios.Temperature inputs must be temperature change in degrees Celsius for the contiguous U.S. (use
convertTemps()
to convert global temperatures to CONUS temperatures before passing todriverInput
) relative to a 1995 baseline (where 1995 is the central year of a 1986-2005 baseline period; values should start at zero in the year 1995).
-Sea level rise inputs must be in centimeters relative to a 2000 baseline (i.e., values should start at zero in the year 2000). Driver inputs for all scenarios should start in the year 2000 or earlier. All scenarios must include at least two non-missing values (especially values before or at 2000 and at or after 2100).
-
-The input population scenario requires a data frame object with a single scenario of state-level population values.
The population scenario must have five columns with names
"year"
,"region"
,"state"
,"postal"
, and"state_pop"
containing the year, the NCA region name, the state name, the postal code abbreviation (e.g., "ME" for "Maine") for the state, and the state population, respectively.
-popInput
only accepts a a single scenario, in contrast todriverInput
. In other words,run_fredi_sv()
uses the same population scenario for any and all driver scenarios passed todriverInput
.
-If the user does not specify an input scenario for population (i.e.,
popInput = NULL
,run_fredi_sv()
uses a default population scenario.
-Population inputs must have at least one non-missing value in 2010 or earlier and at least one non-missing value in or after the final analysis year (2100).
-Population values must be greater than or equal to zero. -The default regional population scenario is drawn from the Integrated Climate and Land Use Scenarios version 2 (ICLUSv2) model (Bierwagen et al, 2010; EPA 2017) under the Median variant projection of United Nations (United Nations, 2015). Note that the FrEDI SV default population scenario differs from the default population scenario used by
run_fredi()
.
-
-
The output of run_fredi_sv()
is an R data frame object containing average annual physical impacts for socially vulnerable groups, at the NCA region level and five-year increments.
run_fredi_sv()
can be run with default population and climate (temperature and SLR) trajectories or use run_fredi_sv()
to run custom scenarios. Running run_fredi_sv()
with custom climate scenarios requires passing a data frame of scenarios to the driverInput
argument. run_fredi_sv()
can also be run with a custom population scenario by passing a data frame of regional population trajectories to the popInput
argument; unlike climate scenarios, run_fredi_sv()
will only run a single scenario at a time.
The output of run_fredi_sv()
is an R data frame object containing average annual physical impacts for socially vulnerable groups, at the NCA region level and five-year increments.
References
@@ -141,163 +131,18 @@References
Examples
- ### Run SV Module with defaults without specifying sector
-df_sv <- run_fredi_sv()
-#> [1] "Please select a sector: "
-#> [1] "1. Air Quality - Childhood Asthma"
-#> [1] "2. Air Quality - Premature Mortality"
-#> [1] "3. Labor"
-#> [1] "4. Extreme Temperature"
-#> [1] "5. Roads"
-#> [1] "6. Transportation Impacts from High Tide Flooding"
-#> [1] "7. Coastal Properties"
-#> Warning: type 29 is unimplemented in 'type2char'
-#> Error in readline(prompt = sector_msg3): INTEGER() can only be applied to a 'integer', not a 'unknown type #29'
-
-### Return a character vector with the names of all of the sectors in the FrEDI SV Module:
-get_sv_sectorInfo()
-#> [1] "Air Quality - Childhood Asthma"
-#> [2] "Air Quality - Premature Mortality"
-#> [3] "Coastal Properties"
-#> [4] "Extreme Temperature"
-#> [5] "Labor"
-#> [6] "Roads"
-#> [7] "Transportation Impacts from High Tide Flooding"
-
-### Return a data frame of all of the sectors in the FrEDI SV Module (sector names and additional information)
-get_sv_sectorInfo(description=T)
-#> sector modelType driverUnit
-#> 1 Air Quality - Childhood Asthma GCM degrees Celsius
-#> 2 Air Quality - Premature Mortality GCM degrees Celsius
-#> 3 Coastal Properties SLR cm
-#> 4 Extreme Temperature GCM degrees Celsius
-#> 5 Labor GCM degrees Celsius
-#> 6 Roads GCM degrees Celsius
-#> 7 Transportation Impacts from High Tide Flooding SLR cm
-#> impactUnit
-#> 1 Childhood asthma cases
-#> 2 Premature Mortality
-#> 3 Individuals threatened with total property loss
-#> 4 Mortality
-#> 5 Hours of labor lost
-#> 6 Hours of delay
-#> 7 Hours of delay
-#> variants
-#> 1 N/A
-#> 2 N/A
-#> 3 Without Adaptation, With Adaptation
-#> 4 N/A
-#> 5 N/A
-#> 6 No Adaptation, Proactive Adaptation
-#> 7 Without Adaptation, With Adaptation
-
-### Run SV Module with defaults for "Coastal Properties" without saving
-df_sv <- run_fredi_sv(sector="Coastal Properties")
-#> Running FrEDI SV for sector 'Coastal Properties':
-#>
-#> Preparing driver scenario...
-#> Using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#>
-#> Preparing population scenario...
-#> Using default population scenario...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Coastal Properties", variant="Without Adaptation", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#>
-#> Calculating impacts for sector="Coastal Properties", variant="With Adaptation", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-### Run SV Module with defaults for "Extreme Temperature" without saving
-df_sv <- run_fredi_sv(sector="Extreme Temperature")
-#> Running FrEDI SV for sector 'Extreme Temperature':
-#>
-#> Preparing driver scenario...
-#> Using default temperature scenario...
-#>
-#> Preparing population scenario...
-#> Using default population scenario...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-### Load temperature scenarios
-load(gcamScenarios)
-#> Error in load(gcamScenarios): bad 'file' argument
-
-### Load population scenario
-load(popScenario)
-#> Error in load(popScenario): bad 'file' argument
-
-### Run SV Module for "Extreme Temperature" with custom population and temperature scenarios
-df_sv <- run_fredi_sv(sector = "Extreme Temperature", driverInput = gcamScenarios, popInput = popScenario)
-#> Running FrEDI SV for sector 'Extreme Temperature':
-#> Checking `driverInput` values...
-#> Checking scenarios in `driverInput`...
-#> Warning: `driverInput` has more than four distinct scenarios!
-#> Only the first four scenarios will be used...
-#> Checking `driverInput` values for temperature scenario...
-#> All temperature scenario columns present...
-#> Checking `popInput` values...
-#> All population scenario columns present in `popInput`...
-#>
-#> Preparing driver scenario...
-#> Using temperature scenario from user inputs...
-#>
-#> Preparing population scenario...
-#> Creating population scenario from user inputs...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_20"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_30"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_50"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-
+
### Run SV Module with defaults without specifying sector
-df_sv <- run_fredi_sv()
-#> [1] "Please select a sector: "
-#> [1] "1. Air Quality - Childhood Asthma"
-#> [1] "2. Air Quality - Premature Mortality"
-#> [1] "3. Labor"
-#> [1] "4. Extreme Temperature"
-#> [1] "5. Roads"
-#> [1] "6. Transportation Impacts from High Tide Flooding"
-#> [1] "7. Coastal Properties"
-#> Warning: type 29 is unimplemented in 'type2char'
-#> Error in readline(prompt = sector_msg3): INTEGER() can only be applied to a 'integer', not a 'unknown type #29'
-
-### Return a character vector with the names of all of the sectors in the FrEDI SV Module:
-get_sv_sectorInfo()
-#> [1] "Air Quality - Childhood Asthma"
-#> [2] "Air Quality - Premature Mortality"
-#> [3] "Coastal Properties"
-#> [4] "Extreme Temperature"
-#> [5] "Labor"
-#> [6] "Roads"
-#> [7] "Transportation Impacts from High Tide Flooding"
-
-### Return a data frame of all of the sectors in the FrEDI SV Module (sector names and additional information)
-get_sv_sectorInfo(description=T)
-#> sector modelType driverUnit
-#> 1 Air Quality - Childhood Asthma GCM degrees Celsius
-#> 2 Air Quality - Premature Mortality GCM degrees Celsius
-#> 3 Coastal Properties SLR cm
-#> 4 Extreme Temperature GCM degrees Celsius
-#> 5 Labor GCM degrees Celsius
-#> 6 Roads GCM degrees Celsius
-#> 7 Transportation Impacts from High Tide Flooding SLR cm
-#> impactUnit
-#> 1 Childhood asthma cases
-#> 2 Premature Mortality
-#> 3 Individuals threatened with total property loss
-#> 4 Mortality
-#> 5 Hours of labor lost
-#> 6 Hours of delay
-#> 7 Hours of delay
-#> variants
-#> 1 N/A
-#> 2 N/A
-#> 3 Without Adaptation, With Adaptation
-#> 4 N/A
-#> 5 N/A
-#> 6 No Adaptation, Proactive Adaptation
-#> 7 Without Adaptation, With Adaptation
-
-### Run SV Module with defaults for "Coastal Properties" without saving
-df_sv <- run_fredi_sv(sector="Coastal Properties")
-#> Running FrEDI SV for sector 'Coastal Properties':
-#>
-#> Preparing driver scenario...
-#> Using default temperature scenario...
-#> Creating SLR scenario from temperature scenario...
-#>
-#> Preparing population scenario...
-#> Using default population scenario...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Coastal Properties", variant="Without Adaptation", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#>
-#> Calculating impacts for sector="Coastal Properties", variant="With Adaptation", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-### Run SV Module with defaults for "Extreme Temperature" without saving
-df_sv <- run_fredi_sv(sector="Extreme Temperature")
-#> Running FrEDI SV for sector 'Extreme Temperature':
-#>
-#> Preparing driver scenario...
-#> Using default temperature scenario...
-#>
-#> Preparing population scenario...
-#> Using default population scenario...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="FrEDI Default"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-### Load temperature scenarios
-load(gcamScenarios)
-#> Error in load(gcamScenarios): bad 'file' argument
-
-### Load population scenario
-load(popScenario)
-#> Error in load(popScenario): bad 'file' argument
-
-### Run SV Module for "Extreme Temperature" with custom population and temperature scenarios
-df_sv <- run_fredi_sv(sector = "Extreme Temperature", driverInput = gcamScenarios, popInput = popScenario)
-#> Running FrEDI SV for sector 'Extreme Temperature':
-#> Checking `driverInput` values...
-#> Checking scenarios in `driverInput`...
-#> Warning: `driverInput` has more than four distinct scenarios!
-#> Only the first four scenarios will be used...
-#> Checking `driverInput` values for temperature scenario...
-#> All temperature scenario columns present...
-#> Checking `popInput` values...
-#> All population scenario columns present in `popInput`...
-#>
-#> Preparing driver scenario...
-#> Using temperature scenario from user inputs...
-#>
-#> Preparing population scenario...
-#> Creating population scenario from user inputs...
-#> Calculating county population from state population...
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_20"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_30"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#>
-#> Calculating impacts for sector="Extreme Temperature", variant="N/A", scenario="Hector_GCAM_v5.3_ECS_3.0_REF_50"...
-#> Calculating scaled impacts for each tract...
-#> Finished calculating tract-level impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Calculating total impacts for each tract...
-#> Finished calculating total impacts.
-#> Finished.
-
-