def get_time_index_range(self,
                             date_search_start=None,
                             date_search_end=None,
                             time_index_start=None,
                             time_index_end=None,
                             time_index=None):
        """
        Generates a time index range based on time bounds given.
        This is useful for subset data extraction.

        Parameters
        ----------
        date_search_start: :obj:`datetime.datetime`, optional
            This is a datetime object with the date of the minimum date for
            starting.
        date_search_end: :obj:`datetime.datetime`, optional
            This is a datetime object with the date of the maximum date
            for ending.
        time_index_start: int, optional
            This is the index of the start of the time array subset.
            Useful for the old file version.
        time_index_end: int, optional
            This is the index of the end of the time array subset.
            Useful for the old file version.
        time_index: int, optional
            This is the index of time to return in the case that your
            code only wants one index. Used internally.

        Returns
        -------
        :obj:`numpy.array`:
            This is an array of time indices used to extract a subset of data.


        CF-Compliant Qout File Example:

        .. code:: python

            from datetime import datetime
            from RAPIDpy import RAPIDDataset

            path_to_rapid_qout = '/path/to/Qout.nc'
            with RAPIDDataset(path_to_rapid_qout) as qout_nc:
                time_index_range = qout_nc.get_time_index_range(
                    date_search_start=datetime(1980, 1, 1),
                    date_search_end=datetime(1980, 12, 11))


        Legacy Qout File Example:

        .. code:: python

            from datetime import datetime
            from RAPIDpy import RAPIDDataset

            path_to_rapid_qout = '/path/to/Qout.nc'
            with RAPIDDataset(path_to_rapid_qout,
                              datetime_simulation_start=datetime(1980, 1, 1),
                              simulation_time_step_seconds=3600) as qout_nc:

                time_index_range = qout_nc.get_time_index_range(
                    date_search_start=datetime(1980, 1, 1),
                    date_search_end=datetime(1980, 12, 11))

        """
        # get the range of time based on datetime range
        time_range = None
        if ((self.is_time_variable_valid() or self._is_legacy_time_valid()) and
                (date_search_start is not None or
                 date_search_end is not None)):

            log("Determining time range ({0} to {1})"
                "...".format(date_search_start, date_search_end),
                "INFO")
            time_array = self.get_time_array()
            if date_search_start is not None:
                date_search_start_utc = date_search_start
                if self.out_tzinfo is not None:
                    date_search_start_utc = self.out_tzinfo \
                                                .localize(date_search_start) \
                                                .astimezone(utc) \
                                                .replace(tzinfo=None)
                seconds_start = (date_search_start_utc -
                                 datetime.datetime(1970, 1, 1)).total_seconds()
                time_range = np.where(time_array >= seconds_start)[0]

            if date_search_end is not None:
                date_search_end_utc = date_search_end
                if self.out_tzinfo is not None:
                    date_search_end_utc = self.out_tzinfo \
                                              .localize(date_search_end) \
                                              .astimezone(utc) \
                                              .replace(tzinfo=None)

                seconds_end = (date_search_end_utc -
                               datetime.datetime(1970, 1, 1)).total_seconds()
                if time_range is not None:
                    time_range = np.intersect1d(time_range,
                                                np.where(time_array <=
                                                         seconds_end)[0])
                else:
                    time_range = np.where(time_array <= seconds_end)[0]

        # get the range of time based on time index range
        elif time_index_start is not None or time_index_end is not None:
            if time_index_start is None:
                time_index_start = 0
            if time_index_end is None:
                time_index_end = self.size_time
            time_range = range(time_index_start, time_index_end)

        # get only one time step
        elif time_index is not None:
            time_range = [time_index]
        # return all
        else:
            time_range = range(self.size_time)

        return time_range
Generates a time index range based on time bounds given.
        This is useful for subset data extraction.

        Parameters
        ----------
        date_search_start: :obj:`datetime.datetime`, optional
            This is a datetime object with the date of the minimum date for
            starting.
        date_search_end: :obj:`datetime.datetime`, optional
            This is a datetime object with the date of the maximum date
            for ending.
        time_index_start: int, optional
            This is the index of the start of the time array subset.
            Useful for the old file version.
        time_index_end: int, optional
            This is the index of the end of the time array subset.
            Useful for the old file version.
        time_index: int, optional
            This is the index of time to return in the case that your
            code only wants one index. Used internally.

        Returns
        -------
        :obj:`numpy.array`:
            This is an array of time indices used to extract a subset of data.


        CF-Compliant Qout File Example:

        .. code:: python

            from datetime import datetime
            from RAPIDpy import RAPIDDataset

            path_to_rapid_qout = '/path/to/Qout.nc'
            with RAPIDDataset(path_to_rapid_qout) as qout_nc:
                time_index_range = qout_nc.get_time_index_range(
                    date_search_start=datetime(1980, 1, 1),
                    date_search_end=datetime(1980, 12, 11))


        Legacy Qout File Example:

        .. code:: python

            from datetime import datetime
            from RAPIDpy import RAPIDDataset

            path_to_rapid_qout = '/path/to/Qout.nc'
            with RAPIDDataset(path_to_rapid_qout,
                              datetime_simulation_start=datetime(1980, 1, 1),
                              simulation_time_step_seconds=3600) as qout_nc:

                time_index_range = qout_nc.get_time_index_range(
                    date_search_start=datetime(1980, 1, 1),
                    date_search_end=datetime(1980, 12, 11))