Opened 10 months ago
Closed 7 months ago
#3259 closed help (answered)
Connecting SWAT model to SPOTPY package in Python
Reported by: | hmbadjana | Owned by: | pmcguire |
---|---|---|---|
Component: | Land Surface Modelling | Keywords: | SWAT, Python |
Cc: | Platform: | ||
UM Version: |
Description
Hi
I would like to request for support on connecting the SWAT model to the Python package SPOTPY for sensitivity analysis. In addition to the package documentation, I am following the following documents:
https://www.sheffield.ac.uk/polopoly_fs/1.742974!/file/Workshop6_Presentation_Camargos.pdf
The problem I am having is about the def simulation(self, vector) and especially the bsnManipulator() function which is not defined.
Thanks very much in advance.
Maleki
Attachments (1)
Change History (10)
Changed 10 months ago by hmbadjana
comment:1 Changed 10 months ago by pmcguire
- Status changed from new to accepted
comment:2 Changed 10 months ago by pmcguire
- Cc p.mcguire@… removed
comment:3 Changed 10 months ago by pmcguire
Hi Maleki:
On jasmin-sci3, I installed spotpy in my home directory.
I followed the directions from
https://spotpy.readthedocs.io/en/latest/getting_started/
https://help.jasmin.ac.uk/article/4489-python-virtual-environments
I don't see anything about bsnManipulator functions in the spotpy github code.
In the presentation from Carla Carmagos that you sent me:
https://www.sheffield.ac.uk/polopoly_fs/1.742974!/file/Workshop6_Presentation_Camargos.pdf
the page with bsnManipulator on it looks like a code snippet, and might be missing the definition of bsnManipulator. Maybe you can ask Carla Carmagos for the rest of the code, or something like that?
And from the directions that I list in the first paragraph above, I did this command sequence on jasmin-sci3 in order to install and run spotpy:
cd ~
mkdir spotpy
cd spotpy
svn co https://github.com/thouska/spotpy.git
cd spotpy.git
virtualenv —system-site-packages ~/Python2.7_spotpy_env
source ~/Python2.7_spotpy_env/bin/activate
cd spotpy.git/trunk
more README.md
python2.7 setup.py install
cd ../..
cp -p ~pmcguire/spotpy/test1.py .
more test1.py
which python
more test1.py
python test1.py
And I get this as as a result:
99800 of 100000, min objf=-2.31976e+06, max objf=-1.39639, time remaining: 00:00:03
99989 of 100000, min objf=-2.31976e+06, max objf=-1.39639, time remaining: 00:00:00
99993 of 100000, min objf=-2.31976e+06, max objf=-1.39639, time remaining: 00:00:00
* Final SPOTPY summary *
Total Duration: 1270.63 seconds
Total Repetitions: 100000
Minimal objective value: -2.31976e+06
Corresponding parameter setting:
x: 9.91467
y: -9.97133
z: -7.68335
Maximal objective value: -1.39639
Corresponding parameter setting:
x: 0.835873
y: 0.617738
z: 0.306226
Please let me know how this turns out.
Patrick
comment:4 Changed 10 months ago by hmbadjana
Hi Patrick,
Thanks very much for your support.
With regards to bsnManipulator, I have already sent two e-mails but have not receive any reply.
I will update you as soon as I hear from them.
Best regards
Maleki
comment:5 Changed 8 months ago by pmcguire
Hi Maleki
Is everything working now?
Patrick
comment:6 Changed 8 months ago by hmbadjana
Hi Patrick,
I received an e-mail from Carla a couple of days ago. She said she will get back to me with the necessary information on how to do it.
Thanks.
Maleki
comment:7 Changed 8 months ago by pmcguire
Hi Maleki
I am glad you are in touch with Carla.
If she is able to help you, would it be ok with you and her if you could put some details about how to solve the problem, as a reply to this ticket? That way, we have some documentation for others to follow if they have similar issues.
Patrick
comment:8 Changed 7 months ago by pmcguire
Hi Maleki
I will close this ticket now.
Patrick
comment:9 Changed 7 months ago by pmcguire
- Resolution set to answered
- Status changed from accepted to closed
This is a sample of .bsn file