Hello everyone,
I faced with a problem in HBV snow simulation as well as Skaugen snow, there is no problem in Gamma snow simulation & calibration.
To get the SCA (Snow Cover Area) in Gamma snow I use the following command as it mentioned in ShyFT Help (http://shyft.readthedocs.io/en/latest/notebooks/nea-example/simulation-configured.html )
sca = simulator.region_model.gamma_snow_response.sca([],idx)
and it works well,
but for HBV snow and Skaugen snow routines whenever I run the following codes, ShyFT crashes and stop
HBV snow
sca = simulator.region_model.hbv_snow_state.sca([],idx)
swe = simulator.region_model.hbv_snow_state.swe([],idx)
Skaugen snow
sca = simulator.region_model.skaugen_snow_state.sca([],idx)
swe = simulator.region_model.skaugen_snow_state.swe([],idx)
One of the error page is attached, I used the latest SHyFT version which is updated on 28 May (I think)
It would be really grateful if any help receive which there is no any progress in my project with these problems,
Best Regards,
Amir
Hi Felix
Thanks for your response, I think that I use full model for HBV and Skaugen, and the first line of docstring says:
“ PTHSKModel , a region_model is the calculation model for a region, where we can have\none or more catchments.”
Also, I attached a screen shot too that shows the HBV and Skaugen model,
I am looking forward to hearing from you
Best,
Amir
From: Felix Matt
Sent: Friday, June 15, 2018 12:11 PM
To: amir kk
Subject: Re: SHyFT keeps crashing in HBV snow & Skaugen snow ( SCA, SWE )
Hi Amir,
I just tried to reproduce the error (with a slightly older version of shyft though), but everything works fine.
Are you sure you are using the full models for hbv and skaugen, not using the optimized region model?
What does it say in the first line if you look at simulator.region_model.__doc__?
Best,
Felix
--
You received this message because you are subscribed to the Google Groups "shyft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shyft+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shyft/5b233fc4.1c69fb81.f52e1.8958%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.
Hi Amir,
yes, it seems like you are using the full model, that's good. And
in case you would not, an error should be raised if you try to
access the HBV snow states instead of python crashing. I just
tested this.
But another question: Are you sure you successful run the model
prior to accessing the collection of states? Please re-run the
notebook and check in the simulation step
(simulator.region_model.run_cells(), or simulator.run()) runs
without error, just to be sure.
In case you do not run the model correctly, the state vector is not populated with values. If you try to access the states at this stage, it seems like python crashes instead of simply throwing an error or returning n empty vector (just tested).
Seems too simple to being the solution to your problem, but better check this :-)
Felix
To view this discussion on the web visit https://groups.google.com/d/msgid/shyft/5b23c34b.1c69fb81.9fa4b.acc8%40mx.google.com.
Hi again,
It seems that everything works properly and fine prior the error raising, I recorded the screen while it is running, it would be nice if you have a look and see if there is something fishy
Thanks a lot for your Help,
Amir
Sent from Mail for Windows 10
From: Felix Matt
Sent: Friday, June 15, 2018 4:11 PM
To: sh...@googlegroups.com
Subject: Re: SHyFT keeps crashing in HBV snow & Skaugen snow ( SCA, SWE )
Hi Amir,
yes, it seems like you are using the full model, that's good. And in case you would not, an error should be raised if you try to access the HBV snow states instead of python crashing. I just tested this.
But another question: Are you sure you successful run the model prior to accessing the collection of states? Please re-run the notebook and check in the simulation step (simulator.region_model.run_cells(), or simulator.run()) runs without error, just to be sure.
In case you do not run the model correctly, the state vector is not populated with values. If you try to access the states at this stage, it seems like python crashes instead of simply throwing an error or returning n empty vector (just tested).
Seems too simple to being the solution to your problem, but better check this :-)
Felix
On 15. juni 2018 15:46, amir kk wrote:
Hi Felix
To view this discussion on the web visit https://groups.google.com/d/msgid/shyft/2dce86bb-5393-9efe-c221-7f778771f43d%40geo.uio.no.
Hi Amir, I suspect that your idx exceeds the state collector vector size when accessing the data. Could you test with idx=0 and see if that works?
Best, Felix
Hi again,
The problem is solved now. State collection was not enabled by default, which lead to a segmentation fault when accessing the empty state-collection vector after running the model.
Enabling state collection solved the problem:
simulator.region_model.set_state_collection(-1,True)
Still, instead of a segmentation fault, an error should be raised.
Segmentation fault appear when state collectors are accessed at indexes that exceed the size of the vector:
* always, if state_collection is
disabled or state collectors are accessed prior to a model run
* if states are collected, but the
states are accessed at an index that exceeds the size of the
vector
Felix