1 Contextualization

You have two options with this package: you can test the images that are already inside the package (1), or you can download via download_terraclimate function the images that you want to analyze (2). In this tutorial we will cover the second option.

2 Installing the package via GitHub

#devtools::install_github("FilgueirasR/cropZoning")

3 Loading the packages

library(cropZoning)                                
library(raster)

4 Areas of interest to use in download

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

see_brazil_biomes()
## [1] "Use the text format or the corresponding number:"
## [1] "Caatinga = 1"       "Cerrado = 2"        "Pantanal = 3"      
## [4] "Pampa = 4"          "Amazonia = 5"       "Mata Atlantica = 6"
see_brazil_states()
## [1] "Use the text format or 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"

5 Downloading the rasters of interest

This is the advanced process of running the cropZoning package (considering the download_terraclimate function). Now, you will see how you can download the TerraClimate images. The variable region = "biomes_brazil means that we are going to download 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 download the cerrado (savanna) biome, whis is sub_region = 2.

img_tmin <- download_terraclimate(dir_out = "C:/Users/betof/Desktop/teste/tmin", variable = "tmin", years = c(2000:2001), region = "biomes_brazil" , sub_region = 2)
img_tmax <- download_terraclimate(dir_out = "C:/Users/betof/Desktop/teste/tmax", variable = "tmax", years = c(2000:2001), region = "biomes_brazil" , sub_region = 2)

5.1 Ploting the images loaded

plot(img_tmin)

plot(img_tmax)

6 Calibrating the images based in AWS of INMET-Brazil

If you want to calibrate the images for Brazilian conditions, you can use the function tmin_calibration and tmax_calibration. As suggestion, you can enter with the slope and intercept values displayed in the examples of the functions. These values were obtained calibrating the Terraclimate images during 2000 to 2017 with all the automatic weather stations of National Meteorological Institute of Brazil (INMET).

img_tmin_cal <- tmin_calibration(slope = 0.830652, intercept = 4.187840, tmin_stack = img_tmin)
img_tmax_cal <- tmax_calibration(slope = 0.874787, intercept = 4.612894, tmax_stack = img_tmax)

7 Mean air temperature calculation

img_tmean <- tmean(tmax_stack = img_tmax_cal, tmin_stack = img_tmin_cal)

8 Calculating the tmean monthly

Now, we need to run the function tmean_monthly_stack.

start_date <- c('2000-01-01')
end_date <- c('2001-12-01')

tmean_monthly <- tmean_monthly_stack(tmean_stack = img_tmean, start_date = start_date, end_date = end_date)

9 Running the ccrop_zoning function

Now, we can run the ccrop_zoning. This function will calculate the climate crop zoning for the range of air temperature informed, which in this case is based in soybean. The result will be a raster image with five possible values (values from 1 to 5) according to what is explained below.

1 Pixel values = 1 - correspond to suitable air temperature (ST);

2 Pixel values = 2 - correspond to restricted due to low temperature (RLT);

3 Pixel values = 3 - correspond to restricted due to high temperature (RHT);

4 Pixel values = 4 - correspond to unsuitable due to low temperature (ULT);

5 Pixel values = 5 - correspond to unsuitable due to high temperature (UHT).

The thermal suitability ranges established were as follows:

ST - Temperature range (range from temp2 to temp3) considered optimal for the growth, development and production of the crop;

RLT - Temperature range (range from 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 from 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).

zoning <- cropZoning::ccrop_zoning(temp_per_month = tmean_monthly, temp1 = 10, temp2 = 20, temp3 = 30, temp4 = 40)

10 Plot the zoning result

Plot_ccrop_zoning function will plot the ccrop_zoning output. The result of the plotting will generate a ggplot object 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

zoning_plot <- plot_ccrop_zoning(zoning = zoning)
zoning_plot

More about Terraclimate can be found in 1.

Hope that you enjoyed!

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