[hydromad] returning states for Sacramento model?

39 views
Skip to first unread message

Saalem Adera

unread,
Nov 27, 2021, 7:19:42 PM11/27/21
to hydromad users
Hi everyone, 

I want to return the internal model states and fluxes for the Sacramento model.  I am able to do that using the argument "return_state = TRUE" in the "update()" function (example below).  However, the R help page for the Sacramento model indicates that "return_state" is not currently supported (https://hydromad.catchment.org/man/sacramento.html).  Is return_state not supported when used on the Sacramento model within update() as well?  Or can I trust the states and fluxes returned by "return_state" in this case?  If they cannot be trusted, is there another way to return the model states and fluxes for the Sacramento model?

Thanks so much for your help, 
Saalem

test_model <- hydromad(DATA=test_data, sma="sacramento")
test_model_calibrated <- fitBySCE(test_model, control=list(trace=1)) 
test_model_calibrated_states <- update(test_model_calibrated, return_state=TRUE)


Willem Vervoort

unread,
Nov 27, 2021, 9:13:09 PM11/27/21
to hydromad-users
Hi Saalem,
It might be because the C implementation of Sacramento that is used in hydromad does not return the states of the different stores. But the R source code is confusing (I have to admit I have not looked at that in detail). It has an option for return_state = T, but I don't know if this actually returns anything:
You probably need to dig into it and run some tests
You can easily fork or download the repos from github

Willem 

--
You received this message because you are subscribed to the Google Groups "hydromad users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hydromad-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hydromad-users/9a50d7be-c7b2-4215-84bd-5b889f226b68n%40googlegroups.com.

Saalem Adera

unread,
Nov 29, 2021, 3:20:37 AM11/29/21
to hydroma...@googlegroups.com
Hi Willem, 

Thanks so much for your help!

Hmm, I've found that when return_state=T, values are actually returned for the model states and fluxes - even though the help page for the Sacramento function says that this is not supported.  However, I'm just not sure whether the values returned are trustworthy because of the help page saying that this behavior is not supported.  I tried taking a look at the C implementation of Sacramento in hydromad in the repo (as you suggested) and noticed that there appears to be a separate script for running the Sacramento model when states are requested (sacramento_state.c).  The notes for this script indicate that it was adapted (from the University of Arizona MOSCEM project) to export states by Joseph Guillaume on 2013-10-24.  So, perhaps it is possible that this updated script returns states and the help page is simply out of date?   However, I don't know C, so it is hard for me to independently evaluate exactly what these scripts are doing, how they are being called by the R script, and whether the values generated are trustworthy.  

I'll try to take a closer look soon, but, in the meantime, if anyone else has already looked into this, I would love to hear your thoughts!

Thanks,
Saalem   

You received this message because you are subscribed to a topic in the Google Groups "hydromad users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hydromad-users/7q5SB7e7U0g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hydromad-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hydromad-users/CAHJpk%3DKrAoVxAg_C%3DZv76f2Y1TEoSnxkGgO_BZQ2ZMgUkB0OZQ%40mail.gmail.com.


--

Joseph Guillaume

unread,
Jan 16, 2022, 6:59:22 PM1/16/22
to hydromad users
Hi,

The help files on the website are out of date. We are slowly moving to a new website.
Please look at the help files provided in the package.

Yes, sacramento does now return state variables as described in the help file in the package.

Best,

Joseph

Saalem Adera

unread,
Jan 16, 2022, 8:26:06 PM1/16/22
to hydroma...@googlegroups.com
Great, that's really helpful.  Thanks so much, Joseph!

Mehnaz Akhter

unread,
Nov 24, 2022, 2:39:25 AM11/24/22
to hydromad users
sir,
kindly mention how to get simulated flows from calibrating sacsma model.Is it "U" term in the outputs which gives simulated output?

Reply all
Reply to author
Forward
0 new messages