1import datetime
2
3
4def iso_time(t):
5 if t is not None:
6 return t.replace(
7 tzinfo=datetime.timezone.utc
8 ).isoformat(
9 timespec='milliseconds'
10 ).replace('+00:00', 'Z')
11 else:
12 return None
13
14
15def plot_to_iso(data, index):
16 newdata = []
17 for sample in data:
18 if sample[1] is not None:
19 if sample[index] is not None:
20 sample = [iso_time(sample[0]), sample[index]]
21 newdata.append(sample)
22 return newdata
23
24def get_sid_domain_name(dp):
25 name = "N/A"
26
27 try:
28 name = dp.sid.as_dict()['title']
29 except AttributeError:
30 name = dp.sid.name if dp.sid and dp.sid.name is not None else "N/A"
31
32 return name