Skip to content

Commit

Permalink
Update satpy/readers/viirs_vgac_l1c_nc.py
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Raspaud <[email protected]>
  • Loading branch information
ninahakansson and mraspaud authored Oct 11, 2023
1 parent 50361ac commit 92910ce
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions satpy/readers/viirs_vgac_l1c_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,8 @@ def set_time_attrs(self, data):

def dt64_to_datetime(self, dt64):
"""Conversion of numpy.datetime64 to datetime objects."""
# https://stackoverflow.com/questions/13703720/converting-between-datetime-timestamp-and-datetime64/46921593#46921593
if type(dt64) == np.datetime64:
unix_epoch = np.datetime64(0, 's')
one_second = np.timedelta64(1, 's')
seconds_since_epoch = (dt64 - unix_epoch) / one_second
dt = datetime.utcfromtimestamp(seconds_since_epoch)
return dt
if isinstance(dt64, np.datetime64):
return dt64.astype(datetime)
return dt64

def decode_time_variable(self, data, nc):
Expand Down

0 comments on commit 92910ce

Please sign in to comment.