From d237c37456ed8404d26c22eab8f60d2eeb9c86ad Mon Sep 17 00:00:00 2001 From: Marcel Frommelt Date: Mon, 3 May 2021 17:44:39 +0900 Subject: [PATCH] seperate script for ballasting logic --- models/ballasting.py | 54 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 models/ballasting.py diff --git a/models/ballasting.py b/models/ballasting.py new file mode 100644 index 0000000..f231458 --- /dev/null +++ b/models/ballasting.py @@ -0,0 +1,54 @@ +import numpy as np +import astropy.units as unit +from astropy.time import Time + + +ballasttimes = np.array([ + '2016-07-13 07:49:00.000', + '2016-07-13 07:52:00.000', + '2016-07-13 08:05:00.000', + '2016-07-13 08:09:00.000', + '2016-07-13 08:14:00.000', + '2016-07-13 08:18:00.000', + '2016-07-13 08:21:00.000', + '2016-07-14 04:01:00.000', + '2016-07-15 04:02:00.000', + '2016-07-15 05:45:00.000', + '2016-07-16 07:06:00.000', + '2016-07-16 11:40:00.000', + '2016-07-17 06:01:00.000', + '2016-07-17 06:16:00.000', + '2016-07-17 06:34:00.000', + '2016-07-17 10:49:00.000', + '2016-07-17 12:25:00.000', + '2016-07-18 06:23:00.000', + '2016-07-18 06:28:00.000', + '2016-07-18 07:17:00.000', + '2016-07-18 07:22:00.000', + '2016-07-18 07:27:00.000', + '2016-07-18 07:35:00.000', + '2016-07-18 07:38:00.000', + '2016-07-18 07:41:00.000', + '2016-07-18 07:45:00.000', + '2016-07-18 07:51:00.000', + '2016-07-18 07:54:00.000', + '2016-07-18 07:59:00.000', + '2016-07-18 08:04:00.000', + '2016-07-18 08:09:00.000', + '2016-07-18 09:00:00.000', + '2016-07-18 09:01:00.000', + '2016-07-18 09:04:00.000', + '2016-07-18 09:22:00.000', + '2016-07-18 21:41:00.000' +]) + +durations = np.array( + [15, 15, 15, 15, 15, 15, 15, 15, 30, 30, 15, 15, 15, 15, 15, 15, 15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 1000]) + + +def ballasting(utc): + if np.any((Time(ballasttimes) <= Time(utc)) & (Time(utc) <= Time(ballasttimes) + durations * unit.second)): + return True + else: + return False \ No newline at end of file