## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.width = 7,
  fig.height = 5
)

## ----load---------------------------------------------------------------------
library(ET0MassModels)
data(jhansi_weather)
head(jhansi_weather)

## ----single-day---------------------------------------------------------------
# FAO Penman-Monteith (reference)
et0_fao_pm(Tmin = 15, Tmax = 35, RH_morning = 90, RH_evening = 40,
           u2 = 1.5, n = 9, J = 172, lat = 25.43, z = 216)

# Dalton (linear wind function)
et0_dalton(Tmin = 15, Tmax = 35, RH_morning = 90, RH_evening = 40, u = 1.5)

# Romanenko (temperature and humidity based)
et0_romanenko(Tmean = 25, Tmin = 15, Tmax = 35,
              RH_morning = 90, RH_evening = 40)

## ----all-models---------------------------------------------------------------
result <- et0_mass_all(
  Tmin       = jhansi_weather$Tmin[1:5],
  Tmax       = jhansi_weather$Tmax[1:5],
  RH_morning = jhansi_weather$RH_morning[1:5],
  RH_evening = jhansi_weather$RH_evening[1:5],
  u2         = jhansi_weather$WS[1:5],
  n          = jhansi_weather$SSH[1:5],
  J          = jhansi_weather$J[1:5],
  lat        = 25.43,
  z          = 216
)
round(result, 2)

## ----evaluation---------------------------------------------------------------
full_result <- et0_mass_all(
  Tmin       = jhansi_weather$Tmin,
  Tmax       = jhansi_weather$Tmax,
  RH_morning = jhansi_weather$RH_morning,
  RH_evening = jhansi_weather$RH_evening,
  u2         = jhansi_weather$WS,
  n          = jhansi_weather$SSH,
  J          = jhansi_weather$J,
  lat        = 25.43,
  z          = 216
)

obs   <- full_result$FAO_PM
preds <- full_result[, c("Dalton", "Meyer", "WMO", "Mahringer")]
metrics <- evaluate_models(obs, preds)
print(metrics)

## ----scatter, fig.width=6, fig.height=6---------------------------------------
plot_scatter(obs, preds,
             main = "Mass Transfer-Based Models vs FAO-PM")

## ----taylor, fig.width=7, fig.height=7----------------------------------------
plot_taylor(obs, preds,
            main = "Taylor Diagram - Mass Transfer-Based Models")

