# HG changeset patch # User Nicolas Saunier # Date 1295652475 18000 # Node ID d3e1a7cf337515aeed544885f6411d5a067e5c06 # Parent 930a6282c9a9268591182f5f40d2c2243968e5f6 added functions to get simply the values of indicators (and arccos transform for cosines diff -r 930a6282c9a9 -r d3e1a7cf3375 python/moving.py --- a/python/moving.py Mon Jan 17 16:46:48 2011 -0500 +++ b/python/moving.py Fri Jan 21 18:27:55 2011 -0500 @@ -386,6 +386,7 @@ def __init__(self, name, values, timeInterval=None): self.name = name + self.isCosine = name.find('Cosine') self.values = values self.timeInterval = timeInterval if timeInterval: @@ -418,6 +419,23 @@ else: return self.values.values()[self.iterInstantNum-1] + def getValues(self): + if self.timeInterval: + return self.values + else: + return self.values.values() + + def getAngleValues(self): + '''if the indicator is a function of an angle, + transform it to an angle (eg cos) + (no transformation otherwise)''' + from numpy import arccos + values = self.getValues() + if self.isCosine >= 0: + return [arccos(c) for c in values] + else: + return values + class SeverityIndicator(TemporalIndicator): '''Class for severity indicators field mostSevereIsMax is True