aboutsummaryrefslogtreecommitdiff
path: root/misc.py
diff options
context:
space:
mode:
Diffstat (limited to 'misc.py')
-rw-r--r--misc.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/misc.py b/misc.py
new file mode 100644
index 0000000..90417f1
--- /dev/null
+++ b/misc.py
@@ -0,0 +1,9 @@
+import numpy as np
+import datetime
+
+def np_time_convert(dt64):
+ unix_epoch = np.datetime64(0, 's')
+ one_second = np.timedelta64(1, 's')
+ seconds_since_epoch = (dt64 - unix_epoch) / one_second
+
+ return datetime.datetime.utcfromtimestamp(seconds_since_epoch)