1 Contextualization

You have two options with this package: you can test the images that are already in the package (1), or you can download via download_terraclimate function the images that you want to analyze (2). In this tutorial we will explain the first option. First of all, you have to know that the images available in cropDemand package is with a coarse spatial (0.25 degrees x 0.25 degrees) resolution and the package only brings images of 2017 (one image per month). It is important to remember that all the images that is already inside the package passed through a calibration process with all the automatic weather stations from INMET-Brazil.

2 Loading the packages

library(cropDemand)                                
library(raster)

3 Areas to load the raster images

To see the areas that you can analyzed directly, you have to run the see_brazil_biomes or see_brazil_states. These funtions have the purpose of guiding the users, when they are going to run the functions loadROI and download_terraclimate (not the case of this tutorial).

see_brazil_biomes()
## [1] "Use the corresponding number:"
## [1] "Caatinga = 1"       "Cerrado = 2"        "Pantanal = 3"      
## [4] "Pampa = 4"          "Amazonia = 5"       "Mata Atlantica = 6"
see_brazil_states()
## [1] "Use the corresponding number:"
##  [1] "Acre = 1"                 "Alagoas = 2"             
##  [3] "Amapa = 3"                "Amazonas = 4"            
##  [5] "Bahia = 5"                "Ceara = 6"               
##  [7] "Distrito Federal = 7"     "Espirito Santo = 8"      
##  [9] "Goias = 9"                "Maranhao = 10"           
## [11] "Mato Grosso = 11"         "Mato Grosso do Sul = 12" 
## [13] "Minas Gerais = 13"        "Parana = 14"             
## [15] "Paraiba = 15"             "Para = 16"               
## [17] "Pernambuco = 17"          "Piaui = 18"              
## [19] "Rio Grande do Norte = 19" "Rio Grande do Sul = 20"  
## [21] " Rio de Janeiro = 21"     "Rondonia = 22"           
## [23] "Roraima = 23"             "Santa Catarina = 24"     
## [25] "Sergipe = 25"             "Sao Paulo = 26"          
## [27] "Tocantins = 27"

4 Loading the rasters of interest

Simple process of running the cropDemand package (considering the LoadROI function). Now, you will see how you can load the images that are inside of the package. The region variable “biomes_brazil” means that we are loading some biome of Brazil and the sub_region variable identify what biome we are loading. The numbers of sub_region can be seen in see_brazil_biomes. For this tutorial we will load the amazon biome, whis is sub_region = 5.

img_eto <- loadROI(variable = "eto", region = "biomes_brazil" , sub_region = 5)
img_ppt <- loadROI(variable = "ppt", region = "biomes_brazil" , sub_region = 5)

4.1 Ploting the images loaded

plot(img_eto)

plot(img_ppt)

5 Running the waterDemand function

Now, we can run the waterDemand function, since we loaded only 12 images (one per month). This function will calculate the water balance parameters based on the available water capacity informed (AWC), which in this case is 100 (mm). The output of the water balance parameters for this function are:

1 ARM - storage;

2 ALT - alteration;

3 ETR - actual evapotranspiration;

4 DEF - deficit;

5 EXC - excess;

6 REP - replacement;

7 RET - withdrawal;

8 AWC_arm - percentage of storage compared to AWC.

cwd <- waterDemand(out_dir = "C:/Users/betof/Desktop/teste", ppt_stack = img_ppt, eto_stack = img_eto, AWC = 100)

6 Plot the cwd result (percentage of AWC)

plot_AWC(AWC_stack = cwd)

More about Terraclimate can be found in 1. The methodology based to run the water balance was based in 2.

Hope that you enjoyed!

7 References


  1. 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.↩︎

  2. Thornthwaite, C.W.; Mather, J.R. The water balance. Centerton, NJ: Drexel Institute of Technology - Laboratory of Climatology, 1955. 104p. (Publications in Climatology, vol. VIII, n.1).↩︎