[Greater-commits] r3697 - in branches/3.0.0-all-models/GREAT-ERModel: . GreaterModel/Worker
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Jul 26 12:41:38 CEST 2011
Author: aheinecke
Date: 2011-07-26 12:41:37 +0200 (Tue, 26 Jul 2011)
New Revision: 3697
Modified:
branches/3.0.0-all-models/GREAT-ERModel/
branches/3.0.0-all-models/GREAT-ERModel/ChangeLog
branches/3.0.0-all-models/GREAT-ERModel/GreaterModel/Worker/worker.py
Log:
Merged revisions 3602 via svnmerge from
svn+ssh://wald.intevation.org/greater/trunk/GREAT-ERModel
........
r3602 | aheinecke | 2011-07-15 11:03:32 +0200 (Fri, 15 Jul 2011) | 2 lines
Convert Numpy floats to regular python floats for jelling
........
Property changes on: branches/3.0.0-all-models/GREAT-ERModel
___________________________________________________________________
Name: svnmerge-integrated
- /trunk/GREAT-ERModel:1-216,321,3583-3584,3587,3601
+ /trunk/GREAT-ERModel:1-216,321,3583-3584,3587,3601-3602
Modified: branches/3.0.0-all-models/GREAT-ERModel/ChangeLog
===================================================================
--- branches/3.0.0-all-models/GREAT-ERModel/ChangeLog 2011-07-26 10:40:01 UTC (rev 3696)
+++ branches/3.0.0-all-models/GREAT-ERModel/ChangeLog 2011-07-26 10:41:37 UTC (rev 3697)
@@ -4,6 +4,7 @@
Use the default python float type instead of the Numeric Float.
* GreaterModel/Worker/worker.py: Correct Type error by using string representation
of a Tuple.
+ Convert Numpy floats to regular python floats for jelling
2007-06-20 Frank Koormann <frank.koormann at intevation.de>
Modified: branches/3.0.0-all-models/GREAT-ERModel/GreaterModel/Worker/worker.py
===================================================================
--- branches/3.0.0-all-models/GREAT-ERModel/GreaterModel/Worker/worker.py 2011-07-26 10:40:01 UTC (rev 3696)
+++ branches/3.0.0-all-models/GREAT-ERModel/GreaterModel/Worker/worker.py 2011-07-26 10:41:37 UTC (rev 3697)
@@ -16,6 +16,8 @@
from twisted.python.failure import Failure
import sys
+import numpy
+
import session
from calculation import Calculation
@@ -124,10 +126,19 @@
# get_descriptives method to get a tuple representation
# of the instance variables (which can be combined with
# other results for the same segment later)
+ # Some numpy calculations also return numpy floats which
+ # also can not be jellied and have to be converted
result = calculation.get_results()
for seg in result.values():
for key, value in seg.items():
- seg[key] = value.get_raw()
+ raw = value.get_raw()
+ if isinstance(raw, tuple):
+ raw = list(raw)
+ for i, element in enumerate(raw):
+ if isinstance(element, numpy.float64):
+ raw[i] = float(element)
+ raw = tuple(raw)
+ seg[key] = raw
deferred.callback(result)
else:
# An unknown status of the calculation. Return an error to
More information about the Greater-commits
mailing list