diff --git a/seagraph.py b/seagraph.py index ee86a3c..2d4e4ab 100644 --- a/seagraph.py +++ b/seagraph.py @@ -7,6 +7,15 @@ import json import numpy as np class PrettyFloat(float): + """saves bandwidth when converting to JSON + + a lot of numbers originally have a fixed (low) number of decimal digits + as the binary representation is not exact, it might happen, that a + lot of superfluous digits are transmitted: + + str(1/10*3) == '0.30000000000000004' + str(PrettyFloat(1/10*3)) == '0.3' + """ def __repr__(self): return '%.15g' % self @@ -24,6 +33,7 @@ class Scanner(object): self.test_day = test_day def scan(self, variable, timerange, result): + """return value is true when there are aditionnal points after the time range""" start, to, now = get_abs_time(timerange + [0]) old = None t = 0