seperate script for ballasting logic

This commit is contained in:
Marcel Christian Frommelt 2021-05-03 17:44:39 +09:00
parent e629d9ec8d
commit d237c37456
1 changed files with 54 additions and 0 deletions

54
models/ballasting.py Normal file
View File

@ -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