WEFNC Nexus Analysis for Agricultural Systems

Lalit Kumar Rolaniya

Introduction

The wefnexus package provides a comprehensive toolkit for analyzing Water-Energy-Food-Nutrient-Carbon (WEFNC) nexus interactions in agricultural production systems. This vignette demonstrates a complete workflow using a conservation agriculture dataset from western Rajasthan, India.

Load Sample Data

data(arid_pulse_nexus)
d <- arid_pulse_nexus
str(d)
#> 'data.frame':    6 obs. of  26 variables:
#>  $ treatment          : chr  "CT+Flood" "CT+Sprinkler" "ZT+Drip" "ZT+Drip+Residue" ...
#>  $ tillage            : chr  "CT" "CT" "ZT" "ZT" ...
#>  $ irrigation         : chr  "Flood" "Sprinkler" "Drip" "Drip" ...
#>  $ residue            : logi  FALSE FALSE FALSE TRUE FALSE TRUE
#>  $ grain_yield        : num  980 1120 1280 1380 1450 1580
#>  $ straw_yield        : num  1450 1680 1850 2050 2180 2350
#>  $ irrigation_applied : num  280 220 160 155 135 130
#>  $ effective_rainfall : num  185 185 185 185 185 185
#>  $ total_water        : num  465 405 345 340 320 315
#>  $ crop_et            : num  390 355 310 305 290 285
#>  $ energy_input       : num  8950 7850 6480 6950 5850 6380
#>  $ energy_output_grain: num  14406 16464 18816 20286 21315 ...
#>  $ energy_output_straw: num  18125 21000 23125 25625 27250 ...
#>  $ n_applied          : num  20 20 20 20 20 20
#>  $ p_applied          : num  40 40 40 40 40 40
#>  $ k_applied          : num  0 0 0 0 0 0
#>  $ n_uptake           : num  32.5 37.8 43.2 48.5 52.1 56.8
#>  $ p_uptake           : num  4.8 5.5 6.3 7.1 7.6 8.2
#>  $ grain_n_uptake     : num  24.5 28.6 33 37.2 40.1 43.8
#>  $ diesel_use         : num  65 55 38 40 32 35
#>  $ electricity_kwh    : num  180 120 75 70 55 50
#>  $ soc_pct            : num  0.32 0.34 0.38 0.42 0.4 0.45
#>  $ bulk_density       : num  1.58 1.56 1.52 1.48 1.5 1.46
#>  $ ghg_emission       : num  1850 1520 1180 1250 1020 1100
#>  $ cost_cultivation   : num  22500 24800 21500 23200 20800 22500
#>  $ gross_return       : num  53900 61600 70400 75900 79750 ...

1. Water Module

# Water Use Efficiency
wue <- water_use_efficiency(d$grain_yield, d$total_water)
#> WUE computed: 6 values (kg/ha/mm).

# Crop Water Productivity
cwp <- crop_water_productivity(d$grain_yield, d$crop_et)
#> Crop water productivity computed (kg/m3).

# Water Footprint (green + blue)
wf <- water_footprint(
  green_water = d$effective_rainfall,
  blue_water = d$irrigation_applied,
  yield = d$grain_yield
)
#> Water footprint computed (m3/kg).
wf
#>   green_wf blue_wf grey_wf total_wf
#> 1     1.89    2.86       0     4.75
#> 2     1.65    1.96       0     3.61
#> 3     1.45    1.25       0     2.70
#> 4     1.34    1.12       0     2.46
#> 5     1.28    0.93       0     2.21
#> 6     1.17    0.82       0     1.99

2. Energy Module

# Total energy output
e_out <- d$energy_output_grain + d$energy_output_straw

# Energy Use Efficiency
eue <- energy_use_efficiency(e_out, d$energy_input)
#> EUE computed: 6 values.

# Energy Return on Investment (EROI)
eroi_values <- eroi(e_out, d$energy_input)
#> EROI computed: 3.63, 4.77, 6.47, 6.61, 8.3, 8.24 (energy-positive, energy-positive, highly profitable, highly profitable, highly profitable, highly profitable).

# Net Energy Balance
ne <- net_energy(e_out, d$energy_input)
#> Net energy computed (MJ/ha).

# Compare treatments
data.frame(Treatment = d$treatment, EUE = eue, EROI = eroi_values,
           Net_Energy = ne)
#>         Treatment  EUE EROI Net_Energy
#> 1        CT+Flood 3.63 3.63      23581
#> 2    CT+Sprinkler 4.77 4.77      29614
#> 3         ZT+Drip 6.47 6.47      35461
#> 4 ZT+Drip+Residue 6.61 6.61      38961
#> 5         PB+SSDI 8.30 8.30      42715
#> 6 PB+SSDI+Residue 8.24 8.24      46221

3. Food Module

# Harvest Index
bio_yield <- d$grain_yield + d$straw_yield
hi <- harvest_index(d$grain_yield, bio_yield)
#> Harvest index computed.

# Protein Yield (assuming 22% protein in pulses)
py <- protein_yield(d$grain_yield, protein_content = 22)
#> Protein yield computed (kg/ha).

