From 9926fa694a24f19eaca6258ccc280b8644491ac0 Mon Sep 17 00:00:00 2001 From: Vitor Hirata Sanches Date: Fri, 13 Dec 2024 07:44:54 +0100 Subject: [PATCH 1/2] Fix ExpuhNode tau_s value type The 'Bare node creation' test was returning an error when passing an expuh: `MethodError: no method matching unsafe_convert(::Type{Float64}, ::Int64)`. This happened because tau_s value was an integer and should be a float. This commit change the default value of tau_s from 5 to 5.0. --- .test | 0 src/Nodes/IHACRES/IHACRESExpuhNode.jl | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 .test diff --git a/.test b/.test new file mode 100644 index 0000000..e69de29 diff --git a/src/Nodes/IHACRES/IHACRESExpuhNode.jl b/src/Nodes/IHACRES/IHACRESExpuhNode.jl index 50578e3..6a7b81d 100644 --- a/src/Nodes/IHACRES/IHACRESExpuhNode.jl +++ b/src/Nodes/IHACRES/IHACRESExpuhNode.jl @@ -12,7 +12,7 @@ Base.@kwdef mutable struct ExpuhNode{P, A<:AbstractFloat} <: IHACRESNode e::P = Param(1.0, bounds=(0.1, 1.5)) # temperature to PET conversion factor f::P = Param(0.8, bounds=(0.01, 3.0)) # plant stress threshold factor (multiplicative factor of d) tau_q::P = Param(1.0, bounds=(0.0, 5.0)) - tau_s::P = Param(5, bounds=(5.0, 200.0)) + tau_s::P = Param(5.0, bounds=(5.0, 200.0)) v_s::P = Param(0.5, bounds=(0.0, 1.0)) storage_coef::P = Param(2.9, bounds=(0.2, 10.0)) From dfc3f7cd162a24965cab0e4f84e8aada2be942e6 Mon Sep 17 00:00:00 2001 From: Vitor Hirata Sanches Date: Fri, 13 Dec 2024 08:16:09 +0100 Subject: [PATCH 2/2] Fix no method matching on IHACRESExpuhNode update_state The "Bare node creation" test using IHACRESExpuhNode is returning an error: `MethodError: no method matching update_state`. This is happening because the commit 775a575f4dfe42fdedc3748fde9618fd117d6b8e changed the definition of some methods and not all usage of them have changed. It adds a "!" to the update_state method on IHACRESExpuhNode.jl. --- src/Nodes/IHACRES/IHACRESExpuhNode.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Nodes/IHACRES/IHACRESExpuhNode.jl b/src/Nodes/IHACRES/IHACRESExpuhNode.jl index 6a7b81d..2fc0662 100644 --- a/src/Nodes/IHACRES/IHACRESExpuhNode.jl +++ b/src/Nodes/IHACRES/IHACRESExpuhNode.jl @@ -167,7 +167,7 @@ function run_node!(s_node::ExpuhNode, level::Float64 = @ccall IHACRES.calc_ft_level(outflow::Cdouble, s_node.level_params::Ptr{Cdouble})::Cdouble - update_state(s_node, cmd, e_rainfall, et, quick_store, slow_store, outflow, level, gw_store) + update_state!(s_node, cmd, e_rainfall, et, quick_store, slow_store, outflow, level, gw_store) return (outflow, level) end @@ -213,7 +213,7 @@ function run_node_with_temp!(s_node::ExpuhNode, rain::Float64, temp::Float64, in level::Float64 = @ccall IHACRES.calc_ft_level(outflow::Cdouble, s_node.level_params::Ptr{Cdouble})::Cdouble - update_state(s_node, cmd, e_rainfall, et, quick_store, slow_store, outflow, level, gw_store) + update_state!(s_node, cmd, e_rainfall, et, quick_store, slow_store, outflow, level, gw_store) return (outflow, level) end