1 Contextualization

You have two options with this package: you can test the images that are already inside of 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 first option. First of all, you have to know that the images available in cropZoning 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 in the package passed through a calibration process using all the automatic weather stations from INMET-Brazil.

2 Installing

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

3 Loading the packages

library(cropZoning)                                
library(raster)

4 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 functions 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 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 Loading the rasters of interest

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

img_tmin <- loadROI(variable = "tmin", region = "brazil" , sub_region = 5)
img_tmax <- loadROI(variable = "tmax", region = "brazil" , sub_region = 5)

5.1 Ploting the images loaded

plot(img_tmin)

plot(img_tmax)

6 Mean temperature calculation

img_tmean <- tmean(tmax_stack = img_tmax, tmin_stack = img_tmin)

7 Calculating the tmean monthly

Although we entered only twelve images we have to run the the function tmean_monthly_stack due to names and dates padronization.

start_date <- c('2017-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)

8 Running the ccrop_zoning function

Now, we can run the ccrop_zoning function, since we loaded only 12 images (one per month). This function will calculate he climate crop zoning for the range of air temperature informed. 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)

9 Plot the zoning result

Plot_ccrop_zoning 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

zoning_plot <- plot_ccrop_zoning(zoning = zoning)
zoning_plot

More about Terraclimate can be found in 1.

Hope that you enjoyed!

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