diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2023-09-03 23:04:46 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2023-09-03 23:04:46 +0200 |
commit | 32ed4d62d9fae3f62db29fd73e1d9393aa1a8010 (patch) | |
tree | d9347a4e2cf788e4be138835dd19b8286f588053 /misc.py | |
parent | 4895e8336006d5c226dd00c4f8d52a02a70123f2 (diff) | |
download | meteo_toolbox-32ed4d62d9fae3f62db29fd73e1d9393aa1a8010.tar.gz |
improvements
Diffstat (limited to 'misc.py')
-rw-r--r-- | misc.py | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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) |