Download and install miniconda: https://conda.io/miniconda.html
Make sure you are using the conda-forge channel:
$ conda config --add channels conda-forge
$ conda update --yes conda python
Install gsshapy:
$ conda create -n gssha python=2
$ source activate gssha
(gssha)$ conda install --yes gsshapy jupyter
Install GSSHA: http://www.gsshawiki.com/GSSHA_Download
Make sure GSSHA is on the PATH:
In [5]:
!gssha70
In [1]:
import os
from datetime import datetime, timedelta
from gsshapy.modeling import GSSHAFramework
Setup environment:
In [2]:
# assuming notebook is run from examples folder
base_dir = os.getcwd()
gssha_model_name = 'philippines_example'
gssha_model_directory = os.path.join(base_dir, gssha_model_name)
Run the model:
In [3]:
gr = GSSHAFramework("gssha70",
gssha_model_directory,
"{0}.prj".format(gssha_model_name),
gssha_simulation_start=datetime(2017, 5 ,9),
gssha_simulation_duration=timedelta(seconds=2*60))
# http://www.gsshawiki.com/Model_Construction:Defining_a_uniform_precipitation_event
rain_intensity = 24 # mm/hr
rain_duration = timedelta(seconds=1*60) # 2 minutes
gr.event_manager.add_uniform_precip_event(rain_intensity,
rain_duration)
gssha_event_directory = gr.run()
The gssha_event_directory
is where the simulation output is stored.
In [4]:
gssha_event_directory
Out[4]:
In [ ]: