code: def _assert_has_data_for_time(da, start_date, end_date):
      
      if isinstance(start_date, str) and isinstance(end_date, str):
          logging.warning(
              'When using strings to specify start and end dates, the check '
              'to determine if data exists for the full extent of the desired '
              'interval is not implemented.  Therefore it is possible that '
              'you are doing a calculation for a lesser interval than you '
              'specified.  If you would like this check to occur, use explicit '
              'datetime-like objects for bounds instead.')
          return
  
      if RAW_START_DATE_STR in da.coords:
          with warnings.catch_warnings(record=True):
              da_start = da[RAW_START_DATE_STR].values
              da_end = da[RAW_END_DATE_STR].values
      else:
          times = da.time.isel(**{TIME_STR: [0, -1]})
          da_start, da_end = times.values
  
      message = ('Data does not exist for requested time range: {0} to {1};'
                 ' found data from time range: {2} to {3}.')
      # Add tolerance of one second, due to precision of cftime.datetimes
      tol = datetime.timedelta(seconds=1)
      if isinstance(da_start, np.datetime64):
          tol = np.timedelta64(tol, 'ns')
      range_exists = ((da_start - tol) <= start_date and
                      (da_end + tol) >= end_date)
      assert (range_exists), message.format(start_date, end_date,
                                            da_start, da_end)
docs: Check to make sure data is in Dataset for the given time range.
  
      Parameters
      ----------
      da : DataArray
           DataArray with a time variable
      start_date : datetime-like object or str
           start date
      end_date : datetime-like object or str
           end date
  
      Raises
      ------
      AssertionError
           If the time range is not within the time range of the DataArray