This notebook contains material from Controlling Natural Watersheds; content is available on Github.
The purpose of this notebook is to analyze the role of rule curves in establishing the 'surge capacity' of the Namakan Reservior / Rainy Lake system, and in modifying the outflow of Rainy Lake to Rainy River.
# Display graphics inline with the notebook
%matplotlib notebook
# Standard Python modules
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import os
import datetime
# Modules to display images and data tables
from IPython.display import Image
from IPython.core.display import display
# Directories
dir = '../data/'
img = '../images/'
NL1970 = pd.read_pickle(dir+'NL1970.pkl')
RL1970 = pd.read_pickle(dir+'RL1970.pkl')
NL2000 = pd.read_pickle(dir+'NL2000.pkl')
RL2000 = pd.read_pickle(dir+'RL2000.pkl')
The seasonal change is lake levels modify the outflow of water into Rainy River. During periods of rising levels, the flow into Rainy River is reduced by an amount equal to the rate of change in water volume of Namakan and Rainy Lakes. Flow into Rainy River is increased during periods of falling lake levels.
The following calculations estimate how much the flow into Rainy River is increased or decreased assuming the lake levels are managed to the midpoints of the rule curves.
Area of the Namakan Reservoir (Kabetogama, Namakan, Sand, Crane, Little Vermillion) (From Cohen and Radomski, 1993)
# area is sq. meters
areaNL = 25973 * 10000
Area of Rainy Lake (From IJC Rainy River Modeling Phase II, 2011)
# area is sq. meters
areaRL = 95770 * 10000
aRL1970 = 90.73 * 0.5*(RL1970['LRC']+RL1970['URC']) - 2.975e+04
aRL2000 = 90.73 * 0.5*(RL2000['LRC']+RL2000['URC']) - 2.975e+04
aNL1970 = 20.29 * 0.5*(NL1970['LRC']+NL1970['URC']) - 6653.0
aNL2000 = 20.29 * 0.5*(NL2000['LRC']+NL2000['URC']) - 6653.0
areaRL
aRL2000.head()
2014-01-01 855.497250 2014-01-02 855.018397 2014-01-03 854.539544 2014-01-04 854.060692 2014-01-05 853.581839 Freq: D, dtype: float64
Rate of lake level changes assuming levels are managed to the mid-point of the rule curves.
dNL1970 = 0.5*(NL1970['LRC']+NL1970['URC']).diff()
dRL1970 = 0.5*(RL1970['LRC']+RL1970['URC']).diff()
dNL2000 = 0.5*(NL2000['LRC']+NL2000['URC']).diff()
dRL2000 = 0.5*(RL2000['LRC']+RL2000['URC']).diff()
Compute rate of change of volume assuming constant areas each lake. The rates of change are calculated in units of cubic meters per second to be comparable to reported river flows.
qNL1970 = -aNL1970*dNL1970*1.0e6/(24*3600)
qRL1970 = -aRL1970*dRL1970*1.0e6/(24*3600)
qNL2000 = -aNL2000*dNL2000*1.0e6/(24*3600)
qRL2000 = -aRL2000*dRL2000*1.0e6/(24*3600)
q1970 = qNL1970 + qRL1970
q2000 = qNL2000 + qRL2000
Create plots showing changes in flow to Rainy River due to changes in lake levels.
plt.figure(figsize=(10,7))
ylim = [-300, 150]
plt.subplot(3,1,1)
plt.hold(True)
qNL1970.plot(color='y',alpha=0.75)
qNL2000.plot(color='b',alpha=0.4)
plt.fill_between(qNL1970.index,0,qNL1970.tolist(),color='y', alpha='0.75')
plt.fill_between(qNL2000.index,0,qNL2000.tolist(),color='b', alpha='0.4')
plt.legend(['1970 Rule Curve'],loc='upper right')
plt.hold(False)
plt.ylim(ylim)
plt.ylabel('[cubic meters/sec]')
plt.title('Effect on Outflow to Rainy River due to ' + \
'Changes in Namakan Lake Level')
plt.legend(['1970 Rule Curves','2000 Rule Curves'],loc='lower right')
plt.subplot(3,1,2)
plt.hold(True)
qRL1970.plot(color='y',alpha=0.75)
qRL2000.plot(color='b',alpha=0.6)
plt.fill_between(qRL1970.index,0,qRL1970.tolist(),color='y', alpha='0.75')
plt.fill_between(qRL2000.index,0,qRL2000.tolist(),color='b', alpha='0.4')
plt.hold(False)
plt.ylim(ylim)
plt.ylabel('[cubic meters/sec]')
plt.title('Effect on Outflow to Rainy River due to ' + \
'Changes in Rainy Lake Level')
plt.legend(['1970 Rule Curves','2000 Rule Curves'],loc='lower right')
plt.subplot(3,1,3)
plt.hold(True)
q1970.plot(color='y',alpha=0.75)
q2000.plot(color='b',alpha=0.4)
plt.fill_between(q1970.index,0,q1970.tolist(),color='y', alpha='0.75')
plt.fill_between(q2000.index,0, q2000.tolist(), color='b', alpha='0.4')
plt.hold(False)
plt.ylim(ylim)
plt.ylabel('[cubic meters/sec]')
plt.title('Effect on Outflow to Rainy River due to ' + \
'Combined Changes in Lake Levels')
plt.legend(['1970 Rule Curves','2000 Rule Curves'],loc='lower right')
plt.tight_layout()
dqNL = qNL2000 - qNL1970
dq = q2000 - q1970
plt.figure(figsize=(12,6))
plt.subplot(2,1,1)
plt.fill_between(dqNL.index,0, dqNL.tolist(), color='b', alpha='0.4')
plt.ylabel('[cubic meters/sec]')
plt.title('Imputed Change in Flows to Rainy River due to 2000 Rule Curve Change on Namakan Lake')
plt.ylim([-60,120])
plt.subplot(2,1,2)
plt.fill_between(dq.index,0, dq.tolist(), color='b', alpha='0.4')
plt.ylabel('[cubic meters/sec]')
plt.title('Imputed Change in Flows to Rainy Rainy due to 2000 Rule Curve Change on Namakan and Rainy Lakes')
plt.ylim([-60,120])
plt.tight_layout()
fname = img + 'ImputedChangeInFlows.png'
plt.savefig(fname)
!convert $fname -trim $fname
!convert $fname -transparent white $fname
# Plot 1970 Rule Curves
plt.figure(figsize=(10,8))
plt.subplot2grid((3,1),(0, 0), rowspan = 2)
plt.fill_between(NL1970.index,
NL1970['LRC'].tolist(),
NL1970['URC'].tolist(),
color='y', alpha='0.5')
plt.fill_between(RL1970.index,
RL1970['LRC'].tolist(),
RL1970['URC'].tolist(),
color='g', alpha='0.5')
plt.ylabel('Lake Level [meters]')
plt.title('Rule Curves for Namakan and Rainy Lakes: 1970-2000')
plt.tight_layout()
plt.hold('True')
plt.plot(NL2000.index,NL2000['ELW'],color='b',alpha=0.5)
plt.plot(NL2000.index,NL2000['EDL'],color='b',alpha=0.5)
plt.plot(NL2000.index,NL2000['EHW'],color='b',alpha=0.5)
plt.plot(NL2000.index,NL2000['AGO'],color='b',alpha=0.5)
plt.plot(RL2000.index,RL2000['ELW'],color='r',alpha=0.5)
plt.plot(RL2000.index,RL2000['EDL'],color='r',alpha=0.5)
plt.plot(RL2000.index,RL2000['EHW'],color='r',alpha=0.5)
plt.plot(RL2000.index,RL2000['AGO'],color='r',alpha=0.5)
plt.fill_between(NL2000.index,
NL2000['LRC'].tolist(),
NL2000['URC'].tolist(),
color='b', alpha='0.5')
plt.fill_between(RL2000.index,
RL2000['LRC'].tolist(),
RL2000['URC'].tolist(),
color='r', alpha='0.5')
plt.hold('False')
plt.ylim(336,341.5)
plt.ylabel('Lake Level [meters]')
plt.title('Comparison of 1970 and 2000 Rule Curves')
import matplotlib.patches as mpatches
gold_patch = mpatches.Patch(color='y', alpha = 0.5, label='Namakan 1970')
blue_patch = mpatches.Patch(color='b', alpha = 0.5, label='Namakan 2000')
green_patch = mpatches.Patch(color='g', alpha = 0.5, label='Rainy 1970')
red_patch = mpatches.Patch(color='r', alpha = 0.5, label='Rainy 2000')
nlegend = plt.legend(handles=[gold_patch,blue_patch],bbox_to_anchor=[1.0,0.55])
plt.gca().add_artist(nlegend)
plt.legend(handles=[green_patch,red_patch],loc=4)
import matplotlib.dates as mdates
plt.gca().xaxis.set_major_locator(mdates.MonthLocator())
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%b'))
plt.subplot(3,1,3)
plt.fill_between(dq.index,0, dq.tolist(), color='b', alpha='0.4')
plt.ylabel('[cubic meters/sec]')
plt.title('Imputed Change in Flows to Rainy Rainy')
plt.ylim([-60,120])
plt.grid()
plt.gca().xaxis.set_major_locator(mdates.MonthLocator())
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%b'))
plt.tight_layout()
fname = img + 'RuleCurveComparisonFlows.png'
plt.savefig(fname)
!convert $fname -trim $fname