data.frame(Treatment = d$treatment, HI = hi, Protein_kg_ha = py)
#>         Treatment     HI Protein_kg_ha
#> 1        CT+Flood 0.4033         215.6
#> 2    CT+Sprinkler 0.4000         246.4
#> 3         ZT+Drip 0.4089         281.6
#> 4 ZT+Drip+Residue 0.4023         303.6
#> 5         PB+SSDI 0.3994         319.0
#> 6 PB+SSDI+Residue 0.4020         347.6

4. Nutrient Module

# Partial Factor Productivity of N
pfp <- partial_factor_productivity(d$grain_yield, d$n_applied)
#> PFP computed (kg/kg).

# Nutrient Harvest Index for N
nhi <- nutrient_harvest_index(d$grain_n_uptake, d$n_uptake)
#> NHI computed.

data.frame(Treatment = d$treatment, PFP_N = pfp, NHI_N = nhi)
#>         Treatment PFP_N  NHI_N
#> 1        CT+Flood  49.0 0.7538
#> 2    CT+Sprinkler  56.0 0.7566
#> 3         ZT+Drip  64.0 0.7639
#> 4 ZT+Drip+Residue  69.0 0.7670
#> 5         PB+SSDI  72.5 0.7697
#> 6 PB+SSDI+Residue  79.0 0.7711

5. Carbon Module

# Carbon Footprint (IPCC AR6 GWP: CH4=27, N2O=273)
cf <- carbon_footprint(
  diesel_use = d$diesel_use[1],
  electricity_use = d$electricity_kwh[1],
  n_fertilizer = d$n_applied[1],
  p_fertilizer = d$p_applied[1],
  yield = d$grain_yield[1]
)
#> Carbon footprint: 571.2 kg CO2-eq/ha (GWP AR6: CH4=27, N2O=273).
cf$breakdown
#>         source emission_kg_CO2eq share_pct
#> 1       Diesel             174.2      30.5
#> 2  Electricity             147.6      25.8
#> 3 N_fertilizer              99.2      17.4
#> 4 P_fertilizer              64.4      11.3
#> 5 K_fertilizer               0.0       0.0
#> 6    Pesticide               0.0       0.0
#> 7         Seed               0.0       0.0
#> 8   N2O_direct              85.8      15.0
#> 9          CH4               0.0       0.0

# Soil Carbon Stock
soc <- soil_carbon_stock(d$soc_pct, d$bulk_density, depth = 30)
#> SOC stock computed (Mg C/ha).

# Global Warming Potential (example)
gwp100 <- global_warming_potential(co2 = 500, ch4 = 10, n2o = 2)
#> GWP computed: 1316 kg CO2-eq/ha (100yr horizon, IPCC AR6).
gwp20 <- global_warming_potential(co2 = 500, ch4 = 10, n2o = 2,
                                   time_horizon = "20yr")
#> GWP computed: 1856 kg CO2-eq/ha (20yr horizon, IPCC AR6).

6. Nexus Integration

# Full Nexus Summary
ns <- nexus_summary(
  yield = d$grain_yield,
  water_consumed = d$total_water,
  energy_input = d$energy_input,
  energy_output = e_out,
  n_applied = d$n_applied,
  n_uptake = d$n_uptake,
  carbon_emission = d$ghg_emission,
  treatment_names = d$treatment
)
#> Nexus summary computed for 6 treatments.
ns[, c("treatment", "EROI", "nexus_index")]
#> WEFNC Nexus Analysis Results
#> ---------------------------------------- 
#> Treatments: 6 
#> Nexus Index range: 0 - 0.978 
#> Best performer: PB+SSDI+Residue 
#> 
#>        treatment EROI nexus_index
#>         CT+Flood 3.63      0.0000
#>     CT+Sprinkler 4.77      0.2669
#>          ZT+Drip 6.47      0.5933
#>  ZT+Drip+Residue 6.61      0.6731
#>          PB+SSDI 8.30      0.8800
#>  PB+SSDI+Residue 8.24      0.9782

Radar Plot

scores <- as.matrix(ns[, c("W_score", "E_score", "F_score",
                             "N_score", "C_score")])
nexus_radar(scores, treatment_names = d$treatment)

Sustainability Scoring

nss <- nexus_sustainability_score(
  water_score = ns$W_score,
  energy_score = ns$E_score,
  food_score = ns$F_score,
  nutrient_score = ns$N_score,
  carbon_score = ns$C_score
)
#> Sustainability scores with categories computed.
nss[, c("nexus_score", "category")]
#> WEFNC Sustainability Assessment
#> ---------------------------------------- 
#>   Score: 0.0000 -> Unsustainable
#>   Score: 0.2669 -> Unsustainable
#>   Score: 0.5933 -> Low Sustainability
#>   Score: 0.6731 -> Moderately Sustainable
#>   Score: 0.8800 -> Highly Sustainable
#>   Score: 0.9782 -> Highly Sustainable
#> 
#>  nexus_score               category
#>       0.0000          Unsustainable
#>       0.2669          Unsustainable
#>       0.5933     Low Sustainability
#>       0.6731 Moderately Sustainable
#>       0.8800     Highly Sustainable
#>       0.9782     Highly Sustainable

References

mirror server hosted at Truenetwork, Russian Federation.