[Greater-commits] r3757 - branches/3.0.0-usf/GREAT-ERModel/GreaterModel/Worker
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Jul 29 19:49:13 CEST 2011
Author: aheinecke
Date: 2011-07-29 19:49:12 +0200 (Fri, 29 Jul 2011)
New Revision: 3757
Modified:
branches/3.0.0-usf/GREAT-ERModel/GreaterModel/Worker/rivermodels.py
Log:
Do not use RCR_RIVERMODEL if the parameter is not available
Modified: branches/3.0.0-usf/GREAT-ERModel/GreaterModel/Worker/rivermodels.py
===================================================================
--- branches/3.0.0-usf/GREAT-ERModel/GreaterModel/Worker/rivermodels.py 2011-07-29 17:48:37 UTC (rev 3756)
+++ branches/3.0.0-usf/GREAT-ERModel/GreaterModel/Worker/rivermodels.py 2011-07-29 17:49:12 UTC (rev 3757)
@@ -168,23 +168,25 @@
self.use_baseflow = 0
# risk characterization ratio analysis
- if data['MOD']['RCR_ANALYSIS'].value == 'Y':
- self.rcr_analysis = 1
- bioavailability = eval_parameter( data,
- ('MOD', 'BIOAVAILABILITY','value') )
- self.bioavailability = Parameter(('MOD', 'BIOAVAILABILITY'),
- bioavailability,
- eval_local_stochastics(0, self.st_params),
- data['STOCHASTICS'])
- pnec = eval_parameter( data,
- ('MOD', 'PNEC', 'value') )
- self.pnec = Parameter(('MOD', 'PNEC'),
- pnec,
- eval_local_stochastics(0, self.st_params),
- data['STOCHASTICS'])
- else:
+ try:
+ if data['MOD']['RCR_ANALYSIS'].value == 'Y':
+ self.rcr_analysis = 1
+ bioavailability = eval_parameter( data,
+ ('MOD', 'BIOAVAILABILITY','value') )
+ self.bioavailability = Parameter(('MOD', 'BIOAVAILABILITY'),
+ bioavailability,
+ eval_local_stochastics(0, self.st_params),
+ data['STOCHASTICS'])
+ pnec = eval_parameter( data,
+ ('MOD', 'PNEC', 'value') )
+ self.pnec = Parameter(('MOD', 'PNEC'),
+ pnec,
+ eval_local_stochastics(0, self.st_params),
+ data['STOCHASTICS'])
+ else:
+ self.rcr_analysis = 0
+ except KeyError:
self.rcr_analysis = 0
-
def compute( self, segment, shot_num ):
"""Compute GREAT-ER River Model Mode 1 for segment."""
@@ -601,23 +603,29 @@
self.use_baseflow = 0
# risk characterization ratio analysis
- if data['MOD']['RCR_ANALYSIS'].value == 'Y':
- self.rcr_analysis = 1
- bioavailability = eval_parameter( data,
- ('MOD', 'BIOAVAILABILITY','value') )
- self.bioavailability = Parameter(('MOD', 'BIOAVAILABILITY'),
- bioavailability,
- eval_local_stochastics(0, self.st_params),
- data['STOCHASTICS'])
- pnec = eval_parameter( data,
- ('MOD', 'PNEC', 'value') )
- self.pnec = Parameter(('MOD', 'PNEC'),
- pnec,
- eval_local_stochastics(0, self.st_params),
- data['STOCHASTICS'])
- else:
+ try:
+ if data['MOD']['RCR_ANALYSIS'].value == 'Y':
+ self.rcr_analysis = 1
+ bioavailability = eval_parameter( data,
+ ('MOD', 'BIOAVAILABILITY','value') )
+ self.bioavailability = Parameter(('MOD', 'BIOAVAILABILITY'),
+ bioavailability,
+ eval_local_stochastics(0, self.st_params),
+ data['STOCHASTICS'])
+ pnec = eval_parameter( data,
+ ('MOD', 'PNEC', 'value') )
+ self.pnec = Parameter(('MOD', 'PNEC'),
+ pnec,
+ eval_local_stochastics(0, self.st_params),
+ data['STOCHASTICS'])
+ else:
+ self.rcr_analysis = 0
+ except KeyError:
+ # if we do not even have the parameters required do not use
+ # this
self.rcr_analysis = 0
+
def compute( self, segment, shot_num ):
"""Compute GREAT-ER River Model Mode 2 for segment."""
@@ -1131,21 +1139,24 @@
self.use_baseflow = 0
# risk characterization ratio analysis
- if data['MOD']['RCR_ANALYSIS'].value == 'Y':
- self.rcr_analysis = 1
- bioavailability = eval_parameter( data,
- ('MOD', 'BIOAVAILABILITY','value') )
- self.bioavailability = Parameter(('MOD', 'BIOAVAILABILITY'),
- bioavailability,
- eval_local_stochastics(0, self.st_params),
- data['STOCHASTICS'])
- pnec = eval_parameter( data,
- ('MOD', 'PNEC', 'value') )
- self.pnec = Parameter(('MOD', 'PNEC'),
- pnec,
- eval_local_stochastics(0, self.st_params),
- data['STOCHASTICS'])
- else:
+ try:
+ if data['MOD']['RCR_ANALYSIS'].value == 'Y':
+ self.rcr_analysis = 1
+ bioavailability = eval_parameter( data,
+ ('MOD', 'BIOAVAILABILITY','value') )
+ self.bioavailability = Parameter(('MOD', 'BIOAVAILABILITY'),
+ bioavailability,
+ eval_local_stochastics(0, self.st_params),
+ data['STOCHASTICS'])
+ pnec = eval_parameter( data,
+ ('MOD', 'PNEC', 'value') )
+ self.pnec = Parameter(('MOD', 'PNEC'),
+ pnec,
+ eval_local_stochastics(0, self.st_params),
+ data['STOCHASTICS'])
+ else:
+ self.rcr_analysis = 0
+ except KeyError:
self.rcr_analysis = 0
def compute( self, segment, shot_num ):
More information about the Greater-commits
mailing list