Skip to content

Commit

Permalink
Upadate class HBV96 :
Browse files Browse the repository at this point in the history
	- Static dictionaries as parameter setup
	- **argument (argument pass by reference and assigned by hash table)
	- routines.py as Module, serving as core to compute discharge

// 14/07/17 Niko
  • Loading branch information
NikoZHAI committed Jul 14, 2017
1 parent 80f2d30 commit 0285d26
Show file tree
Hide file tree
Showing 3 changed files with 559 additions and 18 deletions.
30 changes: 12 additions & 18 deletions HBV_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# -*- coding: utf-8 -*-
# HBV-96 model class

from pandas import Series, DataFrame
import pandas as pd

class HBV96(object):
"""docstring for HBV96"""
Expand Down Expand Up @@ -75,32 +73,28 @@ class HBV96(object):
1.4] #sfcf

# Initial status
DEF_ST = Series([0.0, #sp: Snow pack
30.0, #sm: Soil moisture
30.0, #uz: Upper zone direct runoff
30.0, #lz: Lower zone direct runoff
0.0], #wc: Water content
index = ['sp',
'sm',
'uz',
'lz',
'wc'])

DEF_ST = { 'sp': 0.0, #sp: Snow pack
'sm': 30.0, #sm: Soil moisture
'uz': 30.0, #uz: Upper zone direct runoff
'lz': 30.0, #lz: Lower zone direct runoff
'wc': 0.0 #wc: Water content
}

# Boundary conditions DataFrame
BOUND = DataFrame({"P_LB": P_LB, "P_UB": P_UB},
index = _ind[:18])
BOUND = {"low": dict(zip(_ind[:18], P_LB)),
"up": dict(zip(_ind[:18], P_UB))}

# Initial flow rate
DEF_q0 = 10.0

# HBV96 model initializer, only parameter enough?
def __init__(self):
self._par = Series(len(self._ind)*[0.0], index = self._ind)
self._par = dict(zip(self._ind, len(self._ind)*[0.0]))

# Render parameter fuction
# Render parameter function
def render_par(self, obj_name, par_name):
return eval('self.'+obj_name+'[par_name]')

# Set parameter function
# Set parameter function, external accessibility for Django
def set_par(self, obj_name, par_name, value):
exec('self.'+obj_name+'[par_name] = value')
Binary file modified HBV_class.pyc
Binary file not shown.
Loading

0 comments on commit 0285d26

Please sign in to comment.