From c346859ae576b2d01e5110cc828e563f7338028e Mon Sep 17 00:00:00 2001
From: Daniel Vedder <daniel.vedder@idiv.de>
Date: Tue, 11 Feb 2025 15:33:41 +0100
Subject: [PATCH] Updated weather.jl to new weather parameters

Now include cloud cover, humidity, and ETo, dropped vapourpressure
---
 src/world/weather.jl | 32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/src/world/weather.jl b/src/world/weather.jl
index 8905303..e78d2e8 100644
--- a/src/world/weather.jl
+++ b/src/world/weather.jl
@@ -13,10 +13,12 @@ struct Weather
     windspeed::Union{Missing,Float64}
     precipitation::Union{Missing,Float64}
     sunshine::Union{Missing,Float64}
-    vapourpressure::Union{Missing,Float64}
+    cloudcover::Union{Missing,Float64}
+    humidity::Union{Missing,Float64}
     meantemp::Union{Missing,Float64}
     maxtemp::Union{Missing,Float64}
     mintemp::Union{Missing,Float64}
+    evapotranspiration::Union{Missing,Float64}
 end
 
 """
@@ -31,15 +33,15 @@ mapped to dates.
 function initweather(weatherfile::String, startdate::Date, enddate::Date)
     @debug "Initialising weather"
     data = CSV.File(weatherfile, missingstring="NA", dateformat="yyyymmdd",
-                    types=[Date, Float64, Float64, Float64, Float64,
+                    types=[Date, Float64, Float64, Float64, Float64, Float64,
                            Float64, Float64, Float64])
     weather = Dict{Date,Weather}()
     for row in data
         if row.date >= startdate && row.date <= enddate
             weather[row.date] = Weather(row.mean_windspeed, row.precipitation,
-                                        row.sunshine_hours, row.mean_vapour_pressure,
-                                        row.mean_temperature, row.max_temperature,
-                                        row.min_temperature)
+                                        row.sunshine_hours, row.mean_cloud_cover,
+                                        row.mean_humidity, row.mean_temperature,
+                                        row.max_temperature, row.min_temperature)
         end
     end
     if length(weather) <= Dates.value(enddate-startdate)
@@ -76,12 +78,12 @@ function sunshine(model::SimulationModel)
 end
 
 """
-    vapourpressure(model)
+    humidity(model)
 
-Return today's average vapour pressure in hPa.
+Return today's average vapour pressure in %.
 """
-function vapourpressure(model::SimulationModel)
-    model.weather[model.date].vapourpressure
+function humidity(model::SimulationModel)
+    model.weather[model.date].humidity
 end
 
 """
@@ -110,3 +112,15 @@ Return today's minimum temperature in °C.
 function mintemp(model::SimulationModel)
     model.weather[model.date].mintemp
 end
+
+"""
+    evapotranspiration(model)
+
+Return today's potential evapotranspiration (ETo), based on
+the
+"""
+function evapotranspiration(model::SimulationModel)
+    model.weather[model.date].evapotranspiration
+end
+
+#TODO add functions for evapotranspiration
-- 
GitLab