One part of the Clark et al. (2015) study explored the impact of the choice of canopy shortwave radiation parameterizations on simulations of below canopy shortwave radiation for three representative water years at the aspen site in the Reynolds Mountain East catchment. This study looked at four different canopy shortwave radiation parameterizations: BeersLaw method(as implemented in VIC), NL_scatter method(Nijssen and Lettenmaier, JGR 1999:NL 1999), UEB_2stream method(Mahat and Tarboton, WRR 2011:MT 2012), CLM_2stream method(Dick 1983)
In this Jupyter Notebook, the pySUMMA library is used to reproduce this analysis. First, the four different canopy shortwave radiation parameteriations are described. Next, the Methods section describes how the pySUMMA can be used to create four different canopy shortwave radiation parameterizations of the Reynolds Mountain East catchment model. The Results section shows how to use pySUMMA and the Pandas library to reproduce Figure 1(above) from Clark et al. (2015).
Collectively, this Jupyter Notebook serves as an example of how hydrologic modeling can be conducted directly within a Jupyter Notebook by leveraging the pySUMMA library.
An important source of predictive differences among hydrologic and land-surface models is the method used to simulate the transmission and attenuation of shortwave radiation through the vegetation canopy. The main inter-model differences stem from (i) the methods used to simulate radiation transmission through homogenous vegetation [Dickinson, 1983; Sellers, 1985; Nijssen and Lettenmaier, 1999; Mahat and Tarboton, 2012]; (ii) the methods used to parameterize the impact of the canopy gap fraction on grid-average shortwave radiation fluxes [Cescatti, 1997; Kucharik et al., 1999; Niu and Yang, 2004; Essery et al., 2008]; and (iii) the methods used to represent spatial variability in vegetation type [Koster and Suarez, 1992; Bonan et al., 2002]. In this paper the parameterizations of canopy shortwave radiation are restricted to radiation transmission through homogenous vegetation, as this approach is used in many existing models. Recent advances in modeling the impact of canopy heterogeneity on grid average fluxes [e.g., Essery et al., 2008] are not included at this stage in model development, and will be considered in future work.
The methods considered for radiation transmission through homogenous vegetation allow for different levels of model complexity. At the simplest level we include an application of Beer’s Law for direct-beam radiation (e.g., as used in VIC). At a more complex level, we include methods that model direct and diffuse beams separately and account for multiple scattering and multiple reflections [Nijssen and Lettenmaier, 1999]. Building additional complexity, we also include options for two-stream radiative transfer models as implemented in UEB [Mahat and Tarboton, 2012] and the Noah-MP model and CLM [Dickinson, 1983; Sellers, 1985; Oleson et al., 2010; Niu et al., 2011].
The interception of direct-beam shortwave radiation by vegetation at zenith angle ${\theta}_{zen}$ can be described as [e.g., Mahat and Tarboton, 2012]
where ${dQ_{swb}}$ $(W {m}^{-2})$ is the downward shortwave radiation flux for the direct-beam, G (${m}^{2}{m}^{-2}$) is the leaf orientation factor defining the average area of leaves when viewed from direction ${\theta}_{zen}$, ${\eta_{l}}({m}^{2}{m}^{-3})$ is the leaf+stem density and z(m) is the vertical coordinate, positive downwards. Given the canopy depth ${D_{can}} = h_{top}^{veg} - h_{bot}^{veg}$ (m), integrating equation (1) results in Beer’s law [Mahat and Tarboton, 2012]
where ${dQ_{swb}^{0}}$ $(W {m}^{-2})$ defines the direct-beam shortwave radiation flux at the top of the canopy.
The penetration of direct beam shortwave radiation through the canopy in the absence of scattering can then be described as
where $V_{ex} = {\eta_{l} D_{can}} ({m}^{2}{m}^{-2}) $ defines the total exposed leaf+stem area, that is, the leaf+stem area that is not buried by snow.
Under the simplifying assumption that the total transmission of direct and diffuse radiation (τ) is equal to the penetration of direct beam radiation, i.e.,
the shortwave radiation flux absorbed by the vegetation canopy and the ground surface is
where ${\alpha^{veg}}$ and $\alpha^{sfc}$(-) define the albedo of the vegetation canopy and ground surface respectively, and $Q_{sw}^{0} = Q_{swb}^{0} + Q_{swd}^{0} (W {m}^{-2})$ is the sum of direct-beam and diffuse radiation at the top of the canopy. Note that ${\alpha^{veg}} $(-) defines the bulk canopy albedo, which is typically much lower than the reflectance of an individual leaf due to the partial trapping of light by layers of leaves [Dickinson, 1983; Nijssen and Lettenmaier, 1999].
The first term on the right-hand-side of equation (5) represents the shortwave radiation absorbed by the canopy on the downward pass, while the second term represents the shortwave radiation that is reflected by the surface and absorbed on the upward pass. The approach described by equations (4) through (6) is similar to that used in the Variable Infiltration Capacity (VIC) model [Liang et al., 1994] and the Distributed Hydrology Soil Vegetation Model (DHSVM) [Wigmosta et al., 1994; Wigmosta and Lettenmaier, 1999], except that (i) VIC and DHSVM do not include a dependence on the solar zenith angle; and (ii) VIC assumes that all radiation reflected by the ground surface is lost through the top of the canopy, i.e., VIC does not include the second term in equation (5), which can be quite important when the ground surface is covered by snow.
The approach described above assumes all radiation is from a single direct beam and ignores the effects of scattering and multiple reflections. Nijssen and Lettenmaier [1999] showed that the penetration of diffuse radiation, $\tau_{pd}$, can be obtained by integrating over the upper hemisphere, as
where ${Q_{swd}^{0}}({\theta}_{zen})$ is the above-canopy diffuse-beam radiation from the direction ${\theta}_{zen}$, and $\tau_{pb} ({\theta}_{zen})$ is the direct beam transmissivity from the direction ${\theta}_{zen}$ as defined in equation (16).
Assuming diffuse radiation is isotropic, a solution to equation (20) is [Nijssen and Lettenmaier, 1999; Mahat and Tarboton, 2012]
where $E_{i}(n,x) $ is the exponential integral, and recall that $V_{ex}={\eta_{l} D_{can}}$ defines the total exposed leaf+stem area (${m}^{2}{m}^{-2}$), that is, the leaf+stem area that is not buried by snow. The total penetration of radiation through the canopy is then
where $\tau_{pb} $ is given by the solution to Beer’s law in equation (3).
Nijssen and Lettenmaier [1999] introduce a simple method to account for scattering and multiple reflections, providing total transmission $\tau$ as
where the exponent ${\varnothing_{s}}$ accounts for scattering of radiation within the vegetation canopy. The value of ${\varnothing_{s}}$ should generally fall in the range 0.7 to 0.85, and ${\varnothing_{s}}$ = 0.81 in the simulations presented by Nijssen and Lettenmaier [1999].
Given equation (10) and the assumption that all shortwave radiation reflected by the ground surface is diffuse, the shortwave radiation flux absorbed by the vegetation canopy and the ground surface can be given as
where the terms on the right-hand-side of equation (11) describe the downward and upward radiation absorbed by the vegetation canopy, respectively, and $m_{r}$ accounts for multiple reflections between the ground and canopy.
Note that equation (11) assumes that all reflected radiation is diffuse, and reflection of upward radiation from the canopy is incorporated in the calculation of $\tau$ in equation (10) through the multiple reflection factor $m_{r}$.
The multiple reflection factor $m_{r}$ is derived from the infinite series of reflections between the surface and vegetation [Nijssen and Lettenmaier, 1999] as
with the factor $(1-(\tau_{pd})^{\varnothing_{s}})$ included to represent the fraction of radiation transmitted and scattered upwards through the canopy [see also Mahat and Tarboton, 2012].
Mahat and Tarboton [2012] describe a two stream radiative transfer model based on the assumptions that radiation is scattered equally in an upward and downward direction and that scattering is along the same path as the incoming radiation. These assumptions yield
where $\alpha_{leaf}$ (-) is the leaf scattering coefficient, distinguished from the bulk canopy albedo used in equation (5) and (11), and $U_{sw}$ and $Q_{sw}$ $(W {m}^{-2})$ are the intensity of the upward and downward beams. The solution for transmission over an infinitely deep canopy is [Mahat and Tarboton, 2012]
where $ k^{'} = \sqrt{1-\alpha_{leaf}} $ Equations (16) and (17) are similar to the expressions in equations (3) and (8), except the factor $ k^{'}$ is included to account for the effects of multiple scattering. Recall that $V_{ex}={\eta_{l}}D_{can}$.
The upward reflection factor $\alpha_{deep}^{veg} $ giving the fraction of radiation reflected from a deep canopy with multiple scattering is
Mahat and Tarboton [2012] use the principle of superposition to derive solutions for a finite canopy, as
where $\tau_{b}$ and $\alpha_{b}^{veg}$ define the transmittance and reflectance for direct-beam radiation. Equations (19) and (20) can also be used to obtain $\tau_{d}$ and $\alpha_{d}^{veg}$ by replacing the direct transmittance $\tau_{deep,b}$ with the diffuse transmittance $\tau_{deep,d}$ [Mahat and Tarboton, 2012].
The shortwave radiation flux absorbed by the vegetation canopy and the ground surface can now be given as (now distinguishing between direct and diffuse surface albedo, $\alpha_{b}^{sfc}$ and $\alpha_{d}^{sfc}$, as defined in the next section),
where $m_{r}$ is the multiple reflections factor as defined in equation (13) but computed using diffuse reflectances and defined as $m_{r} = [1-\alpha_{d}^{veg}\alpha_{d}^{sfc}(1-\tau_{d})]^{-1}$ . As in equation (11) it is assumed that all upward radiation is diffuse.
We also consider the two-stream radiative transfer model of Dickinson [1983] and Sellers [1985], as implemented in both the Community Land Model [Oleson et al., 2010] and the Noah-MP model [Niu et al., 2011]. In this approach fluxes are computed separately for visible and near-infra-red wavelengths. Complete algorithmic details are provided by Oleson et al. [2010] and are not repeated here.
The above description are taken from the Stomal Resistance Method section within the manual Structure for Unifying Multiple Modeling Alternatives (SUMMA), Version 1.0: Technical Description (April, 2015).
# User have to use "pysumma" Jupyter kernel, if you install pysumma conda virtual environment
import sys
!{sys.executable} -m pip install git+https://github.com/UW-Hydro/pysumma.git@master --upgrade
from pysumma import hydroshare_utils
import os
# Download SUMMA Model Instance from HydroShare
resource_id = '67d3a9d949cb4269b951f1c17cb751dc'
instance = hydroshare_utils.get_hs_resource(resource_id, os.getcwd())
!cd {instance}/; chmod +x ./installTestCases_local.sh
!cd {instance}/; ./installTestCases_local.sh
%pylab inline
import cartopy
import geoviews as gv
import holoviews as hv
hv.notebook_extension('bokeh')
shapefile = os.path.join(os.getcwd(), instance, "data/gis/Reynolds_Creek_watershed_wgs84.shp")
shapes = cartopy.io.shapereader.Reader(shapefile)
(gv.tile_sources.StamenTerrainRetina
* gv.Shape.from_shapefile(shapefile, crs=cartopy.crs.PlateCarree(), value="LABLE", index="value").opts(
style=dict(fill_color='honeydew', line_color='navy', alpha=0.5, cmap='Reds'))
).opts(width=900, height=500)
import pysumma as ps
instance = "SummaModel_ReynoldsAspenStand_ShortwaveRadiation"
executable = '/usr/local/bin/summa.exe'
executable
# path to the SUMMA filemanager file
file_manager = os.path.join(os.getcwd(), instance, 'settings/summa_fileManager_riparianAspenBeersLaw.txt')
file_manager
# Create pySUMMA Simulation Object
S_BeersLaw = ps.Simulation(executable, file_manager)
# set the simulation start and finish times
S_BeersLaw.manager['simStartTime'].value, S_BeersLaw.manager['simEndTime'].value
# query for the available canopy shortwave radiation parameterizations
S_BeersLaw.decisions["canopySrad"].available_options
S_BeersLaw.decisions['canopySrad'] = 'BeersLaw'
S_BeersLaw.manager.write()
S_BeersLaw.decisions['canopySrad'].value
S_BeersLaw.run('local', run_suffix='_BeersLaw')
results_BeersLaw_ncfile = S_BeersLaw.get_output_files()
# Create pySUMMA Simulation Object
S_NL_scatter = ps.Simulation(executable, file_manager)
S_NL_scatter.decisions['canopySrad'] = 'NL_scatter'
S_NL_scatter.manager.write()
S_NL_scatter.decisions['canopySrad'].value
S_NL_scatter.run('local', run_suffix='_NL_scatter')
results_NL_scatter_ncfile = S_NL_scatter.get_output_files()
S_NL_scatter.decisions['canopySrad'] = 'UEB_2stream'
S_NL_scatter.manager.write()
S_NL_scatter.decisions['canopySrad'].value
S_NL_scatter.run('local', run_suffix='_UEB_2stream')
results_UEB_2stream_ncfile = S_NL_scatter.get_output_files()
# Create pySUMMA Simulation Object
S_CLM_2stream = ps.Simulation(executable, file_manager)
S_CLM_2stream.decisions['canopySrad'] = 'CLM_2stream'
S_CLM_2stream.manager.write()
S_CLM_2stream.decisions['canopySrad'].value
S_CLM_2stream.run('local', run_suffix='_CLM_2stream')
results_CLM_2stream_ncfile = S_CLM_2stream.get_output_files()
from pysumma.plotting.plotting import Plotting
import matplotlib.pyplot as plt
import pandas as pd
import xarray as xr
# get output netCDF and resample data by the average for hour of day
def calc_short_radiation(rad_output_df, start_time, end_time):
# get 'solar radiation transmitted below the canopy' data from output netCDF, unit : Wm-2
short_radiation_data = rad_output_df['scalarBelowCanopySolar']
# create dates(X-axis) attribute from ouput netcdf
dates = short_radiation_data.coords['time'].data
# create data value(Y-axis) attribute from ouput netcdf
data_values = short_radiation_data.data
# create two dimensional tabular data structure
short_radiation_df = pd.DataFrame(data_values, index=dates)
# round time to nearest hour (ex. 2006-10-01T00:59:59.99 -> 2006-10-01T01:00:00)
short_radiation_df.index = short_radiation_df.index.round("H")
# set the time period to display plot
short_radiation_df = short_radiation_df.loc[start_time:end_time] #"2006-07-01":"2007-09-30"
# resample data by the average value hourly
short_radiation_df_hourly = short_radiation_df.resample("H").mean()
# resample data by the average for hour of day
short_radiation_by_hour = short_radiation_df_hourly.groupby(short_radiation_df_hourly.index.hour).mean()
return short_radiation_by_hour
results_BeersLaw = xr.open_dataset(results_BeersLaw_ncfile[0])
BeersLaw_hour = calc_short_radiation(results_BeersLaw, "2005-10-01", "2006-09-30")
results_NL_scatter = xr.open_dataset(results_NL_scatter_ncfile[0])
NL_scatter_hour = calc_short_radiation(results_NL_scatter, "2005-10-01", "2006-09-30")
results_UEB_2stream = xr.open_dataset(results_UEB_2stream_ncfile[0])
UEB_2stream_hour = calc_short_radiation(results_UEB_2stream, "2005-10-01", "2006-09-30")
results_CLM_2stream = xr.open_dataset(results_CLM_2stream_ncfile[0])
CLM_2stream_hour = calc_short_radiation(results_CLM_2stream, "2005-10-01", "2006-09-30")
# get forcing netCDF and resample data by the average for hour of day
def calc_forcing(forcing_df, start_time, end_time):
# get 'downward shortwave radiation at the upper boundary' data from forcing netCDF, unit : Wm-2
forcing_data = forcing_df['SWRadAtm']
# create dates(X-axis) attribute from ouput netcdf
dates = forcing_data.coords['time'].data
# create data value(Y-axis) attribute from ouput netcdf
data_values = forcing_data.data
# create two dimensional tabular data structure
total_forcing_df = pd.DataFrame(data_values, index=dates)
# round time to nearest hour (ex. 2006-10-01T00:59:59.99 -> 2006-10-01T01:00:00)
total_forcing_df.index = total_forcing_df.index.round("H")
# set the time period to display plot
total_forcing_df = total_forcing_df.loc[start_time:end_time]
# resample data by the average value hourly
total_forcing_df_hourly = total_forcing_df.resample("H").mean()
# resample data by the average for hour of day
total_forcing_by_hour = total_forcing_df_hourly.groupby(total_forcing_df_hourly.index.hour).mean()
return total_forcing_by_hour
import xarray as xr
forcing_path =file_manager.split('/settings')[0]+'/data/forcingData/forcing_above_aspen.nc'
forcing = xr.open_dataset(forcing_path)
forcing_data = calc_forcing(forcing, "2005-10-01", "2006-09-30")
# Combine each below canopy shortwave radiation parameterizations
Radiation_Combine = pd.concat([forcing_data, BeersLaw_hour, NL_scatter_hour, UEB_2stream_hour, CLM_2stream_hour], axis=1)
# add label
Radiation_Combine.columns = ["Above canopy forcing", "Beer's law", "NL 1999", "MT 2012", "Dick 1983"]
Radiation_Combine
# create pySUMMA Plotting Object
Val_eddyFlux = Plotting(file_manager.split('/settings')[0]+'/data/validationData/ReynoldsCreek_eddyFlux.nc')
def obs_radiation(Val_eddyFlux, start_time, end_time):
# read upward solar radiation from CNR 1(rsd) from validation netcdf file
Obs_radiation = Val_eddyFlux.ds['rsd']
# create dates(X-axis) attribute from validation netcdf file
dates = Obs_radiation.coords['time'].data
data_values = Obs_radiation.data
# create two dimensional tabular data structure
df = pd.DataFrame(data_values, index=dates)
# set the time period to display plot
df_filt = df.loc[start_time:end_time]
# select aspen obervation station among three different stations
df_filt.columns = ['Observation (aspen)','-','-']
# resample data by the average for hour of day
df_gp_hr = df_filt.groupby([df_filt.index.hour, df_filt.index.minute]).mean()
# reset index so each row has an hour an minute column
df_gp_hr.reset_index(inplace=True)
# add hour and minute columns for plotting
xvals = df_gp_hr.reset_index()['level_0'] + df_gp_hr.reset_index()['level_1']/60.
return xvals, df_gp_hr
xvals, df_gp_hr = obs_radiation(Val_eddyFlux, "2005-10-01", "2006-09-30")
# create plot with four different below canopy shortwave radiation parameterizations
Radiation_Combine_Graph = Radiation_Combine.plot(legend=False,figsize=(10,10),color=['black','blue', 'green', 'orange', 'red'])
#fig = plt.figure(figsize=(10,10),linewidth=4.0)
Radiation_Combine_Graph.plot(Radiation_Combine['Above canopy forcing'], color='black', linewidth=3.0)
Radiation_Combine_Graph.plot(Radiation_Combine["Beer's law"],color='blue', linewidth=3.0)
Radiation_Combine_Graph.plot(Radiation_Combine['NL 1999'], color='green', linewidth=3.0)
Radiation_Combine_Graph.plot(Radiation_Combine['MT 2012'], color='orange', linewidth=3.0)
Radiation_Combine_Graph.plot(Radiation_Combine['Dick 1983'], color='red', linewidth=3.0)
Radiation_Combine_Graph.tick_params(labelsize = 15)
# plot scatter with x='xvals', y='Observation (aspen)'
d = Radiation_Combine_Graph.scatter(xvals, df_gp_hr['Observation (aspen)'], color='black', s=200, label="Observations")
# add x, y label
Radiation_Combine_Graph.set_xlabel("Time of day (hr)", fontsize=18)
Radiation_Combine_Graph.set_ylabel("below canopy shortwave radiation (W/m2)", fontsize=18)
handles, labels = Radiation_Combine_Graph.get_legend_handles_labels()
# show up the legend
Radiation_Combine_Graph.legend(handles[0:6], labels[0:6], fontsize=20, loc=2)
plt.xlim(0,24)
plt.ylim(0,1000)
x = [0,3,6,9,12,15,18,21,24]
plt.xticks(x, x, fontsize=20)
plt.yticks(fontsize=20)
BeersLaw_hour = calc_short_radiation(results_BeersLaw, "2006-10-01", "2007-09-30")
NL_scatter_hour = calc_short_radiation(results_NL_scatter, "2006-10-01", "2007-09-30")
UEB_2stream_hour = calc_short_radiation(results_UEB_2stream, "2006-10-01", "2007-09-30")
CLM_2stream_hour = calc_short_radiation(results_CLM_2stream, "2006-10-01", "2007-09-30")
forcing_data = calc_forcing(forcing, "2006-10-01", "2007-09-30")
# Combine each below canopy shortwave radiation parameterizations
Radiation_Combine = pd.concat([forcing_data, BeersLaw_hour, NL_scatter_hour, UEB_2stream_hour, CLM_2stream_hour], axis=1)
# add label
Radiation_Combine.columns = ["Above canopy forcing", "Beer's law", "NL 1999", "MT 2012", "Dick 1983"]
xvals, df_gp_hr = obs_radiation(Val_eddyFlux, "2006-10-01", "2007-09-30")
# create plot with four different below canopy shortwave radiation parameterizations
Radiation_Combine_Graph = Radiation_Combine.plot(legend=False,figsize=(10,10),color=['black','blue', 'green', 'orange', 'red'])
Radiation_Combine_Graph.plot(Radiation_Combine['Above canopy forcing'], color='black', linewidth=3.0)
Radiation_Combine_Graph.plot(Radiation_Combine["Beer's law"],color='blue', linewidth=3.0)
Radiation_Combine_Graph.plot(Radiation_Combine['NL 1999'], color='green', linewidth=3.0)
Radiation_Combine_Graph.plot(Radiation_Combine['MT 2012'], color='orange', linewidth=3.0)
Radiation_Combine_Graph.plot(Radiation_Combine['Dick 1983'], color='red', linewidth=3.0)
Radiation_Combine_Graph.tick_params(labelsize = 15)
# plot scatter with x='xvals', y='Observation (aspen)'
d = Radiation_Combine_Graph.scatter(xvals, df_gp_hr['Observation (aspen)'], color='black', s=200, label="Observations")
# add x, y label
Radiation_Combine_Graph.set_xlabel("Time of day (hr)", fontsize=18)
Radiation_Combine_Graph.set_ylabel("below canopy shortwave radiation (Wm-2)", fontsize=18)
handles, labels = Radiation_Combine_Graph.get_legend_handles_labels()
# show up the legend
Radiation_Combine_Graph.legend(handles[0:6], labels[0:6], fontsize=20, loc=2)
plt.xlim(0,24)
plt.ylim(0,1000)
x = [0,3,6,9,12,15,18,21,24]
plt.xticks(x, x, fontsize=20)
plt.yticks(fontsize=20)
BeersLaw_hour = calc_short_radiation(results_BeersLaw, "2007-10-01", "2008-09-30")
NL_scatter_hour = calc_short_radiation(results_NL_scatter, "2007-10-01", "2008-09-30")
UEB_2stream_hour = calc_short_radiation(results_UEB_2stream, "2007-10-01", "2008-09-30")
CLM_2stream_hour = calc_short_radiation(results_CLM_2stream, "2007-10-01", "2008-09-30")
forcing_data = calc_forcing(forcing, "2007-10-01", "2008-09-30")
# Combine each below canopy shortwave radiation parameterizations
Radiation_Combine = pd.concat([forcing_data, BeersLaw_hour, NL_scatter_hour, UEB_2stream_hour, CLM_2stream_hour], axis=1)
# add label
Radiation_Combine.columns = ["Above canopy forcing", "Beer's law", "NL 1999", "MT 2012", "Dick 1983"]
xvals, df_gp_hr = obs_radiation(Val_eddyFlux, "2007-10-01", "2008-09-30")
# create plot with four different below canopy shortwave radiation parameterizations
Radiation_Combine_Graph = Radiation_Combine.plot(legend=False,figsize=(10,10),color=['black','blue', 'green', 'orange', 'red'])
Radiation_Combine_Graph.plot(Radiation_Combine['Above canopy forcing'], color='black', linewidth=3.0)
Radiation_Combine_Graph.plot(Radiation_Combine["Beer's law"],color='blue', linewidth=3.0)
Radiation_Combine_Graph.plot(Radiation_Combine['NL 1999'], color='green', linewidth=3.0)
Radiation_Combine_Graph.plot(Radiation_Combine['MT 2012'], color='orange', linewidth=3.0)
Radiation_Combine_Graph.plot(Radiation_Combine['Dick 1983'], color='red', linewidth=3.0)
Radiation_Combine_Graph.tick_params(labelsize = 15)
# plot scatter with x='xvals', y='Observation (aspen)'
d = Radiation_Combine_Graph.scatter(xvals, df_gp_hr['Observation (aspen)'], color='black', s=200, label="Observations")
# add x, y label
Radiation_Combine_Graph.set_xlabel("Time of day (hr)", fontsize=18)
Radiation_Combine_Graph.set_ylabel("below canopy shortwave radiation (Wm-2)", fontsize=18)
handles, labels = Radiation_Combine_Graph.get_legend_handles_labels()
# show up the legend
Radiation_Combine_Graph.legend(handles[0:6], labels[0:6], fontsize=20, loc=2)
plt.xlim(0,24)
plt.ylim(0,1000)
x = [0,3,6,9,12,15,18,21,24]
plt.xticks(x, x, fontsize=20)
plt.yticks(fontsize=20)
As stated in Clark et al., 2015, the following insights can be gained from this analysis:
from pysumma.hydroshare import hydroshare
hs = hydroshare.hydroshare()
# zip a renewal SUMMA Model Instance to upload on HydroShare
import shutil, os
archive_name = os.path.expanduser(os.path.join('~', os.getcwd() +'/' + instance +'_new'))
root_dir = os.path.expanduser(os.path.join('~', os.getcwd() +'/' + instance))
shutil.make_archive(archive_name, 'zip', root_dir)
Model_instance = os.getcwd() +'/' + instance +'_new.zip'
# set meta data such as abstract, title, keywords, rtype to create a new SUMMA Model Instance
title = 'Sensitivity to Below Canopy Shortwave Radiation Parameterization of SUMMA Model in Aspen stand at Reynolds Mountain East_new'
abstract = 'Sensitivity to Below Canopy Shortwave Radiation Parameterization of SUMMA Model in Aspen stand at Reynolds Mountain East(new)'
keywords = ('SUMMA', 'Hydrologic Model', 'Reynolds Mountain East', 'Below Canopy Shortwave Radiation Parameterization')
rtype = 'ModelInstanceResource'
fpath = Model_instance,
metadata = '[{"creator":{"name":"Youngdon Choi"}}, {"creator":{"name":"Jeffrey Sadler"}}]'
extra_metadata = '{"key-1": "value-1", "key-2": "value-2"}'
# create a new SUMMA Model Instance on HydroShare
resource_id1 = hs.createHydroShareResource(title=title, content_files=fpath, keywords=keywords, abstract=abstract, resource_type='modelinstanceresource', public=False)
# set meta data such as abstract, title, keywords, rtype to create a SUMMA Composite Resource that contains SUMMA Model instance, output, and notebook.
title = 'Sensitivity to Below Canopy Shortwave Radiation Parameterization of SUMMA Model in Aspen stand at Reynolds Mountain East_new'
abstract = 'Sensitivity to Below Canopy Shortwave Radiation Parameterization of SUMMA Model in Aspen stand at Reynolds Mountain East(new)'
keywords = ('SUMMA', 'Hydrologic Model', 'Reynolds Mountain East', 'Below Canopy Shortwave Radiation Parameterization')
rtype = 'CompositeResource'
files = out_file1, out_file2, out_file3, out_file4
metadata = '[{"creator":{"name":"Youngdon Choi"}}, {"creator":{"name":"Jeffrey Sadler"}}]'
extra_metadata = '{"key-1": "value-1", "key-2": "value-2"}'
# create a new SUMMA Composite Resource on HydroShare
resource_id2 = hs.createHydroShareResource(title=title, content_files=files, keywords=keywords, abstract=abstract, resource_type='compositeresource', public=False)
# add a new SUMMA Model Instance to a new SUMMA Composite Resource.
hs.addContentToExistingResource(resource_id2, [Model_instance])
# add a new notebook to a new SUMMA Composite Resource.
npath = os.getcwd() +'/SummaModel_ReynoldsAspenStand_ShortwaveRadiation_Figure1_Above.ipynb'
# check the resource id on HS that created.
hs.addContentToExistingResource(resource_id2, [npath])