Title: | Agro-Climatic Data by County |
---|---|
Description: | The functions are designed to calculate the most widely-used county-level variables in agricultural production or agricultural-climatic and weather analyses. To operate some functions in this package needs download of the bulk PRISM raster. See the examples, testing versions and more details from: <https://github.com/ysd2004/acdcR>. |
Authors: | Seong D. Yun [aut, cre] |
Maintainer: | Seong D. Yun <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0.0 |
Built: | 2025-01-22 06:12:23 UTC |
Source: | https://github.com/ysd2004/acdcr |
The function calculates the growing season degree days (GDDs) using single/double triangulation/sine methods.
gddcal(tL, tU, tMin, tMax, tMin2 = NULL, method = NULL)
gddcal(tL, tU, tMin, tMax, tMin2 = NULL, method = NULL)
tL |
Lower temperature threshold |
tU |
Upper temperature threshold |
tMin |
Minimum temperature |
tMax |
Maximum temperature |
tMin2 |
Minimum temperature for the second half day |
method |
GDD calculation methods (default = single sine method) |
gddcal
is a function for calculating growing season degree days (GDDs) through four approaches popularly used in agricultural production or relevant fields.
- method = 'stri'
: single triangulation method
- method = 'dtri'
: double triangulation method (need tMin2
)
- method = 'ssin'
: single sine method
- method = 'dsin'
: double sine method (need tMin2
)
The default is the single sine method. i.e., if method
is not specified, gddcal
uses the single sine method. For two double methods ('dtri'
and 'dsin'
), a second half day minimum temperature needs to be specified.
A numeric of growing season degree days (GDDs)
Zalom, F. G., P. B. Goodell, Lloyd T. Wilson, W. W. Barnett, and W. J. Bentley. (1983) "Degree-Days, the Calculation and Use of Heat Units in Pest Management." Division of Agriculture and Natural Resources, University of California. 1-11.
## Single Triangulation Method gddcal(55,90,50,82,'stri') ## Double Triangulation Method gddcal(55,90,50,82,45,'dtri') ## Single Sine Method gddcal(55,90,50,82) gddcal(55,90,50,82,'ssin') ## Double Sine Method gddcal(55,90,50,82,45,'dsin')
## Single Triangulation Method gddcal(55,90,50,82,'stri') ## Double Triangulation Method gddcal(55,90,50,82,45,'dtri') ## Single Sine Method gddcal(55,90,50,82) gddcal(55,90,50,82,'ssin') ## Double Sine Method gddcal(55,90,50,82,45,'dsin')
The function calculates the growing season degree days (GDDs) by grids or counties directly from a PRISM raster.
gddprism( minprism, maxprism, year, tL, tU, method = c("stri", "ssin"), out = NULL )
gddprism( minprism, maxprism, year, tL, tU, method = c("stri", "ssin"), out = NULL )
minprism |
A PRISM raster of the minimum temperature |
maxprism |
A PRISM raster of the maximum temperature |
year |
year of the PRIsM raster of minprism and maxprism |
tL |
Lower temperature threshold |
tU |
Upper temperature threshold |
method |
GDD calculation methods: single sine or single triangulation only (default = single sine method) |
out |
Output value type: GDDs by PRISM grids or Counties (default = Counties) |
gddprism
is a function for calculating growing season degree days (GDDs) by PRISM grids or Counties directly from a PRISM raster.
Only single methods (single sine or single triangulation) are applicable by specifying method.
- method = 'stri'
: single triangulation method
- method = 'ssin'
: single sine method (default)
The out
is to specify the output values.
- out = 'grid'
: GDDs by PRISM grids projected on the NLCD map
- out = 'stco'
: GDDs by Counties of 2017 Agricultural Census (default)
If out
is not specified, 'stco' is set as default.
When out='stco'
is specified, 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
To get a PRIMS raster, follow the instruction at https://prism.oregonstate.edu/documents/PRISM_downloads_FTP.pdf.
A data.frame including GDDs (gdd), PRISM grid numbers (gridNum), or FIPS codes (stco)
####################################################### ## Note: Need PRISM rasters to run this code ####################################################### ## Not run: ## PRISM data import maxdata <- raster('./PRISM_tmax_stable_4kmD1_19960701_bil.bil') mindata <- raster('./PRISM_tmin_stable_4kmD1_19960701_bil.bil') ## Single Sine Methods over Counties result1 <- gddprism(mindata,maxdata,1996,8,30,'ssin') result2 <- gddprism(mindata,maxdata,1996,8,30,'ssin','stco') ## Single Sine Method over PRISM grids result3 <- gddprism(mindata,maxdata,1996,8,30,'ssin','grid') ## Single Triangulation over Counties result4 <- gddprism(mindata,maxdata,1996,8,30,'stri') ## End(Not run)
####################################################### ## Note: Need PRISM rasters to run this code ####################################################### ## Not run: ## PRISM data import maxdata <- raster('./PRISM_tmax_stable_4kmD1_19960701_bil.bil') mindata <- raster('./PRISM_tmin_stable_4kmD1_19960701_bil.bil') ## Single Sine Methods over Counties result1 <- gddprism(mindata,maxdata,1996,8,30,'ssin') result2 <- gddprism(mindata,maxdata,1996,8,30,'ssin','stco') ## Single Sine Method over PRISM grids result3 <- gddprism(mindata,maxdata,1996,8,30,'ssin','grid') ## Single Triangulation over Counties result4 <- gddprism(mindata,maxdata,1996,8,30,'stri') ## End(Not run)
The function calculates agricultural area weighted county values from PRISM grid data.
grid2stco(griddata, year)
grid2stco(griddata, year)
griddata |
An output data.frame from |
year |
year of the griddata |
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
A data.frame of FIPS codes (stco) and growing degree days (GDDs) or precipitation (ppt)
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.
## 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)
## 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)
The function calculates the precipitation (mm) by grids or counties directly from a PRISM raster.
pptprism(mmprism, year, out = NULL)
pptprism(mmprism, year, out = NULL)
mmprism |
A PRISM raster of the precipitation |
year |
year of the PRIsM raster |
out |
Output value type: precipitation by PRISM grids or Counties (default = Counties) |
pptprism
is a function for calculating precipitation (mm) by PRISM grids or Counties directly from a PRISM raster.
The out
is to specify the output values.
- out = 'grid'
: precipitation by PRISM grids projected on the NLCD map
- out = 'stco'
: precipitation by Counties of 2017 Agricultural Census (default)
If out
is not specified, 'stco' is set as default.
When out='stco'
is specified, 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
To get a PRIMS raster, follow the instruction at https://prism.oregonstate.edu/documents/PRISM_downloads_FTP.pdf.
A data.frame including precipitation (ppt), PRISM grid numbers (gridNum), or FIPS codes (stco)
####################################################### ## Note: Need a PRISM raster to run this code ####################################################### ## Not run: ## PRISM data import pptdata <- raster('./PRISM_ppt_stable_4kmD2_19960701_bil.bil') ## precipitation over Counties result <- pptprism(pptdata,1996) result2 <- pptprism(pptdata,1996,'stco') ## precipitation over PRISM grids result3 <- pptprism(pptdata,1996,'grid') ## End(Not run)
####################################################### ## Note: Need a PRISM raster to run this code ####################################################### ## Not run: ## PRISM data import pptdata <- raster('./PRISM_ppt_stable_4kmD2_19960701_bil.bil') ## precipitation over Counties result <- pptprism(pptdata,1996) result2 <- pptprism(pptdata,1996,'stco') ## precipitation over PRISM grids result3 <- pptprism(pptdata,1996,'grid') ## End(Not run)