Type: | Package |
Title: | Climate Crop Zoning Based in Air Temperature for Brazil |
Version: | 1.0.3 |
Description: | Climate crop zoning based in minimum and maximum air temperature. The data used in the package are from 'TerraClimate' dataset (https://www.climatologylab.org/terraclimate.html), but, it have been calibrated with automatic weather stations of National Meteorological Institute of Brazil. The climate crop zoning of this package can be run for all the Brazilian territory. |
Encoding: | UTF-8 |
Language: | en-US |
RoxygenNote: | 7.1.1 |
License: | CC BY 4.0 |
Depends: | R (≥ 2.10) |
Imports: | terra, tidyr, sf, ncdf4, ggplot2 |
BugReports: | https://github.com/FilgueirasR/cropZoning/issues |
NeedsCompilation: | no |
Packaged: | 2023-10-10 23:18:50 UTC; betof |
Author: | Roberto Filgueiras
|
Maintainer: | Roberto Filgueiras <betofilgueiras@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2023-10-10 23:30:05 UTC |
Climate crop zoning based on monthly air temperature data
Description
This function will calculate the climate crop zoning for the range of air temperature informed. The result will be a raster image with five possible values (values of 1 to 5) according to what is explained below.
Pixel values = 1, correspond to suitable air temperature (ST);
Pixel values = 2, correspond to restricted due to low temperature (RLT);
Pixel values = 3, correspond to restricted due to high temperature (RHT);
Pixel values = 4, correspond to unsuitable due to low temperature (ULT);
Pixel values = 5, correspond to unsuitable due to high temperature (UHT).
The thermal suitability ranges established were as follows:
ST - Temperature range (range of temp2 to temp3) considered optimal for the growth, development and production of the crop;
RLT - Temperature range (range of temp2 to temp1) which the crop is able to develop, however, below its potential due to the air temperature values being slightly lower than those of the suitable range;
RHT - Temperature range (range of temp3 to temp4) which the crop is able to develop, however, below its potential due to the temperature values being slightly higher than those of the suitable range;
ULT - When temperature values are not suitable for commercial exploitation of the crop due to low air temperature (air temperature below the temp1);
UHT - When temperature values are not suitable for commercial exploitation of the crop due to high air temperature (air temperature above the temp4);
Usage
ccrop_zoning(temp_per_month, temp1, temp2, temp3, temp4)
Arguments
temp_per_month |
Rasterstack object with a monthly mean air temperature from a period of time |
temp1 |
unsuitable due to low temperature (numeric) |
temp2 |
minimum suitable temperature (numeric) |
temp3 |
maximum suitable temperature (numeric) |
temp4 |
unsuitable due to high temperature (numeric) |
Value
Returns a SpatRaster object of climate crop zoning based in air temperature.
Examples
## Not run:
### Example with Brazil states
see_brazil_states()
image_tmin<-loadROI(variable = "tmin",
region = "brazil",
sub_region = 13) # sub_regions 1:27
image_tmax<-loadROI(variable = "tmax",
region = "brazil",
sub_region = 13)
image_tmean <- tmean(tmax_stack = image_tmax, tmin_stack = image_tmin)
start_date <- c('2000-01-01')
end_date <- c('2017-12-01')
tmean_monthly <- tmean_monthly_stack(tmean_stack = img_tmean,
start_date = start_date,
end_date = end_date)
zoning <- ccrop_zoning(temp_per_month = tmean_monthly,
temp1 = 10 , temp2 = 20,
temp3 = 30, temp4 = 40)
## End(Not run)
Download of maximum and minimum air temperature from 'TerraClimate'
Description
This function will download the tmax and tmin images and will load a rasterstack according to the the region of interest (Region and sub_region). The images downloaded by this function are intended to be used for calculating the climatic zoning of crops. To calculate the climatic zoning of the crops, you first have to calculate the mean air temperature (function tmean) and the monthly air temperature (function tmean_monthly).
Usage
download_terraclimate(dir_out, variable, years, region, sub_region)
Arguments
dir_out |
Directory where you want to save the raster images that you are goind to download. |
variable |
Variable to download. The variables can be the minimum (tmin) or maximum (tmax) air temperature of 'TerraClimate' (Rasterstack). |
years |
The period in years that the function should download. |
region |
Use the "brazil" shapefile to extract the Rasterstack (variable) for one state (Brazilian state), or use the "biomes_brazil" to extract the Rasterstack (variable) for one biome of Brazil. |
sub_region |
You have two options in this section, if you choice the brazil (in region parameter) you need to choice the Brazilian states, but if you choice the biomes_brazil (in region parameter) you must choice one of Brazilian biomes. |
Value
Returns a Rasterstack of tmin (minimum air temperature) or tmax (maximum air temperature).
References
The images used in this package can be found in the paper: Abatzoglou, J.T., S.Z. Dobrowski, S.A. Parks, K.C. Hegewisch, 2018, Terraclimate, a high-resolution global dataset of monthly climate and climatic water balance from 1958-2015, Scientific Data.
Examples
## Not run:
### Downloading the minimum air temperature and maximum air temperature based on Brazil states.
see_brazil_states()
img <- download_terraclimate(
dir_out = "C:/teste/tmin/state", variable = "tmin",
years = c(2018:2019),
region = "brazil",
sub_region = 13
)
### Downloading the minimum air temperature and maximum air temperature based on Brazil states.
see_brazil_biomes()
img <- download_terraclimate(
dir_out = "C:/teste/tmin/biome", variable = "tmin",
years = c(2018:2019),
region = "biomes_brazil",
sub_region = 6
)
## End(Not run)
Load the data for the region of interest (ROI)
Description
This function will load the air temperature data (SpatRaster) for the region of interest (ROI). The images loaded by this function are intended to be used, as example, for calculating the climatic zoning of crops. To calculate the climatic zoning of the crops, you first have to calculate the mean air temperature (function tmean) and the monthly air temperature (function tmean_monthly).
Usage
loadROI(variable, region, sub_region)
Arguments
variable |
Stack of minimum (tmin) or maximum (tmax) air temperature (SpatRaster). |
region |
Use the "brazil" shapefile to extract the SpatRaster (variable) for one state (Brazilian state), or use the "biomes_brazil" to extract the Rasterstack (variable) for one biome of Brazil. |
sub_region |
You have two options in this section, if you choice the brazil (in region parameter) you need to choice the Brazilian states, but if you choice the biomes_brazil (in region parameter) you must choice one of Brazilian biomes. |
Value
Load the tmin image example (minimum air temperature) or tmax image example (maximum air temperature) rasterstack
References
The images used in this package can be found in the paper: Abatzoglou, J.T., S.Z. Dobrowski, S.A. Parks, K.C. Hegewisch, 2018, Terraclimate, a high-resolution global dataset of monthly climate and climatic water balance from 1958-2015, Scientific Data.
Examples
## Not run:
### Loading minimum air temperature and maximum air temperature based on Brazil states.
see_brazil_states()
image_tmin <-loadROI(variable = "tmin",
region = "brazil",
sub_region = 13) # sub_regions 1:27
image_tmax <-loadROI(variable = "tmax",
region = "brazil",
sub_region = 13)
### Loading minimum air temperature and maximum air temperature based on Brazil biomes.
see_brazil_biomes()
image_tmin <- loadROI(variable = tmin,
region = "biomes_brazil",
sub_region = 5)# sub regions: 1:6 (biomes)
image_tmax <-loadROI(variable = "tmax",
region = "biomes_brazil",
sub_region = 5)
## End(Not run)
Function to plot the climate crop zoning stack generated in ccrop_zoning
Description
This function will plot the ccrop_zoning output. The result of the plotting will generate a plot with the following classes.
Climatic zoning classes:
ST: Suitable air temperature
RLT: Restricted due to low temperature
RHT: Restricted due to high temperature
ULT: Unsuitable due to low temperature
UHT: Unsuitable due to high temperature
Usage
plot_ccrop_zoning(zoning)
Arguments
zoning |
A stack generated in ccrop_zoning |
Value
Returns a plot (ggplot object) with the monthly climate crop zoning based in air temperature.
Examples
### Data preparation
## Not run:
###ploting the cropzoning:
zoning_plot <- plot_ccrop_zoning(zoning)
## End(Not run)
Function to see the Brazilian biomes available in cropZoning package and how we can use it in the loadROI function
Description
This fuction will show the biomes available in the package and how we can call each biome polygon.
Usage
see_brazil_biomes()
Value
Returns a character strings listing the biomes available to run the cropZoning package.
Examples
## Not run:
see_brazil_biomes()
## End(Not run)
Function to see the Brazilian states available in cropZoning package and how we can use it in the loadROI function
Description
This function will show the Brazilian state available in the package and how we can call each state polygon.
Usage
see_brazil_states()
Value
Returns a character strings listing the the Brazilian states available to run the cropZoning package.
Examples
## Not run:
see_brazil_states()
## End(Not run)
Calibration of maximum air temperature from TerraClimate
Description
This function will calibrate the maximum air temperature from TerraClimate dataset based in the relationship with observed weather stations data.The values of slope and intercept informed in example correspond a calibration performed between 'Terraclimate' images and INMET automatic weather stations realized for all the brazilian territory.
Usage
tmax_calibration(slope, intercept, tmax_stack)
Arguments
slope |
the slope of the linear regression (numeric) |
intercept |
the intercept of the linear regression (numeric) |
tmax_stack |
stack of maximum air temperature |
Value
Returns a SpatRaster object of calibrated maximum air temperature.
Examples
## Not run:
tmax_cal<- tmax_calibration(slope = 0.874787, intercept = 4.612894 , tmax_stack = tmax);
## End(Not run)
Mean air temperature calculation
Description
This fuction will calculate the mean air temperature from minimum and maximum air temperature data.
Usage
tmean(tmax_stack, tmin_stack)
Arguments
tmax_stack |
stack of maximum air temperature |
tmin_stack |
stack of minimum air temperature |
Value
Returns a SpatRaster object of mean air temperature.
Examples
## Not run:
image_tmean <- tmean(tmax_stack = image_tmax, tmin_stack = image_tmin)
## End(Not run)
Monthly mean air temperature estimation to generate the climate crop zoning
Description
This function will calculate the mean monthly air temperature based on the period of time selected (start_date and end_date).
Usage
tmean_monthly_stack(tmean_stack, start_date, end_date)
Arguments
tmean_stack |
Stack of mean air temperature based on minimum and maximum air temperature Rasterstack |
start_date |
Date that start the investigation, should be in the following format (1958-01-01 /Year-Month-Day) |
end_date |
Date that end the investigation, should be in the following format (2017-12-31 /Year-Month-Day) |
Value
Returns a Rasterstack object with a monthly mean air temperature from a period of time.
Examples
## Not run:
start_date <- c('2000-01-01')
end_date <- c('2017-12-01')
tmean_monthly <- tmean_monthly_stack(tmean_stack = img_tmean,
start_date = start_date,
end_date = end_date)
## End(Not run)
Calibration of minimum air temperature from TerraClimate
Description
This function will calibrate the minimum air temperature from TerraClimate dataset based in the relationship with observed weather stations data. The values of slope and intercept informed in example correspond a calibration performed between 'Terraclimate' images and INMET automatic weather stations realized for all the brazilian territory.
Usage
tmin_calibration(slope, intercept, tmin_stack)
Arguments
slope |
the slope of the linear regression (numeric) |
intercept |
the intercept of the linear regression (numeric) |
tmin_stack |
stack of maximum air temperature |
Value
Returns a SpatRaster of calibrated minimum air temperature.
Examples
## Not run:
tmin_cal<- tmin_calibrated(slope = 0.830652, intercept = 4.187840, tmin_stack = tmin);
## End(Not run)