From 36d0ff27e2c6beae5e77102d3cde73f8b6d79dbc Mon Sep 17 00:00:00 2001
From: Moritz Shore <moritzshore@gmail.com>
Date: Tue, 22 Oct 2024 17:55:03 +0200
Subject: [PATCH] Update malanta_fix.R

Now working with variable output
---
 malanta_fix.R | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/malanta_fix.R b/malanta_fix.R
index e053b85..b270239 100644
--- a/malanta_fix.R
+++ b/malanta_fix.R
@@ -7,8 +7,8 @@ remotes::install_github(repo = "moritzshore/rswap", ref = remotes::github_releas
 # load rswap
 library(rswap)
 
-# The package version should be 0.5.1
-packageVersion("rswap") == "0.5.1"
+# The package version should be 0.5.2
+packageVersion("rswap") == "0.5.2"
 
 # tell rswap where your setup is located
 malanta = "C:/Users/mosh/Documents/GIT/rswap_applications/Malanta/"
@@ -16,14 +16,13 @@ malanta = "C:/Users/mosh/Documents/GIT/rswap_applications/Malanta/"
 # a test run of the model
 run_swap(malanta, verbose = T, autoset_output = T)
 rswap::rswap_plot_multi(malanta, vars = "WC", show = "WC")
-
 # and a sensitivity run.
 result_df <- check_swap_sensitivity(
   malanta,
   variable = "ALFA",
   values = seq(0.05, 0.3, by = 0.01),
   row = 1,
-  verbose = F,
+  verbose = T,
   statistic = "NSE",
   obs_variable = "WC",
   autoset_output = T
@@ -38,7 +37,18 @@ result_df
 # a lot earlier. My bad.
 
 # Also, if you would like to see the effect of your parameter on a model
-# variable (like Water content) instead of performance indicator (like NSE),
-# I'll have to disappoint you because I haven't implemented that yet. If you
-# would like to have it though, let me know because it should be pretty easy to
-# add.
+# variable (like Water content) instead of performance indicator (like NSE), all
+# you need to do is remove the `statistic = "NSE"` and add the depth of your
+# observed variable, then you will get just that:
+get_swap_depths(load_swap_observed(malanta))
+
+
+result_df <- check_swap_sensitivity(
+  malanta,
+  variable = "ALFA",
+  values = seq(0.05, 0.3, by = 0.01),
+  row = 1,depth = 10,
+  verbose = T,
+  obs_variable = "WC",
+  autoset_output = T, force = T
+)
-- 
GitLab