prepare_time_bounds_encoding#

mhm_tools.common.netcdf.prepare_time_bounds_encoding(ds: Dataset, strip_time_attrs: bool = False) Dataset[source]#

Synchronize time and time-bounds encoding for NetCDF output.

Parameters:
  • ds (xr.Dataset) – Dataset to update.

  • strip_time_attrs (bool, default False) – If True, remove units/calendar attrs from the time coordinate as well as its bounds variable.

Returns:

The original dataset or a shallow copy if time bounds were regenerated.

Return type:

xr.Dataset