Structure for Unifying Multiple Modeling Alternative (SUMMA) is a hydrologic modeling approach that is built on a common set of conservation equations and a common numerical solver, which together constitute the structural core of the model. Different modeling approaches can then be implemented within the structural core, enabling a controlled and systematic analysis of alternative modeling options, and providing insight for future model development.
This notebook demonstrates how to harmonize different libraries and tools provided in the CyberGIS-Jupyter environment to run SUMMA model with a High Performance Computer (HPC) resource (Lyu 2019). The SUMMA Model instance used is a part of the Clark et al., (2015) study, and explored the impact of different stomatal resistance parameterizations on total evapotranspiration (ET) in the Reynolds Mountain East catchment in southwestern Idaho.
Lyu, F., Yin, D., Padmanabhan, A., Choi, Y., Goodall, J. L., Castronova, A., Tarboton, D., Wang, S. (2019) “Bridging Reproducible Hydrological Modeling with CyberGIS-Jupyter: A Case Study on SUMMA”. In: Proceedings of Practice and Experience in Advanced Research Computing (PEARC19), July 28-August 1, 2019, Chicago, IL, USA. https://dl.acm.org/citation.cfm?id=3333052
Clark, M. P., B. Nijssen, J. Lundquist, D. Kavetski, D. Rupp, R. Woods, E. Gutmann, A. Wood, D. Gochis, R. Rasmussen, D. Tarboton, V. Mahat, G. Flerchinger, and D. Marks, 2015: A unified approach for process-based hydrologic modeling: Part 2. Model implementation and example applications. Water Resources Research, 51, doi: 10.1002/2015WR017200
resource_id = '1f3f310af8364d2aa3e6a9459152a21c'
import json
import os
from hs_restclient import HydroShare, HydroShareAuthBasic
auth = HydroShareAuthBasic("cybergis", "demo")
hs = HydroShare(auth=auth)
base_dir = os.path.abspath('/home/jovyan/work')
download_dir = os.path.join(base_dir, 'Downloads')
!mkdir -p {download_dir}
hs.getResource(resource_id, destination=download_dir, unzip=True)
import os
#Unzip model file
model_folder_name = "SummaModel_ReynoldsAspenStand_StomatalResistance_sopron"
content_folder = os.path.join(download_dir ,"{}/{}/data/contents".format(resource_id, resource_id))
file_manger_rel_path = "settings/summa_fileManager_riparianAspenSimpleResistance.txt"
import tempfile
workspace_dir = os.path.join(base_dir, 'workspace')
!mkdir -p {workspace_dir}
unzip_dir = tempfile.mkdtemp(dir=workspace_dir)
!cd {content_folder} && unzip -o {model_folder_name}.zip -d {unzip_dir}
print("Unzipping Done")
model_source_folder_path = os.path.join(unzip_dir, model_folder_name)
!cd {model_source_folder_path} && chmod +x ./installTestCases_local.sh
!cd {model_source_folder_path} && ./installTestCases_local.sh
from pysumma import Simulation
# path to the SUMMA filemanager file on Jupyter
file_manager = os.path.join(model_source_folder_path, file_manger_rel_path)
# Create pySUMMA Simulation Object
executable = ""
S = Simulation(executable, file_manager)
# Configure the model
S.decisions['simulStart'].value = "2006-07-01 00:00"
S.decisions['simulFinsh'].value = "2007-08-20 00:00"
S.decisions['stomResist'].value = 'BallBerry'
# Save configiuration to disk
S._write_configuration()
print(S)
from cybergis import summaUI
s = summaUI(model_source_folder_path, file_manger_rel_path,
workspace_dir)
s.runSumma()
job_dir = os.path.join(workspace_dir,
"{}/output".format(s.job_local_id))
summa_output = os.path.join(job_dir,
"vegImpactsTranspire_output_test_timestep.nc")
print(summa_output)
import xarray as xr
output_info = xr.open_dataset(summa_output)
output_info
%matplotlib inline
import matplotlib.pyplot as plt
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
x = output_info['time']
y = (output_info['scalarCanopyTranspiration'] + \
output_info['scalarCanopyEvaporation'] + \
output_info['scalarGroundEvaporation'])*3600
plt.figure(figsize=(15, 5))
plt.plot(x, y, color='grey', linestyle='solid', markersize=0)
# Get the current axis of the plot and
# set the x and y-axis labels
ax = plt.gca()
ax.set_ylabel("Total ET (kg m-2 h-1)")
ax.set_xlabel('Date')
ax.grid(True)
ax.set_title('SUMMA Plot for Total ET')
output_info.close()
! rm -rvf {unzip_dir} {job_dir}