dctools.utilities.xarray_utils.filter_time_interval

dctools.utilities.xarray_utils.filter_time_interval(ds, start_time, end_time)

Filters an xarray Dataset to only include data within a specified time range.

Parameters:
  • ds (xr.Dataset) – Input dataset containing time coordinates.

  • start_time (str) – The start time in ISO format (e.g., “2024-05-02”).

  • end_time (str) – The end time in ISO format (e.g., “2024-05-11”).

Returns:

A filtered dataset containing only data within the time range. Returns None if no data is within the time range.

Return type:

xr.Dataset