add doc strings to SeaGraph.w_* methods

This commit is contained in:
l_samenv
2024-07-11 13:23:20 +02:00
parent 91be383803
commit a4ef3aa4c3

View File

@ -509,6 +509,11 @@ class SeaGraph:
self.lastvalues[var] = (endtime, lastx)
def w_graph(self, variables, time="-1800,0"):
"""get given curves
variables: comma separated list of variables to get
time: comma separated time range (beg,end) values < 1 year are treated as relative to the current time
"""
time = [float(t) for t in time.split(',')]
self.last_t = 0
start, end, now = seagraph.get_abs_time(time + [0])
@ -521,19 +526,24 @@ class SeaGraph:
#self.time[0] = self.time[1]
result = self.scanner.get_message(self.variables, self.time, show_empty=True)
self.strip_future(result)
for var in ('treg.set.reg', 'mf'):
curve = result.get(var,[(0,0)])
print(var, curve[0][0] - now, curve[-1][0] - now, curve)
#for var in ('treg.set.reg', 'mf'):
# curve = result.get(var,[(0,0)])
# print(var, curve[0][0] - now, curve[-1][0] - now, curve)
self.complete_to_end(result, end)
self.time[0] = self.time[1]
# reduction not yet implemented
return dict(type='graph-draw', reduced=False, graph=result)
def w_gettime(self, time):
"""parse time (using server time)
time: comma separated time range (beg,end) values < 1 year are treated as relative to the current time
"""
time = [float(t) for t in time.split(',')]
return dict(type='time', time= seagraph.get_abs_time(time))
def w_getvars(self, time):
"""get the curves available at given time (unix timestamp as string)
"""
time = [float(t) for t in time.split(',')]
scanner = seagraph.VarsScanner(instrument.logger_dir, instrument.test_day)
result = dict(type='var_list')
@ -541,6 +551,7 @@ class SeaGraph:
return result
def w_updategraph(self):
"""update live values""
logging.info("UPD GRAPH %d", self.livemode)
if self.livemode == self.HISTORICAL:
return dict(type='accept-graph', live=False)