    def get_time_array(self,
                       datetime_simulation_start=None,
                       simulation_time_step_seconds=None,
                       return_datetime=False,
                       time_index_array=None):
        """
        This method extracts or generates an array of time.
        The new version of RAPID output has the time array stored.
        However, the old version requires the user to know when the
        simulation began and the time step of the output.

        Parameters
        ----------
        datetime_simulation_start: :obj:`datetime.datetime`, optional
            The start datetime of the simulation. Only required if the time
            variable is not included in the file.
        simulation_time_step_seconds: int, optional
            The time step of the file in seconds. Only required if the time
            variable is not included in the file.
        return_datetime: bool, optional
            If true, it converts the data to a list of datetime objects.
            Default is False.
        time_index_array: list or :obj:`numpy.array`, optional
            This is used to extract the datetime values by index from the main
            list. This can be from the *get_time_index_range* function.

        Returns
        -------
        list:
            An array of integers representing seconds since Jan 1, 1970 UTC
            or datetime objects if *return_datetime* is set to True.

        These examples demonstrates how to retrieve or generate a time array
        to go along with your RAPID streamflow series.


        CF-Compliant Qout File Example:

        .. code:: python

            from RAPIDpy import RAPIDDataset

            path_to_rapid_qout = '/path/to/Qout.nc'
            with RAPIDDataset(path_to_rapid_qout) as qout_nc:
                #retrieve integer timestamp array
                time_array = qout_nc.get_time_array()

                #or, to get datetime array
                time_datetime = qout_nc.get_time_array(return_datetime=True)


        Legacy Qout File Example:

        .. code:: python

            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=3 * 3600)\
                    as qout_nc:

                #retrieve integer timestamp array
                time_array = qout_nc.get_time_array()

                #or, to get datetime array
                time_datetime = qout_nc.get_time_array(return_datetime=True)

        """
        # Original Qout file
        if datetime_simulation_start is not None:
            self.datetime_simulation_start = datetime_simulation_start
        if simulation_time_step_seconds is not None:
            self.simulation_time_step_seconds = simulation_time_step_seconds

        epoch = datetime.datetime(1970, 1, 1, tzinfo=utc)
        time_units = "seconds since {0}".format(epoch)

        # CF-1.6 compliant file
        if self.is_time_variable_valid():
            time_array = self.qout_nc.variables['time'][:]
            if self.qout_nc.variables['time'].units:
                time_units = self.qout_nc.variables['time'].units

        # Original Qout file
        elif self._is_legacy_time_valid():
            initial_time_seconds = ((self.datetime_simulation_start
                                    .replace(tzinfo=utc) - epoch)
                                    .total_seconds() +
                                    self.simulation_time_step_seconds)
            final_time_seconds = (initial_time_seconds +
                                  self.size_time *
                                  self.simulation_time_step_seconds)
            time_array = np.arange(initial_time_seconds,
                                   final_time_seconds,
                                   self.simulation_time_step_seconds)
        else:
            raise ValueError("This file does not contain the time"
                             " variable. To get time array, add"
                             " datetime_simulation_start and"
                             " simulation_time_step_seconds")

        if time_index_array is not None:
            time_array = time_array[time_index_array]

        if return_datetime:
            time_array = num2date(time_array, time_units)

            if self.out_tzinfo is not None:
                for i in xrange(len(time_array)):
                    # convert time to output timezone
                    time_array[i] = utc.localize(time_array[i]) \
                                       .astimezone(self.out_tzinfo) \
                                       .replace(tzinfo=None)

        return time_array