#
# Build the statistical inflow data and save for later use
#
def initStateVariable(currentVariable, network):
	from hec.heclib.dss import HecDss
	from hec.script     import ResSim
	curRun = network.getRssRun()
	dssFilename = curRun.makeAbsolutePathFromWatershed("shared/ventura.dss")
	p25Pathname   = "//CRAZY MOUNTAIN/FLOW-RES IN-P25//1HOUR//"
	p50Pathname   = "//CRAZY MOUNTAIN/FLOW-RES IN-P50//1HOUR//"
	rtw = curRun.getRunTimeWindow()
	startTime = rtw.getStartTimeString()
	endTime = rtw.getEndTimeString()
	dssFile = HecDss.open(dssFilename)
	dssFile.setTimeWindow(startTime, endTime)
	p25Data = dssFile.get(p25Pathname)
	p50Data = dssFile.get(p50Pathname)
	dssFile.done()
	#
	# Build dictionaries of the statistical inflow values keyed
	# by HecTime minute values
	#
	p25ValueByMinutes = {}
	for i in range(p25Data.numberValues) :
		p25ValueByMinutes[p25Data.times[i]] = p25Data.values[i]
	p50ValueByMinutes = {}
	for i in range(p50Data.numberValues) :
		p50ValueByMinutes[p50Data.times[i]] = p50Data.values[i]
	inflowData = {25 : p25ValueByMinutes, 50 : p50ValueByMinutes}
	#
	# Store the data for use on subsequent iterations
	#
	currentVariable.varPut("p25ValueByMinutes", p25ValueByMinutes)
	currentVariable.varPut("p50ValueByMinutes", p50ValueByMinutes)
	currentVariable.varPut("inflowData", inflowData)
	return True
