xcdat.center_times

Contents

xcdat.center_times#

xcdat.center_times(dataset)[source]#

Centers time coordinates using the midpoint between time bounds.

Time coordinates can be recorded using different intervals, including the beginning, middle, or end of the interval. Centering time coordinates, ensures calculations using these values are performed reliably regardless of the recorded interval.

This method attempts to get bounds for each time variable using the CF “bounds” attribute. Coordinate variables that cannot be mapped to bounds will be skipped.

Parameters:

dataset (xr.Dataset) – The Dataset with original time coordinates.

Returns:

xr.Dataset – The Dataset with centered time coordinates.