knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.align = "center",
  fig.asp = 0.618,
  fig.width = 5,
  out.width = "70%",
  fig.retina = 3
)
library(tidyverse)
library(cropsyst)

Model construction

The constructor function cs_setup() is used to initialize an empty cropsyst model object to which additional model parameters can be added using the following functions:

Input Data and parameters

Weather

Daily weather data is required and shouild be inlcuded as a data frame and follow the naming format below.

Input Data Set

Input weather data should be at a continuous daily time scale and contain the following columns

An example dataset cs_weather is provided with cropsyst and is shown below:

head(cs_weather)

Additional Parameters

Soil

Input Data Set

Soil data should contain the following columns

An example dataset cs_soil is provided with cropsyst and is shown below:

head(cs_soil)

Additional Parameters

Canopy Cover

Input Data Set

An example dataset cs_canopy_cover is provided with cropsyst and is shown below:

head(cs_canopy_cover)

Irrigation

Cropsyst simulations are able to use 3 irrigation scenarios

  1. Scheduled irrigation
  2. Auto irrigation
  3. No irrigation

Input Data Set

An example dataset cs_irrigation is provided with cropsyst and is shown below:

head(cs_irrigation)

Additional Parameters

Crop Parameters

Model Setup

cs_input <- cs_setup() %>% 
  cs_add_weather(weather = cs_weather, 
                 latitude = 35.2, 
                 elevation = 1170,
                 screening_height = 2) %>% 
  cs_add_soil(soil = cs_soil, 
              thickness_evaporative_layer = 0.005) %>% 
  cs_add_canopy_cover(cs_canopy_cover) %>% 
  cs_add_irrigation(cs_irrigation, 
                    irrigated_fraction = 0.0001) %>% 
  cs_add_crop(planting_date = ydoy(2016, 131), 
              season_end_date = ydoy(2016, 131+156-1),
              midseason_et_crop_coef = 1.15,
              tree_fruit = FALSE,
              fruit_harvest_date = ydoy(2016, 131+153),
              max_crop_height = 2,
              max_root_depth = 2, 
              perrenial = FALSE, 
              max_water_uptake = 14, 
              transpiration_use_eff = 7, 
              C3 = FALSE)

Run Model

cs_out <- cs_input %>% cs_run()

Model Output

The model output maintains the form of the model input with weather, irr_soil, and non_irr_soil as data frames and params as a list of model input parameters.

names(cs_out)

Potential ET

cs_out$weather %>% 
  ggplot() +
  geom_line(aes(x = dap, y = potential_crop_et))

Crop ET Coeficcient

cs_out$weather %>% 
  ggplot() +
  geom_line(aes(x = dap, y = et_crop_coef)) 

Crop Growth

cs_out$weather %>% 
  ggplot() +
  geom_line(aes(x = dap, y = -root_depth, color = "Root Depth")) +
  geom_line(aes(x = dap, y = crop_height, color = "Crop Height")) +
  labs(x = "Days after planting", y = "Height (m)")

Biomass

cs_out$weather %>% 
  ggplot() +
  geom_line(aes(x = dap, y = potential_biomass_prod, color = "potential")) +
  geom_line(aes(x = dap, y = biomass_production, color = "actual"))

cs_out$weather %>% 
  ggplot() +
  geom_line(aes(x = dap, y = cum_biomass_production))

Transpiration

cs_out$weather %>% 
  ggplot() +
  geom_line(aes(x = dap, y = attainable_transpiration, color = "Attainable")) +
  geom_line(aes(x = dap, y = potential_transpiration, color = "Potential")) +
  geom_line(aes(x = dap, y = actual_transpiration, color = "Actual"))

Soil Water Evaporation

cs_out$weather %>% 
  ggplot() +
  geom_line(aes(x = dap, y = attainable_soil_water_evaporation, color = "Attainable")) +
  geom_line(aes(x = dap, y = irr_zone_soil_water_evap, color = "Irrigated")) +
  geom_line(aes(x = dap, y = non_irr_zone_soil_water_evap, color = "Non-Irrigated"))

Leaf Water Potential

cs_out$weather %>% 
  ggplot() +
  geom_line(aes(x = dap, y = leaf_water_potential)) 

Actual Evapotranspiration

cs_out$weather %>% 
  ggplot() +
  geom_line(aes(x = dap, y = actual_evapotranspiration)) 

s



pruettm/cropsyst documentation built on May 23, 2022, 11:57 a.m.