Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • umr-g-eau/cropwat
1 result
Show changes
Commits on Source (2)
......@@ -18,6 +18,7 @@ License: AGPL (>= 3)
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.2
Roxygen: list(markdown = TRUE)
Suggests:
knitr,
rmarkdown
......
......@@ -16,9 +16,11 @@ export(calc_isCycle)
export(calc_p)
export(calc_root_depth)
export(get_crop_params)
export(load_CW8_CRO)
export(load_crop_params)
import(dplyr)
import(ggplot2)
import(tibble)
importFrom(rlang,.data)
importFrom(rlang,.env)
importFrom(stats,setNames)
......@@ -17,7 +17,7 @@
#' meteo <-
#' ZH_3_clim[ZH_3_clim$Date >= as.Date("2010-01-01") & ZH_3_clim$Date <= as.Date("2010-12-31"), ]
#' # Create model input
#' cw_input <- CW_create_input("soja",
#' cw_input <- CW_create_input("SB2023-soja",
#' DatesR = meteo$Date,
#' ETo = meteo$ETP,
#' P = meteo$Ptot,
......
......@@ -15,7 +15,7 @@
#' data(ZH_3_clim)
#' meteo <-
#' ZH_3_clim[ZH_3_clim$Date >= as.Date("2010-01-01") & ZH_3_clim$Date <= as.Date("2010-12-31"), ]
#' cw_input <- CW_create_input("soja",
#' cw_input <- CW_create_input("SB2023-soja",
#' DatesR = meteo$Date,
#' ETo = meteo$ETP,
#' P = meteo$Ptot,
......
......@@ -2,5 +2,6 @@
#' @importFrom rlang .data .env
#' @import tibble
#' @import ggplot2
#' @importFrom stats setNames
NULL
#> NULL
......@@ -9,10 +9,10 @@
#' @export
#'
#' @examples
#' Kc <- calc_Kc(get_crop_params("soja"), year = NULL)
#' Kc <- calc_Kc(get_crop_params("SB2023-soja"), year = NULL)
#' plot(Kc, type = "l")
#'
#' Kc <- calc_Kc(get_crop_params("soja"), year = 2024)
#' Kc <- calc_Kc(get_crop_params("SB2023-soja"), year = 2024)
#' plot(Kc, type = "l")
#'
calc_Kc <- function(cp,
......
......@@ -7,7 +7,7 @@
#' @export
#'
#' @examples
#' cp <- get_crop_params("soja")
#' cp <- get_crop_params("SB2023-soja")
#' TAW <- calc_TAW(cp,
#' AWC = 140,
#' soil_depth = 1.2,
......
......@@ -12,7 +12,7 @@
#' @export
#'
#' @examples
#' TAW <- calc_TAW(get_crop_params("soja"),
#' TAW <- calc_TAW(get_crop_params("SB2023-soja"),
#' AWC = 140,
#' soil_depth = 1.2,
#' year = 2024)
......
......@@ -6,7 +6,7 @@
#' @export
#'
#' @examples
#' isCycle <- calc_isCycle(get_crop_params("soja"), year = 2024)
#' isCycle <- calc_isCycle(get_crop_params("SB2023-soja"), year = 2024)
#'
calc_isCycle <- function(cp, year, sowing_date = cp$sowing_date) {
isCycle <- rep(TRUE, cp$Lini + cp$Ldev + cp$Lmid + cp$Lend)
......
......@@ -8,7 +8,7 @@
#' @export
#'
#' @examples
#' p <- calc_p(get_crop_params("soja"),
#' p <- calc_p(get_crop_params("SB2023-soja"),
#' year = 2024)
#' plot(p, type = "l")
#'
......@@ -16,8 +16,8 @@ calc_p <- function(cp,
year,
sowing_date = cp$sowing_date) {
p <- c(
cp$p_init + (0:(cp$Lini + cp$Ldev - 1
)) * (cp$p_mid - cp$p_init) / (cp$Lini + cp$Ldev - 1)
cp$p_ini + (0:(cp$Lini + cp$Ldev - 1
)) * (cp$p_mid - cp$p_ini) / (cp$Lini + cp$Ldev - 1)
,
rep(cp$p_mid, cp$Lmid)
,
......
......@@ -7,7 +7,7 @@
#' @export
#'
#' @examples
#' Zr <- calc_root_depth(get_crop_params("soja"),
#' Zr <- calc_root_depth(get_crop_params("SB2023-soja"),
#' soil_depth = 1.2,
#' year = 2024)
#' plot(Zr, type = "l")
......
#' Load CropWat v8.0 crop parameter CRO file
#'
#' @param file Path of the CRO file
#'
#' @return Crop parameters formatted as
#' @export
#'
#' @examples
#' load_CW8_CRO(system.file("extdata/TOMATO.CRO", package = "CropWat"))
#'
load_CW8_CRO <- function(file) {
s <- readLines(file)
if (trimws(s[1]) != "CROPWAT 8.0 Crop data") {
warning("This file is not a \"CROPWAT 8.0 Crop data\" file, use at your own risk")
}
if (substr(s[2], 21, 24) == "Rice") {
stop("Rice crop is not supported")
}
param_names <- list(
c("Lini", "Ldev", "Lmid", "Lend"),
c("Kini", "Kmax", "Kend"),
c("Zini", "Zend"),
c("p_ini", "p_mid", "p_end"),
c("Yini", "Ydev", "Ymid", "Yend", "Ytot"),
c("h")
)
l_cp <- lapply(seq(length(s[-c(1:2)])), function(i) {
setNames(CW8_CRO_as_vector(s[i + 2]), param_names[[i]])
})
cp <- data.frame(crop = basename(tools::file_path_sans_ext(file)),
name = trimws(s[2]),
as.list(do.call(c, l_cp)),
sowing_date = as.character(NA))
return(tibble::tibble(cp))
}
CW8_CRO_as_vector <- function(x) {
as.numeric(strsplit(trimws(x), "\\s+")[[1]])
}
......@@ -7,25 +7,40 @@
#' The file to read should have the following columns and format:
#'
#' - `crop`: crop code
#' - `Kini`: Initial Kc at the beginning of the crop cycle during `Lini` days (-)
#' - `Kmax`: Maximum Kc during `Lmid` day of the cycle (-)
#' - `Kend`: Final Kc at the end of the cycle (-)
#' - `Lini`: Length of initial stage of crop development
#' - `Ldev`: Length of crop development stage
#' - `Lmid`: Length of mid season
#' - `Lend`: Length of late season
#' - `Kini`: Initial Kc at the beginning of the crop cycle during `Lini` days (-)
#' - `Kmax`: Maximum Kc during `Lmid` day of the cycle (-)
#' - `Kend`: Final Kc at the end of the cycle (-)
#' - `Zini`: Initial root depth at the beginning of the crop cycle (m)
#' - `Zend`: Final root depth at the end of the crop cycle (m)
#' - `p_init`: Initial fraction of readily available water (-)
#' - `p_ini`: Initial fraction of readily available water (-)
#' - `p_mid`: Fraction of readily available water at `Lmid` day of the cycle (-)
#' - `p_end`: Final Initial fraction of readily available water at `Lend` day of the cycle (-)
#' - `Yini`: Yield response factor (Ky, not used yet)
#' - `Ydev`: Yield response factor (Ky, not used yet)
#' - `Ymid`: Yield response factor (Ky, not used yet)
#' - `Yend`: Yield response factor (Ky, not used yet)
#' - `Ytot`: Yield response factor (Ky, not used yet)
#' - `h`: crop height (m) (not used)
#' - `sowing_date`: Sowing date in format "MM-DD"
#' - `DOY_semis_cultures`: Doy of the year of the sowing date (deprecated)
#' - `date_semis_param`:
#' - `date_debut_irrigation`:
#' - `date_fin_irrigation`:
#' - `dose_irrigation`:
#' - `tour_d_eau`:
#'
#' The default crop parameters provided in the package come from a variety of sources.
#'
#' Crop names starting with "KURN-" or "FAO-" are imported from the CRO files
#' provided with the CropWat 8.0 installation.
#' "KURN-" are crop parameters calibrated at "Kurnool, Andhra Pradesh, India".
#'
#' Crop names starting with "SB2023-" are crop parameters coming from a
#' calibration performed on outputs of the AqYield model for the Aveyron
#' catchment (Soutif-Bellenger, 2023).
#'
#' ### Reference
#' Soutif-Bellenger, Myriam, Guillaume Thirel, Olivier Therond, et Jean Villerd. 2023.
#' As Simple as Possible but Not Simpler?: The Case of Irrigation Modeling at Catchment
#' Scale in Southwestern France. Irrigation Science 41 (5): 713‑36.
#'
#' @param file Path of the table of crop parameters
#'
......@@ -38,7 +53,9 @@
#' cp <- load_crop_params()
#' cp$crop
#'
#' get_crop_params("maisP")
#' str(cp)
#'
#' get_crop_params("")
#'
load_crop_params <- function(file = CW_data("crop_params.tsv")) {
readr::read_tsv(file, show_col_types = FALSE)
......
......@@ -21,9 +21,9 @@ knitr::opts_chunk$set(
CropWat is an R Implementation of the FAO CropWat Model.
This implements the functions describing water balance on
an irrigated crop as described in FAO publications of the Irrigation and
Drainage Series, namely, No. 56 "Crop Evapotranspiration - Guidelines for
This implements the functions describing water balance on
an irrigated crop as described in FAO publications of the Irrigation and
Drainage Series, namely, No. 56 "Crop Evapotranspiration - Guidelines for
computing crop water requirements” and No. 33 titled "Yield response to water".
## Installation
......@@ -37,7 +37,7 @@ remotes::install_git("https://forgemia.inra.fr/umr-g-eau/cropwat.git")
## Example
This is a basic example which shows you how to simulate water balance of an
This is a basic example which shows you how to simulate water balance of an
irrigated crop.
```{r example}
......@@ -48,11 +48,11 @@ library(CropWat)
data(ZH_3_clim)
# Selecting year 2010
meteo <- ZH_3_clim[ZH_3_clim$Date >= as.Date("2010-01-01") &
meteo <- ZH_3_clim[ZH_3_clim$Date >= as.Date("2010-01-01") &
ZH_3_clim$Date <= as.Date("2010-12-31"), ]
# Formatting model input
cw_input <- CW_create_input("soja",
cw_input <- CW_create_input("SB2023-soja",
DatesR = meteo$Date,
ETo = meteo$ETP,
P = meteo$Ptot,
......
......@@ -36,11 +36,11 @@ library(CropWat)
data(ZH_3_clim)
# Selecting year 2010
meteo <- ZH_3_clim[ZH_3_clim$Date >= as.Date("2010-01-01") &
meteo <- ZH_3_clim[ZH_3_clim$Date >= as.Date("2010-01-01") &
ZH_3_clim$Date <= as.Date("2010-12-31"), ]
# Formatting model input
cw_input <- CW_create_input("soja",
cw_input <- CW_create_input("SB2023-soja",
DatesR = meteo$Date,
ETo = meteo$ETP,
P = meteo$Ptot,
......
##
# FAO CropWat 8.0 crop data
cropwat_program_path <- "C:/ProgramData/CROPWAT/data/crops"
cro_files <- list.files(cropwat_program_path, pattern = "*.CRO", full.names = FALSE, recursive = TRUE)
# Remove RICE
cro_files <- cro_files[!grepl("RICE", cro_files)]
names(cro_files) <- tools::file_path_sans_ext(gsub("/", "-", cro_files))
l <- lapply(file.path(cropwat_program_path, cro_files), load_CW8_CRO)
crop_params_CW8 <- dplyr::bind_rows(l)
crop_params_CW8$crop <- names(cro_files)
# Soutif-Bellenger, Myriam, Guillaume Thirel, Olivier Therond, et Jean Villerd. 2023.
# As Simple as Possible but Not Simpler?: The Case of Irrigation Modeling at Catchment
# Scale in Southwestern France. Irrigation Science 41 (5): 713‑36.
# https://doi.org/10.1007/s00271-023-00846-x.
df <- read.table("data-raw/param_cultures_SB2023.txt", header = TRUE)
df <- df[, 1:14]
names(df)[1] <- "crop"
names(df)[11] <- "p_ini"
names(df)[14] <- "sowing_date"
for(x in setdiff(names(crop_params_CW8), names(df))) {
df[[x]] <- as.numeric(NA)
}
df <- df[, names(crop_params_CW8)]
df$name <- paste(df$crop, "(AqYield crop code)")
df$crop <- paste0("SB2023-", df$crop)
crop_params <- rbind(crop_params_CW8, df)
readr::write_tsv(crop_params, "inst/extdata/crop_params.tsv")
culture Kini Kmax Kend Lini Ldev Lmid Lend Zini Zend p_init p_mid p_end Date_semis_cultures DOY_semis_cultures date_semis_param date_debut_irrigation date_fin_irrigation dose_irrigation tour_d_eau
colza 0.45 1.1 0.45 15 165 61 37 0.3 1.25 0.8 0.7 0.7 09-01 244 244 244 276 15 20
CP 0.5 1 0.5 145 60 27 22 0.3 1.65 0.8 0.6 0.65 10-16 289 302 100 181 24 7
maisP 0.55 1.1 0.05 47 34 32 47 0.3 1.35 0.75 0.55 0.75 04-17 107 119 137 281 33 7
maisT 0.55 1.1 0.15 52 38 35 48 0.3 1.35 0.75 0.55 0.75 04-08 98 107 135 288 26 5
maisEnsil 0.5 1.1 0.3 38 37 35 32 0.3 1.35 0.75 0.55 0.7 04-26 116 124 140 253 26 5
pois 0.5 0.95 0.3 40 40 28 15 0.3 0.8 0.6 0.45 0.55 02-25 56 41 105 166 32 6
prairie 0.5 0.95 0.3 75 29 26 18 0.3 1 0.8 0.65 0.75 03-02 61 60 91 140 37 9
semence 0.55 1.05 0.05 40 30 36 47 0.3 1.35 0.7 0.6 0.75 05-05 125 121 135 288 24 4
soja 0.5 1.15 0.35 47 50 38 36 0.3 0.95 0.7 0.5 0.7 04-04 94 91 141 258 32 6
tour 0.55 0.9 0.3 32 49 32 29 0.3 1.15 0.45 0.45 0.45 04-08 98 100 161 227 20 9
vergers 0.55 0.95 0.15 115 47 45 42 1 1.5 0.7 0.55 0.7 01-01 1 1 135 314 24 4
vignes 0.5 0.95 0.15 110 52 45 42 1 1.5 0.7 0.5 0.65 01-01 1 1 NA NA NA NA
CROPWAT 8.0 Crop data
Tomato
30 40 45 30
0.60 1.15 0.80
0.25 1.00
0.30 0.40 0.50
0.50 0.60 1.10 0.80 1.05
0.60
crop Kini Kmax Kend Lini Ldev Lmid Lend Zini Zend p_init p_mid p_end sowing_date
colza 0.45 1.1 0.45 15 165 61 37 0.3 1.25 0.8 0.7 0.7 09-01
CP 0.5 1 0.5 145 60 27 22 0.3 1.65 0.8 0.6 0.65 10-16
maisP 0.55 1.1 0.05 47 34 32 47 0.3 1.35 0.75 0.55 0.75 04-17
maisT 0.55 1.1 0.15 52 38 35 48 0.3 1.35 0.75 0.55 0.75 04-08
maisEnsil 0.5 1.1 0.3 38 37 35 32 0.3 1.35 0.75 0.55 0.7 04-26
pois 0.5 0.95 0.3 40 40 28 15 0.3 0.8 0.6 0.45 0.55 02-25
prairie 0.5 0.95 0.3 75 29 26 18 0.3 1 0.8 0.65 0.75 03-02
semence 0.55 1.05 0.05 40 30 36 47 0.3 1.35 0.7 0.6 0.75 05-05
soja 0.5 1.15 0.35 47 50 38 36 0.3 0.95 0.7 0.5 0.7 04-04
tour 0.55 0.9 0.3 32 49 32 29 0.3 1.15 0.45 0.45 0.45 04-08
vergers 0.55 0.95 0.15 115 47 45 42 1 1.5 0.7 0.55 0.7 01-01
vignes 0.5 0.95 0.15 110 52 45 42 1 1.5 0.7 0.5 0.65 01-01
crop name Lini Ldev Lmid Lend Kini Kmax Kend Zini Zend p_ini p_mid p_end Yini Ydev Ymid Yend Ytot h sowing_date
FAO-ALFALFA0 ALFALFA-perennial 150 30 150 35 0.4 0.95 0.9 1.2 1.2 0.55 0.55 0.55 1 1 1 1 1 0.7 NA
FAO-ALFALFA1 ALFALFA 1 year 10 30 150 35 0.4 0.95 0.4 1.2 1.2 0.55 0.55 0.55 1 1 1 1 1 0.7 NA
FAO-ARTICHOK Artichoke 40 40 250 30 0.5 1 0.95 0.25 0.9 0.4 0.45 0.45 0.6 0.6 0.4 1 0.8 0.7 NA
FAO-BANANA1 BANANA 1st year 90 165 45 30 0.5 1.1 1 0.3 0.9 0.55 0.45 0.45 1 1 1 1 1 3 NA
FAO-BANANA2 BANANA 2nd year 60 60 75 45 1 1.2 1.1 0.9 0.9 0.55 0.45 0.45 1 1 1 1 1 4 NA
FAO-BARLEY Barley 15 25 50 30 0.3 1.15 0.25 0.3 1.1 0.55 0.55 0.9 0.2 0.6 0.5 0.4 1 1 NA
FAO-BEANS-DR Dry beans 20 30 40 20 0.4 1.15 0.35 0.3 0.9 0.45 0.45 0.6 0.2 0.6 1 0.2 1.15 0.4 NA
FAO-BEANS-GR Green beans 20 30 30 10 0.5 1.05 0.9 0.3 0.7 0.45 0.45 0.6 0.2 1.1 0.75 0.4 1.15 0.4 NA
FAO-CABBAGE CABBAGE Crucifers 40 60 50 15 0.7 1.05 0.95 0.25 0.5 0.45 0.45 0.45 0.2 0.4 0.45 0.6 0.95 0.4 NA
FAO-CITRUS CITRUS 70% ca bare 60 90 120 95 0.7 0.65 0.7 1.4 1.4 0.5 0.5 0.5 1 1 1 1 1 4 NA
FAO-COTTON COTTON 30 50 60 55 0.35 1.2 0.6 0.3 1.4 0.65 0.65 0.9 0.2 0.5 0.5 0.25 0.85 1.3 NA
FAO-DATEPALM Date palms 140 30 150 45 0.9 0.95 0.95 2 2 0.5 0.5 0.5 0.8 0.8 0.8 0.8 0.8 8 NA
FAO-GRAINS Small Grains 25 35 65 40 0.3 1.1 0.3 0.3 1.2 0.5 0.6 0.7 0.4 0.6 1.25 0.8 1 1 NA
FAO-GRAPES-T table grapes 150 50 125 40 0.3 0.85 0.45 1.5 1.5 0.35 0.35 0.35 0.2 0.7 0.85 0.4 0.85 1.5 NA
FAO-GRAPES-W Wine grapes 150 50 125 40 0.3 0.7 0.45 1.5 1.5 0.45 0.45 0.45 0.2 0.7 0.85 0.4 0.85 1.8 NA
FAO-GRASS-C Turf grass cool cl 150 40 130 45 0.9 0.95 0.95 0.5 0.5 0.4 0.4 0.4 1 1 1 1 1 0.1 NA
FAO-GRASS-W Turf grass warm 150 40 130 45 0.8 0.85 0.85 0.5 0.5 0.5 0.5 0.5 1 1 1 1 1 0.1 NA
FAO-GRONDNUT Groudnut 25 35 45 25 0.4 1.15 0.6 0.3 0.8 0.45 0.45 0.5 0.2 0.8 0.6 0.2 0.7 0.4 NA
FAO-MAIZE MAIZE (Grain) 20 35 40 30 0.3 1.2 0.35 0.3 1 0.55 0.55 0.8 0.4 0.4 1.3 0.5 1.25 2 NA
FAO-MANGO MANGO 90 90 90 95 0.9 1.1 0.9 2 2 0.6 0.6 0.6 0.8 0.8 0.8 0.8 0.8 6 NA
FAO-MILLET MILLET 15 25 40 25 0.3 1 0.3 0.3 1.2 0.5 0.6 0.7 0.4 0.6 1.25 0.8 1 1.5 NA
FAO-PASTURE Pasture perennial 140 60 120 45 0.85 0.95 0.85 0.8 0.8 0.5 0.5 0.5 0.8 0.8 0.8 0.8 0.8 0.2 NA
FAO-PEPPER Sweet Peppers 30 35 40 20 0.6 1.05 0.9 0.25 0.8 0.2 0.3 0.5 1.4 0.6 1.2 0.6 1.1 0.7 NA
FAO-POTATO Potato 25 30 45 30 0.5 1.15 0.75 0.3 0.6 0.25 0.3 0.5 0.45 0.8 0.8 0.3 1.1 0.6 NA
FAO-PULSES Pulses 20 30 40 20 0.4 1.15 0.35 0.3 1 0.6 0.6 0.8 0.4 0.6 0.8 0.6 0.8 0.4 NA
FAO-SORGHUM SORGHUM (Grain) 20 35 40 30 0.3 1 0.55 0.3 1.4 0.6 0.5 0.8 0.2 0.4 0.55 0.2 0.9 1.5 NA
FAO-SOYBEAN Soybean 15 15 40 15 0.4 1.15 0.5 0.3 1 0.5 0.6 0.9 0.4 0.8 1 0.4 0.85 0.6 NA
FAO-SUGARBET Sugarbeet 25 35 50 50 0.35 1.2 0.7 0.3 1 0.5 0.6 0.6 0.5 0.8 1.2 1 1.1 0.7 NA
FAO-SUGARCAN Sugarcane (Ratoon) 30 60 180 95 0.4 1.25 0.75 1.5 1.5 0.65 0.65 0.65 0.5 0.75 1.2 0.1 1.2 3 NA
FAO-SUNFLOWR Sunflower 25 35 45 25 0.35 1.15 0.35 0.3 1.3 0.45 0.5 0.8 0.4 0.6 0.8 0.8 0.95 2 NA
FAO-SW-MELON Sweet Melon 25 35 40 20 0.5 1.05 0.75 0.3 1 0.4 0.4 0.5 0.5 0.6 1.1 0.8 1.05 0.4 NA
FAO-TOBACCO Tobacco 20 30 30 30 0.5 1.15 0.8 0.25 0.8 0.4 0.5 0.65 0.4 1 1 0.5 0.9 1.2 NA
FAO-TOMATO Tomato 30 40 45 30 0.6 1.15 0.8 0.25 1 0.3 0.4 0.5 0.5 0.6 1.1 0.8 1.05 0.6 NA
FAO-VEGETABL Small Vegetables 20 30 30 15 0.7 1.05 0.95 0.25 0.6 0.3 0.45 0.5 0.8 0.4 1.2 1 1 0.3 NA
FAO-W-WHEAT Winter Wheat f.f. 30 140 40 30 0.7 1.15 0.25 0.3 1.5 0.55 0.55 0.9 0.2 0.6 0.5 0.4 1 1 NA
FAO-W-WHEATF Winter Wheat 160 75 75 25 0.4 1.15 0.25 0.3 1.5 0.55 0.55 0.9 0.2 0.6 0.5 0.4 1 1 NA
FAO-WHEAT Spring Wheat 30 30 40 30 0.3 1.15 0.3 0.3 1.2 0.55 0.55 0.8 0.4 0.6 0.8 0.4 1.15 1 NA
KURN-COTTON COTTON 30 50 55 45 0.35 1.2 0.6 0.3 1.4 0.65 0.65 0.9 0.2 0.5 0.5 0.25 0.85 1.3 NA
KURN-GRONDNUT KHARIF Groudnut Kharif 20 30 25 35 0.4 1.15 0.6 0.3 0.8 0.45 0.45 0.5 0.2 0.8 0.6 0.2 0.7 0.4 NA
KURN-GRONDNUT RABI Groudnut Rabi 20 30 35 25 0.4 1.15 0.6 0.3 0.8 0.45 0.45 0.5 0.2 0.8 0.6 0.2 0.7 0.4 NA
KURN-SORGHUM-HYV SORGHUM (Grain) 27 35 35 30 0.5 1.15 0.6 0.3 1 0.5 0.5 0.8 0.6 0.6 1.2 0.8 1 NA NA
KURN-SORGHUM SORGHUM (Grain) 20 40 30 30 0.3 1 0.55 0.3 1.4 0.6 0.5 0.8 0.2 0.4 0.55 0.2 0.9 1.5 NA
KURN-SUGARCAN Sugarcane (Ratoon) 30 60 180 95 0.4 1.25 0.75 1.5 1.5 0.65 0.65 0.65 0.5 0.75 1.2 0.1 1.2 3 NA
SB2023-colza colza (AqYield crop code) 15 165 61 37 0.45 1.1 0.45 0.3 1.25 0.8 0.7 0.7 NA NA NA NA NA NA 09-01
SB2023-CP CP (AqYield crop code) 145 60 27 22 0.5 1 0.5 0.3 1.65 0.8 0.6 0.65 NA NA NA NA NA NA 10-16
SB2023-maisP maisP (AqYield crop code) 47 34 32 47 0.55 1.1 0.05 0.3 1.35 0.75 0.55 0.75 NA NA NA NA NA NA 04-17
SB2023-maisT maisT (AqYield crop code) 52 38 35 48 0.55 1.1 0.15 0.3 1.35 0.75 0.55 0.75 NA NA NA NA NA NA 04-08
SB2023-maisEnsil maisEnsil (AqYield crop code) 38 37 35 32 0.5 1.1 0.3 0.3 1.35 0.75 0.55 0.7 NA NA NA NA NA NA 04-26
SB2023-pois pois (AqYield crop code) 40 40 28 15 0.5 0.95 0.3 0.3 0.8 0.6 0.45 0.55 NA NA NA NA NA NA 02-25
SB2023-prairie prairie (AqYield crop code) 75 29 26 18 0.5 0.95 0.3 0.3 1 0.8 0.65 0.75 NA NA NA NA NA NA 03-02
SB2023-semence semence (AqYield crop code) 40 30 36 47 0.55 1.05 0.05 0.3 1.35 0.7 0.6 0.75 NA NA NA NA NA NA 05-05
SB2023-soja soja (AqYield crop code) 47 50 38 36 0.5 1.15 0.35 0.3 0.95 0.7 0.5 0.7 NA NA NA NA NA NA 04-04
SB2023-tour tour (AqYield crop code) 32 49 32 29 0.55 0.9 0.3 0.3 1.15 0.45 0.45 0.45 NA NA NA NA NA NA 04-08
SB2023-vergers vergers (AqYield crop code) 115 47 45 42 0.55 0.95 0.15 1 1.5 0.7 0.55 0.7 NA NA NA NA NA NA 01-01
SB2023-vignes vignes (AqYield crop code) 110 52 45 42 0.5 0.95 0.15 1 1.5 0.7 0.5 0.65 NA NA NA NA NA NA 01-01
......@@ -21,9 +21,9 @@ CW_create_input(
\item{crop}{The code of the crop}
\item{year}{Year of simulation (Only used for detecting leap year).
If `NULL`, the calculation is limited to the crop cycle of the plant}
If \code{NULL}, the calculation is limited to the crop cycle of the plant}
\item{DatesR}{Simulation period ([vector] of [Date])}
\item{DatesR}{Simulation period (\link{vector} of \link{Date})}
\item{ETo}{Potential Evaporation (mm/day)}
......@@ -33,12 +33,12 @@ If `NULL`, the calculation is limited to the crop cycle of the plant}
\item{AWC}{Available Water Capacity (mm)}
\item{cp}{Crop parameters (See [get_crop_params])}
\item{cp}{Crop parameters (See \link{get_crop_params})}
\item{sowing_date}{Sowing date in format "MM-DD"}
}
\value{
A [tibble] containing the input times series.
A \link{tibble} containing the input times series.
}
\description{
Create CropWat model input
......@@ -51,7 +51,7 @@ str(ZH_3_clim)
meteo <-
ZH_3_clim[ZH_3_clim$Date >= as.Date("2010-01-01") & ZH_3_clim$Date <= as.Date("2010-12-31"), ]
# Create model input
cw_input <- CW_create_input("soja",
cw_input <- CW_create_input("SB2023-soja",
DatesR = meteo$Date,
ETo = meteo$ETP,
P = meteo$Ptot,
......