Skip to content

Commit

Permalink
improved logging message
Browse files Browse the repository at this point in the history
  • Loading branch information
veenstrajelmer committed Jan 29, 2025
1 parent 96f0089 commit 9c58a16
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dfm_tools/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,14 +400,16 @@ def copernicusmarine_dataset_timeshift(ds, dataset_id):
correct daily means from start-of-interval to center-of-interval times.
Only the daily data is currently corrected with an offset of 12 hours.
This does not shift yearly, monthly, hourly, 3hourly or 6hourly data.
Also daily averaged datasets called *-d are not corrected.
https://help.marine.copernicus.eu/en/articles/6820094-how-is-defined-the-nomenclature-of-copernicus-marine-data
"""
if "P1D-m" in dataset_id:
# check if dataset times are indeed at midnight (start-of-interval)
assert (ds["time"].to_pandas().dt.hour == 0).all()
# add offset to correct from midnight to noon (center-of-interval)
time_offset = pd.Timedelta(hours=12)
print(f"{time_offset} offset applied to copernicusmarine dataset")
print("daily averaged copernicusmarine dataset times were corrected "
"from midnight to noon by adding a 12-hour offset.")
ds["time"] = ds["time"] + time_offset
return ds

Expand Down

0 comments on commit 9c58a16

Please sign in to comment.