chrisschuerz / SWATrunR

Running SWAT projects within R
https://chrisschuerz.github.io/SWATrunR/
GNU General Public License v3.0
68 stars 30 forks source link

modifying RFINC in SWAT 2012 doesn't work #61

Open EdM44 opened 2 years ago

EdM44 commented 2 years ago

Using the demo:

demo_path <- 'Z:/ECC/Desktop/ceng162/swat_examples/demo' path_2012 <- load_demo(dataset = 'project', path = demo_path, version = '2012') q_sim_2012_2 <- run_swat2012(project_path = path_2012, output = list(q = define_output(file = 'rch', variable = 'FLOW_OUT', unit = 1:3)))

increase precipitation by 50%

par_chg <- c("RFINC.sub | change = abschg" = 50.0, "TMPINC.sub | change = abschg" = 0.0) q_sim_2012_cc <- run_swat2012(project_path = path_2012, output = list(q = define_output(file = 'rch', variable = 'FLOW_OUT', unit = 1:3)), parameter = par_chg)

This runs fine but produces no change in output -- exactly the same results as q_sim_2012_2

A second trial imposing an absolute change

par_chg <- c("RFINC.sub | change = absval" = 50.0, "TMPINC.sub | change = absval" = 0.0) q_sim_2012_cc <- run_swat2012(project_path = path_2012, output = list(q = define_output(file = 'rch', variable = 'FLOW_OUT', unit = 1:3)), parameter = par_chg)

Fails with a message:

task 1 failed - "Mapped vectors must have consistent lengths:

* .x has length 21

* .y has length 19"

Is there a way to do this with SWATplusR?

EdM44 commented 2 years ago

I wanted to add that I understand the main function of SWATplusR is to facilitate calibration, and climate change is not part of that. In addition, changing these parameters directly in the .sub files is not that difficult. I was just thinking that exploring basin sensitivity to changes in temperature and precipitation is a useful capability, and I hope it can be implemented in this package. It may already have this capability and it's just user error...

chrisschuerz commented 2 years ago

@EdM44 it is not a user error, this I can tell you alread :) You are right I did not think of including these parameters in the parameter modification routine. The simple reason is that those mixed input files with parameters in columns and parameters in lines are just more work to implement. So I focused on the relevant ones. If this is something of interest to many SWAT2012 users I can think of implementing these parameters. I am afraid that I will not have time for an implementation in the next months.

EdM44 commented 2 years ago

Thanks for the reply and the clarification! My needs are limited, since I am currently using SWAT for teaching only. I'll also be migrating to SWAT+ next time around. But if you hear from others interested in modifying these parameters using your package, I'd be glad to help in testing.