knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>")
library(data.table)
library(fertplan)

This document will walk you through a simulation of a real fertilization plan for nitrogen nutrient. Both fertplan and this document depend on package data.table but its usage is not in any way mandatory.

Nitrogen fertilization plan

The estimation of the fertilization plan strictly follow the indications formulated in the regulation drawn up by the Italian Region of Lazio [@guidelines2020], hereafter the guidelines. The estimation of nitrogen demand for a yearly crop is the most complex among the ones detailed in the guidelines.
Nitrogen fertilization concentration in kg/ha is estimated as the net resultant of a N balance between the nitrogen pool available for the crops and the nitrogen losses. The N balance involves 7 main flow components. Flows that increase N availability to the crop are > 0 (positive sign). Flows that deplete soil N pool or N availability for the crop are < 0 (negative sign).

The N flow components include:

The leaching affects only the available nitrogen part (not total Nitrogen)

The final nitrogen balance is computed as the sum of its 7 components: $$B_N = \sum_{i=1}^{7}f_{N,i}$$

The main pathway to get to B_N includes 4 steps.

First step: load soil analyses

Let's begin with some minimal data from soil physical and chemical analyses on a few sampling points in the field.

data(soils)
soil_dt <- soils[, c("id", "N_pc", "CNR", "SOM_pc", "Clay_pc")]
knitr::kable(soil_dt)

The table shows the soil chemical and physical status before the planned crop sowing. The soil analyses elements that will be fed the nitrogen balance estimation are:

The id feature is not relevant to the balance estimation.

Second step: variable configuration

A few environmental and crop-related variables need to be set. Some variables need to match those set out in the guidelines tables, while a few others have to be derived from external sources.

Let's first translate the guidelines tables into english:

fertplan::i18n_switch("lang_en")

Matching-variables are:

knitr::kable(fertplan::get_available("crop"))

Crops are organized into crop types for convenience:

knitr::kable(fertplan:::tables_l$all_01_dt[crop == "Durum wheat" & element == "N",])

As a reference crop parts include:

knitr::kable(fertplan::get_available("part"))
knitr::kable(fertplan::get_available("crop type"))
knitr::kable(gsub(
  "%", 
  "\\\\%", 
  fertplan:::tables_l$tab_05_dt[, crop]), 
  escape = FALSE)

Environmental and crop-related variables include:

Let's now set the variables values and bind them to the soil analysis table. Let's suppose the values are constant among all soil samples, as it may be the case when all sampling points come from a uniform field that will be sown with the same crop:

soil_l <- list(
  crop                 = "Durum wheat",
  part                 = "Seed",
  crop_type            = "Fall / winter crops",
  expected_yield_kg_ha = 2900L,
  prev_crop            = "Meadows: polyphyte <5% fodder legumes", 
  texture              = "Loam", 
  drainage_rate        = "Slow",
  oct_jan_pr_mm        = 350L,
  n_supply_prev_frt_kg_ha = 0L,
  n_supply_atm_coeff   = 1)

Third step: estimate the components of N balance

Let's compute each component of the nitrogen balance:

nutrient_dt <- demand_nutrient(
  soil_dt, 
  soil_l, 
  nutrient  = "nitrogen", 
  blnc_cmpt = TRUE)
knitr::kable(nutrient_dt)

All components were estimated, note that $f_{N,b}$ is computed as (b1+b2)*-1. Remember that positive values are demand pools of N in soil or N flows leaving the field (such as $f_{N,c}$ component); negative values are current N pools in the soils that are available for assimilation to the crop or that will be available during the time-frame of crop growth.

fertzl_dt <- cbind(nutrient_dt, soil_dt)
fertzl_cols <- grep(
  pattern = "^[A-G]_N_kg_ha$", 
  x       = colnames(nutrient_dt), 
  value   = TRUE)
knitr::kable(fertzl_dt)

Fourth step: estimate N demand

We are finally arrived to the last step of assembling all components of the N balance. Let's perform the actual addition of the r paste0(fertzl_cols, collapse = ", ") components:

fertzl_dt[, n_demand_kg_ha := rowSums(.SD), .SDcols = fertzl_cols]
knitr::kable(fertzl_dt[, c("id", "n_demand_kg_ha")])

All sampling points end up needing a supply of nitrogen of r fertzl_dt[, mean(n_demand_kg_ha)] kg/ha on average.

Alternative pathway

A more direct pathway to get to B_N estimation is to set argument blnc_cmpt of demand_nutrient function to FALSE (the default setting). This will have the effect of returning directly B_N instead of its balance components thereby skipping the fourth step:

nutrient_dt <- demand_nutrient(
  soil_dt, 
  soil_l, 
  nutrient = "nitrogen", 
  blnc_cmpt = FALSE)
knitr::kable(nutrient_dt)

That's it as far as nitrogen fetilization plan is concerned.

References



mbask/fertplan documentation built on July 3, 2020, 12:01 p.m.