Title: | Spatial Crop Water Demand for Brazil |
---|---|
Description: | Estimation of crop water demand can be processed via this package. As example, the data from 'TerraClimate' dataset (<https://www.climatologylab.org/terraclimate.html>) calibrated with automatic weather stations of National Meteorological Institute of Brazil is available in a coarse spatial resolution to do the crop water demand. However, the user have also the option to download the variables directly from 'TerraClimate' repository with the download.terraclimate function and access the original 'TerraClimate' products. If the user believes that is necessary calibrate the variables, there is another function to do it. Lastly, the estimation of the crop water demand present in this package can be run for all the Brazilian territory with 'TerraClimate' dataset. |
Authors: | Roberto Filgueiras [aut, cre] , Luan P. Venancio [aut] , Catariny C. Aleman [aut] , Fernando F. da Cunha [aut] |
Maintainer: | Roberto Filgueiras <[email protected]> |
License: | CC BY 4.0 |
Version: | 1.0.3 |
Built: | 2024-11-02 04:27:49 UTC |
Source: | https://github.com/filgueirasr/cropdemand |
The aridity index (AI) is a numerical indicator used to quantify the degree of dryness of a climate at a given location. It is calculated as the ratio of annual precipitation to potential evapotranspiration.
ai_index_calculation(annual_img_ppt, annual_img_etp)
ai_index_calculation(annual_img_ppt, annual_img_etp)
annual_img_ppt |
rast image with the annual sum of the precipitation |
annual_img_etp |
rast image of annual sum of the potential evapotranspiration |
Returns a SpatRaster with the calculation.
## Not run: ai_index_img <- ai_index_calculation(annual_img_ppt, annual_img_etp); ## End(Not run)
## Not run: ai_index_img <- ai_index_calculation(annual_img_ppt, annual_img_etp); ## End(Not run)
This function will download the eto and ppt and will load a SpatRaster according to the the region of interest (Region and sub_region).
download_terraclimate(dir_out, variable, years, region, sub_region)
download_terraclimate(dir_out, variable, years, region, sub_region)
dir_out |
Directory where you want to save the raster images that you are goind to download. |
variable |
Variable to download. This function will download the eto or ppt (SpatRaster). |
years |
The period in years that the function should download images. |
region |
Use the "brazil" shapefile to extract the SpatRaster (variable) for one state (Brazilian state), or use the "biomes_brazil" to extract the SpatRaster (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. |
Download for the region of interest the ppt (Rainfall) or eto (reference evapotranspiration) SpatRaster
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.
## Not run: ### Downloading eto based on Brazil states. see_brazil_states() img<-download_terraclimate(dir_out, variable = "eto", years = c(2018:2019), region = "brazil", sub_region = 13) ### Downloading the ppt based on Brazil biomes. see_brazil_biomes() img<-download_terraclimate(dir_out, variable = "ppt", years = c(2018:2019), region = "biomes_brazil", sub_region = 6) ## End(Not run)
## Not run: ### Downloading eto based on Brazil states. see_brazil_states() img<-download_terraclimate(dir_out, variable = "eto", years = c(2018:2019), region = "brazil", sub_region = 13) ### Downloading the ppt based on Brazil biomes. see_brazil_biomes() img<-download_terraclimate(dir_out, variable = "ppt", years = c(2018:2019), region = "biomes_brazil", sub_region = 6) ## End(Not run)
This function will calibrate the reference evapotranspiration (eto) from TerraClimate dataset based in the relationship with observed weather stations data.
eto_calibration(slope, intercept, eto_stack)
eto_calibration(slope, intercept, eto_stack)
slope |
the slope of the linear regression (numeric). |
intercept |
the intercept of the linear regression (numeric). |
eto_stack |
stack of eto. |
Returns a SpatRaster of eto calibrated.
## Not run: eto_cal<- eto_calibration(slope = 0.930073, intercept = 22.399986, eto_stack = etp); ## End(Not run)
## Not run: eto_cal<- eto_calibration(slope = 0.930073, intercept = 22.399986, eto_stack = etp); ## End(Not run)
This fuction will load the evapotranspiration and rainfall data for the region of interest (ROI).
loadROI(variable, region, sub_region)
loadROI(variable, region, sub_region)
variable |
Stack of evapotranspiration or rainfall (SpatRaster). |
region |
Use the "brazil" shp file to extract the SpatRaster (variable) for one state (Brazilian state), or use the "biomes_brazil" to extract the SpatRaster (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. |
Load the reference evapotranspiration (eto) or rainfall (ppt) SpatRaster
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.
## Not run: #For Brazilian states see_brazil_states() image_etp<-loadROI(variable = "eto", region = "brazil", sub_region = 13) # sub_regions 1:27 image_rainfall<-loadROI(variable = "ppt", region = "brazil", sub_region = 13) #For Brazilian Biomes: see_brazil_biomes() image_tmin<- loadROI(variable = "eto", region = "biomes_brazil", sub_region = 2)# sub regions: 1:6 (biomes) ## End(Not run)
## Not run: #For Brazilian states see_brazil_states() image_etp<-loadROI(variable = "eto", region = "brazil", sub_region = 13) # sub_regions 1:27 image_rainfall<-loadROI(variable = "ppt", region = "brazil", sub_region = 13) #For Brazilian Biomes: see_brazil_biomes() image_tmin<- loadROI(variable = "eto", region = "biomes_brazil", sub_region = 2)# sub regions: 1:6 (biomes) ## End(Not run)
The function calculates the mean of the annual sum of the variables of interest.
mean_of_annual_sum_of_variables(list_dir_of_imgs)
mean_of_annual_sum_of_variables(list_dir_of_imgs)
list_dir_of_imgs |
directory containing the images downloaded in download_terraclimate |
Returns a SpatRaster with the calculation.
## Not run: annual_mean_ppt<- mean_of_annual_sum_of_variables(list_dir_of_imgs = C:/ppt_dir); ## End(Not run)
## Not run: annual_mean_ppt<- mean_of_annual_sum_of_variables(list_dir_of_imgs = C:/ppt_dir); ## End(Not run)
This function will calculate the mean monthly air temperature based on the period of time selected (start_date and end_date).
monthly_stack(stack, start_date, end_date)
monthly_stack(stack, start_date, end_date)
stack |
Stack of mean rainfall/reference evapotranspiration SpatRaster |
start_date |
Date that start the investigation, should be in the following format (2000-01-01 /Year-Month-Day) |
end_date |
Date that end the investigation, should be in the following format (2017-12-31 /Year-Month-Day) |
Returns a SpatRaster with a monthly mean air temperature from a period of time
## Not run: start_date <- c('2000-01-01') end_date <- c('2017-12-01') monthly_rainfall <- monthly_stack(stack = rainfall_stack, start_date = start_date, end_date = end_date) ## End(Not run)
## Not run: start_date <- c('2000-01-01') end_date <- c('2017-12-01') monthly_rainfall <- monthly_stack(stack = rainfall_stack, start_date = start_date, end_date = end_date) ## End(Not run)
This function will plot the monthly AWC
plot_AWC(AWC_stack)
plot_AWC(AWC_stack)
AWC_stack |
A SpatRaster generated in WaterDemand function |
Returns a plot (gg file) of monthly percentage of AWC
## Not run: plot_AWC(AWC_stack) ## End(Not run)
## Not run: plot_AWC(AWC_stack) ## End(Not run)
This fuction will calibrate the rainfall (ppt) from TerraClimate dataset based in the relationship with observed weather stations data.
ppt_calibration(slope, intercept, ppt_stack)
ppt_calibration(slope, intercept, ppt_stack)
slope |
the slope of the linear regression (numeric). |
intercept |
the intercept of the linear regression (numeric). |
ppt_stack |
stack of ppt. |
Returns a SpatRaster of ppt calibrated.
## Not run: ppt_cal<- ppt_calibration(slope = 0.7000972, intercept = 23.753785, ppt_stack = ppt); ## End(Not run)
## Not run: ppt_cal<- ppt_calibration(slope = 0.7000972, intercept = 23.753785, ppt_stack = ppt); ## End(Not run)
This function will show the biomes available in the package and how we can call each biome polygon.
see_brazil_biomes()
see_brazil_biomes()
The biomes information available to run the cropDemand package.
## Not run: see_brazil_biomes() ## End(Not run)
## Not run: see_brazil_biomes() ## End(Not run)
This function will show the Brazilian state available in the package and how we can call each state polygon.
see_brazil_states()
see_brazil_states()
The Brazilian state information available in the package to run the cropDemand package.
## Not run: see_brazil_states() ## End(Not run)
## Not run: see_brazil_states() ## End(Not run)
This function will calculate the water balance parameters based in the available water capacity informed (AWC). The output water balance parameters for this function are:
ARM - storage;
ALT - alteration;
ETR - actual evapotranspiration;
DEF - deficit;
EXC - excess;
REP - replacement;
RET - withdrawal;
AWC_arm - percentage of storage compared to AWC;
waterDemand(out_dir, ppt_stack, eto_stack, AWC)
waterDemand(out_dir, ppt_stack, eto_stack, AWC)
out_dir |
output directory where you want to save the variables |
ppt_stack |
Stack of mean rainfall Rasterstack calculated in monthly_stack function |
eto_stack |
Stack of mean evapotranspiration Rasterstack calculated in monthly_stack function |
AWC |
The available water capacity (AWC) that the function will use in the calculations. The AWC value must be chosen according to the crop (root system depth) you want to obtain the water balance. |
Returns multiple SpatRaster object as output (explained in description).
## Not run: cwd<- waterDemand(out_dir = "G:/My computer/test/CropWaterDemand", ppt_stack = rainfall_image, eto_stack = eto_image, AWC = 100) ## End(Not run)
## Not run: cwd<- waterDemand(out_dir = "G:/My computer/test/CropWaterDemand", ppt_stack = rainfall_image, eto_stack = eto_image, AWC = 100) ## End(Not run)