forked from gabrielblain/CropWaterBalance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
526 lines (386 loc) · 14.7 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
---
editor_options:
markdown:
wrap: sentence
output: github_document
---
<!-- badges: start -->
[![R-CMD-check](https://github.com/gabrielblain/CropWaterBalance/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/gabrielblain/CropWaterBalance/actions/workflows/R-CMD-check.yaml) <!-- badges: end -->
# CropWaterBalance
Crop water balance accounting in the root zone for irrigation purposes.
# Basic Description
{CropWaterBalance} is an R package designed to assist users in irrigation scheduling based on the Water Balance Approach.
The package is capable of calculating reference evapotranspiration (ET0) through various methods and conducting crop water balance accounting.
Additionally, {CropWaterBalance} includes auxiliary functions for comparing different ET0 estimation methods, calculating descriptive statistics for ET0 and rainfall series, and estimating soil heat flux and water stress coefficient.
The functions `ET0_HS()`, `ET0_PT()`, and `ET0_PM()` are used to estimate daily ET0 amounts using the methods of Hargreaves-Samani, Priestley-Taylor, and FAO-56 Penman-Monteith, respectively.
The `Descriptive()` function is specifically designed to calculate descriptive statistics for ET0 and rainfall series, including sample mean, median, standard deviation, standard error, maximum value, minimum value, and frequency of zeros.
Additionally, the `Compare()` function may be used to calculate measures of accuracy and agreement between two ET0 or rainfall series.
The `Soil_Heat_Flux()` function uses average air temperature data to estimate the soil heat flux, and the `Water_Stress_Coef()` function calculates the water stress coefficient for a crop.
The package depends on R (\>= 2.10) and imports functions from the R packages {[PowerSDI](https://CRAN.R-project.org/package=PowerSDI/)} and {[lubridate](https://CRAN.R-project.org/package=lubridate)}.
# Installation
``` r
devtools::install_github("gabrielblain/CropWaterBalance")
```
# Basic Instructions
```{r, echo=FALSE, include=FALSE}
# Load the library for examples below (not included in output)
library(CropWaterBalance)
```
## Function ET0_PM()
Calculates daily reference evapotranspiration amounts using the Penman and Monteith method.
## Usage
```{r, eval=FALSE}
ET0_PM(Tavg,
Tmax,
Tmin,
Rn,
RH,
WS,
G = NULL,
Alt)
```
## Arguments
- Tavg: A vector, 1-column matrix or data frame with daily average air temperature.
- Tmax: A vector, 1-column matrix or data frame with daily maximum air temperature in Celsius degrees.
- Tmin: A vector, 1-column matrix or data frame with daily minimum air temperature in Celsius degrees.
- Rn: A vector, 1-column matrix or data frame with daily net radiation in MJ M-2 DAY-1.
- RH: A vector, 1-column matrix or data frame with daily relative Humidity in %.
- WS: A vector, 1-column matrix or data frame with daily wind speed in M S-1.
- G: Optional. A vector, 1-column matrix or data frame with daily soil heat flux in MJ M-2 DAY-1. Default is `NULL` and if `NULL` it is assumed to be zero. May be provided by Soil_Heat_Flux.
- Alt: A single number defining the altitude at crop's location in metres.
## Value
Daily reference evapotranspiration amounts in millimetres.
## Examples
```{r}
Tavg <- DataForCWB[, 2]
Tmax <- DataForCWB[, 3]
Tmin <- DataForCWB[, 4]
Rn <- DataForCWB[, 6]
WS <- DataForCWB[, 7]
RH <- DataForCWB[, 8]
G <- DataForCWB[, 9]
head(ET0_PM(Tavg, Tmax, Tmin, Rn, RH, WS, G, Alt = 700))
```
## Function ET0_PT()
Calculates daily reference evapotranspiration amounts using the Priestley-Taylor method.
## Usage
```{r, eval=FALSE}
ET0_PT(Tavg,
Rn,
G = NULL,
Coeff = 1.26)
```
## Arguments
- Tavg: A vector, 1-column matrix or data frame with daily average air temperature.
- Rn: A vector, 1-column matrix or data frame with daily net radiation in MJ M-2 DAY-1.
- G: Optional. A vector, 1-column matrix or data frame with daily soil heat flux in MJ M-2 DAY-1. Default is `NULL` and if `NULL` it is assumed to be zero. May be provided by Soil_Heat_Flux
- Coeff: Single number defining the Priestley-Taylor coefficient. Default is 1.26
## Value
Daily reference evapotranspiration amounts in millimetres.
## Examples
```{r}
Tavg <- DataForCWB[, 2]
Rn <- DataForCWB[, 6]
G <- DataForCWB[, 9]
head(ET0_PT(Tavg, Rn, G))
```
## Function ET0_HS()
Calculates daily reference evapotranspiration amounts using the Hargreaves-Samani method.
## Usage
```{r, eval=FALSE}
ET0_HS(Ra,
Tavg,
Tmax,
Tmin)
```
## Arguments
- Ra: A vector, 1-column matrix or data frame with daily net radiation in MJ M-2 DAY-1.
- Tavg: A vector, 1-column matrix or data frame with daily average air temperature.
- Tmax: A vector, 1-column matrix or data frame with daily maximum air temperature in Celsius degrees.
- Tmin: A vector, 1-column matrix or data frame with daily minimum air temperature in Celsius degrees.
## Value
Daily reference evapotranspiration amounts in millimetres.
## Examples
```{r}
Tavg <- DataForCWB[, 2]
Tmax <- DataForCWB[, 3]
Tmin <- DataForCWB[, 4]
Ra <- DataForCWB[, 5]
head(ET0_HS(
Ra = Ra,
Tavg = Tavg,
Tmax = Tmax,
Tmin = Tmin
))
```
## Function Soil_Heat_Flux()
Calculates the daily amounts of Soil Heat Flux.
## Usage
```{r, eval=FALSE}
Soil_Heat_Flux(Tavg)
```
## Arguments
- Tavg: A vector, 1-column matrix or data frame with daily average air temperature.
## Value
Daily amounts of soil Heat flux in MJ m-2 day-1.
## Examples
```{r}
Tavg <- DataForCWB[, 2]
head(Soil_Heat_Flux(Tavg))
```
## Function Descriptive()
Calculates descriptive statistics for rainfall, evapotranspiration, or other variable.
## Usage
```{r, eval=FALSE}
Descriptive(Sample)
```
## Arguments
- Sample: A vector, 1-column matrix or data frame with rainfall, evapotranspiration, or other variable.
## Value
- sample mean (Avg), sample median (Med), sample standard variation (SD), sample standard Error (SE), maximum value (MaxValue), minimum value (MinValue), and frequency of zeros (FreqZero%) \## Examples
## Examples
```{r}
Rain <- DataForCWB[, 10]
Descriptive(Sample = Rain)
```
## Function Compare()
Calculates measures of accuracy and agreement.
## Usage
```{r, eval=FALSE}
Compare(Sample1, Sample2)
```
## Arguments
- Sample1: A vector, 1-column matrix or data frame with evapotranspiration or other variable.
- Sample2: A vector, 1-column matrix or data frame with evapotranspiration or other variable.
## Value
- Absolute mean error (AME), Square root of the mean squared error (RMSE), Willmott's indices of agreement: original (dorig), Modified (dmod) and refined (dref), Pearson determination coefficient (R2).
## Examples
```{r}
Tavg <- DataForCWB[, 2]
Tmax <- DataForCWB[, 3]
Tmin <- DataForCWB[, 4]
Rn <- DataForCWB[, 6]
WS <- DataForCWB[, 7]
RH <- DataForCWB[, 8]
G <- DataForCWB[, 9]
Sample1 <-
ET0_PM(
Tavg = Tavg,
Tmax = Tmax,
Tmin = Tmin,
Rn = Rn,
RH = RH,
WS = WS,
G = G,
Alt = 700
)
Sample2 <- ET0_PT(Tavg = Tavg, Rn = Rn, G = G)
Compare(Sample1 = Sample1, Sample2 = Sample2)
```
## Function CWB()
Calculates several parameters of the crop water balance.
It also suggests when and how much to irrigate.
## Usage
```{r, eval=FALSE}
CWB(
Rain,
ET0,
AWC,
Drz,
Kc = NULL,
Irrig = NULL,
MAD = NULL,
InitialD = 0,
start.date
)
```
## Arguments
- Rain: Vector, 1-column matrix or data frame with daily rainfall totals in millimetres.
- ET0: Vector, 1-column matrix or data frame with daily reference evapotranspiration in millimetres.
- AWC: Vector, 1-column matrix or data frame with the available water capacity of the soil, that is: the amount of water between field capacity and permanent wilting point in millimetres of water per centimetre of soil.
- Drz: Vector, 1-column matrix or data frame defining the root zone depth in centimetres.
- Kc: Vector, 1-column matrix or data frame defining the crop coefficient.
If NULL its values are assumed to be 1.
- Irrig: Vector, 1-column matrix or data frame with net irrigation amount infiltrated into the soil for the current day in millimetres.
- MAD: Vector, 1-column matrix or data frame defining the management allowed depletion.
Varies between 0 and 1.
- InitialD Single number defining in millimetre, the initial soil water deficit.
It is used to start the water balance accounting.
Default value is 0, which assumes the root zone is at the field capacity.
- start.date: Date at which the accounting should start.
Formats: “YYYY-MM-DD”, “YYYY/MM/DD”.
## Value
- Water balance accounting, including the soil water deficit.
## Examples
```{r}
Tavg <- DataForCWB[, 2]
Tmax <- DataForCWB[, 3]
Tmin <- DataForCWB[, 4]
Rn <- DataForCWB[, 6]
WS <- DataForCWB[, 7]
RH <- DataForCWB[, 8]
G <- DataForCWB[, 9]
ET0 <- ET0_PM(Tavg, Tmax, Tmin, Rn, RH, WS, G, Alt = 700)
Rain <- DataForCWB[, 10]
Drz <- DataForCWB[, 11]
AWC <- DataForCWB[, 12]
MAD <- DataForCWB[, 13]
Kc <- DataForCWB[, 14]
Irrig <- DataForCWB[, 15]
head(CWB(
Rain = Rain,
ET0 = ET0,
AWC = AWC,
Drz = Drz,
Kc = Kc,
Irrig = Irrig,
MAD = MAD,
start.date = "2023-11-23"
))
```
## Function CWB_FixedSchedule()
Calculates several parameters of the crop water balance.
It also suggests how much irrigate.
## Usage
```{r, eval=FALSE}
CWB_FixedSchedule(
Rain,
ET0,
AWC,
Drz,
Kc = NULL,
Irrig = NULL,
MAD = NULL,
InitialD = 0,
Scheduling,
start.date
)
```
## Arguments
- Rain: Vector, 1-column matrix or data frame with daily rainfall totals in millimetres.
- ET0: Vector, 1-column matrix or data frame with daily reference evapotranspiration in millimetres.
- AWC: Vector, 1-column matrix or data frame with the available water capacity of the soil, that is: the amount of water between field capacity and permanent wilting point in millimetre of water per centimetre of soil.
- Drz: Vector, 1-column matrix or data frame defining the root zone depth in centimetres.
- Kc: Vector, 1-column matrix or data frame defining the crop coefficient.
If NULL its values are assumed to be 1.
- Irrig: Vector, 1-column matrix or data frame with net irrigation amount infiltrated into the soil for the current day in millimetres.
- MAD: Vector, 1-column matrix or data frame defining the management allowed depletion.
Varies between 0 and 1.
- InitialD Single number defining in millimetre, the initial soil water deficit.
It is used to start the water balance accounting.
Default value is 0, which assumes the root zone is at the field capacity.
- Scheduling Single integer number defining the number of days between two consecutive irrigations.
- start.date: Date at which the accounting should start.
Formats: “YYYY-MM-DD”, “YYYY/MM/DD”.
## Value
- Water balance accounting, including the soil water deficit.
```{r}
Tavg <- DataForCWB[, 2]
Tmax <- DataForCWB[, 3]
Tmin <- DataForCWB[, 4]
Rn <- DataForCWB[, 6]
WS <- DataForCWB[, 7]
RH <- DataForCWB[, 8]
G <- DataForCWB[, 9]
ET0 <- ET0_PM(Tavg, Tmax, Tmin, Rn, RH, WS, G, Alt = 700)
Rain <- DataForCWB[, 10]
Drz <- DataForCWB[, 11]
AWC <- DataForCWB[, 12]
MAD <- DataForCWB[, 13]
Kc <- DataForCWB[, 14]
Irrig <- DataForCWB[, 15]
Scheduling <- 5
head(CWB_FixedSchedule(
Rain = Rain,
ET0 = ET0,
AWC = AWC,
Drz = Drz,
Kc = Kc,
Irrig = Irrig,
MAD = MAD,
Scheduling = Scheduling,
start.date = "2023-11-23"
))
```
## DataForAWC: Soil texture and plant available water capacity (AWC).
AWC is the amount of water between field capacity and permanent wilting point.
Given in millimetre of water per centimetre of soil.
Extracted from: Irrigation Scheduling: The Water Balance Approach Fact Sheet No. 4.707 by A.
A. Andales, J. L. Chávez, T. A. Bauder..
## Usage
```{r, eval=FALSE}
DataForAWC
```
## Format
- Soil Texture Soil Texture
- AWC Low Available water capacity in millimetre of water per centimetre of soil
- AWC High Available water capacity in millimetre of water per centimetre of soil
- AWC Average Available water capacity in millimetre of water per centimetre of soil
## Source
<https://extension.colostate.edu/topic-areas/agriculture/>.
## Examples
```{r}
DataForAWC
```
## DataForCWB: Data for Water Balance Accounting.
Daily meteorological data from a weather station in Campinas, Brazil and other parameters required for calculating the crop water balance.
The meteorological data belongs to the Agronomic Institute of the state of Sao Paulo.
## Usage
```{r, eval=FALSE}
DataForCWB
```
## Format
- A data frame with 129 rows and 16 columns.
- date date
- tmed Average air temperature in Celsius degrees
- tmax Maximum air temperature in Celsius degrees
- tmin Minimum air temperature in Celsius degrees
- Ra Extraterrestrial solar radiation in MJ M-2 DAY-1
- Rn Net radiation in MJ M-2 DAY-1
- W Wind speed in M S-1
- RH Relative Humidity in %
- G Soil Heat Flux in MJ M-2 DAY-1
- Rain Rain in millimetres
- Drz Depth of the root zone in centimetres
- AWC available water capacity (amount of water between field capacity and permanent wilting point) in millimetre of water per centimetre of soil
- MAD management allowed depletion (between 0 and 1)
- Kc Crop coefficient (between 0 and 1)
- Irrig Applied net irrigation in millimetres
## Source
<http://www.ciiagro.org.br/>.
## Examples
```{r}
head(DataForCWB)
```
## BugReports:
\<<https://github.com/gabrielblain/CropWaterBalance/issues> \>
## License:
MIT
## Authors:
Gabriel Constantino Blain, Graciela da Rocha Sobierajski, Regina Célia Matos Pires, Adam H. Sparks, Letícia L. Martins.
Maintainer: Gabriel Constantino Blain, [gabriel.blain\@sp.gov.br](mailto:gabriel.blain@sp.gov.br){.email}
## Acknowledgments:
The package uses data from the Fact Sheet number 4707 Irrigation Scheduling: The Water Balance Approach, by A.
A. Andales, J. L. Chávez, and T.
A. Bauder.
The authors greatly appreciate this initiative.
## References
Allen, R.G.; Pereira, L.S.; Raes, D.; Smith, M. Crop evapotranspiration.
In Guidelines for Computing Crop Water Requirements.
Irrigation and Drainage Paper 56; FAO: Rome, Italy, 1998; p. 300.
Andales, A.A.; Chávez, J.L.;Bauder, T.A.
2012.
Irrigation Scheduling: The Water Balance Approach.
Fact Sheet number 4707, crop series \| irrigation.
<https://extension.colostate.edu/docs/pubs/crops/04707.pdf>
Hargreaves, G.H.; Samani, Z.A.
1985.Reference crop evapotranspiration from temperature.
Appl.
Eng.
Agric,1, 96–99.
Package ‘lubridate', Version 1.9.3, Author Vitalie Spinu et al., <https://CRAN.R-project.org/package=lubridate>
Package ‘PowerSDI', Version 1.0.
0, Author Gabriel C. Blain et al., <https://CRAN.R-project.org/package=PowerSDI>
Priestley, C.H.B., Taylor, R.J., 1972.
On the Assessment of Surface Heat Flux and Evaporation Using Large-Scale Parameters.
Monthly Weather Review, 100 (2), 81–92.