grid2stco {acdcR}R Documentation

Convert PRISM grid data to agricultural area weighted county data

Description

The function calculates agricultural area weighted county values from PRISM grid data.

Usage

grid2stco(griddata, year)

Arguments

griddata

An output data.frame from gddprism or pptprism

year

year of the griddata

Details

grid2stco converts an output data.frame from gddprism or pptprism to the county-level weighted average with agricultural areas in NLCD.
If a single PRISM result is converted from grid to stco, the results are the same with the stco specification in gddprism or pptprism.
This function would be helpful when cumulative precipitation or gdd are applied first and then calculate county-level values.
The GDDs and precipitations in Schlenker and Roberts (2009) are replicable with these functions.

The input of griddata should have the following variables.
- For an output of gddprism: gridNum, stco, and gdd
- For an output of pptprism: gridNum, stco, and ppt

With the specified data year of year, the weights are applied as:
- year < 2004: agricultural areas in 2001 NLCD
- year = 2004 or 2005: agricultural areas in 2004 NLCD
- year = 2006 or 2007: agricultural areas in 2006 NLCD
- year = 2008, 2009, or 2010: agricultural areas in 2008 NLCD
- year = 2011 or 2012: agricultural areas in 2011 NLCD
- year = 2013, 2014, or 2015: agricultural areas in 2013 NLCD
- year = 2016, 2017, or 2018: agricultural areas in 2016 NLCD
- year >= 2019: agricultural areas in 2019 NLCD

Value

A data.frame of FIPS codes (stco) and growing degree days (GDDs) or precipitation (ppt)

References

Schlenker, W. and M. Roberts. (2009) "Nonlinear temperature effects indicate severe damages to U.S. crop yields under climate change." Proceedings of the National Academy of Sciences (PNAS). 15594-15598.

See Also

gddprism, pptprism

Examples

## PRISM data import
#######################################################
## Note: Need a PRISM raster to run this code
#######################################################
## Not run: 
pptdata <- raster('./PRISM_ppt_stable_4kmD2_19960701_bil.bil')
## precipitation data by grid and stco
stcores <- pptprism(pptdata,1996,'stco')
gridres <- pptprism(pptdata,1996,'grid')
## Convert the gridres to stcores
converted <- grid2stco(gridres,1996)
## Compare the results
converted$ppt[1:10]
stcores$ppt[1:10]

## End(Not run)

[Package acdcR version 1.0.0 Index]