Skip to content

Commit

Permalink
Merge pull request #2754 from ninahakansson/vgac_fix_time_var
Browse files Browse the repository at this point in the history
Bugfix vgac reader
  • Loading branch information
mraspaud committed Mar 8, 2024
2 parents 6c9d8b2 + 85d9117 commit f6b1096
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion satpy/readers/viirs_vgac_l1c_nc.py
Expand Up @@ -83,7 +83,7 @@ def extract_time_data(self, data, nc):
"""Decode time data."""
reference_time = np.datetime64(datetime.strptime(nc["proj_time0"].attrs["units"],
"days since %d/%m/%YT%H:%M:%S"))
delta_part_of_day, delta_full_days = np.modf(nc["proj_time0"].values[0])
delta_part_of_day, delta_full_days = np.modf(nc["proj_time0"].values)
delta_full_days = np.timedelta64(delta_full_days.astype(np.int64), "D").astype("timedelta64[us]")
delta_part_of_day = delta_part_of_day * np.timedelta64(1, "D").astype("timedelta64[us]")
delta_hours = data.values * np.timedelta64(1, "h").astype("timedelta64[us]")
Expand Down
2 changes: 1 addition & 1 deletion satpy/tests/reader_tests/test_viirs_vgac_l1c_nc.py
Expand Up @@ -72,7 +72,7 @@ def nc_filename(tmp_path):
delta_full_days = delta_days.astype("timedelta64[D]")
hidden_reference_time = reference_time + delta_full_days
delta_part_of_days = start_time - hidden_reference_time
proj_time0 = nc.createVariable("proj_time0", np.float64, ("one",))
proj_time0 = nc.createVariable("proj_time0", np.float64)
proj_time0[:] = (delta_full_days.astype(np.int64) +
0.000001 * delta_part_of_days.astype("timedelta64[us]").astype(np.int64) / (60 * 60 * 24))
proj_time0.units = "days since 01/01/2010T00:00:00"
Expand Down

0 comments on commit f6b1096

Please sign in to comment.