'Create a new time object, possibly applying a method to the arrays.
Parameters
method : str or callable
If string, can be \'replicate\'  or the name of a relevant
`~numpy.ndarray` method. In the former case, a new time instance
with unchanged internal data is created, while in the latter the
method is applied to the internal ``jd1`` and ``jd2`` arrays, as
well as to possible ``location``, ``_delta_ut1_utc``, and
``_delta_tdb_tt`` arrays.
If a callable, it is directly applied to the above arrays.
Examples: \'copy\', \'__getitem__\', \'reshape\', `~numpy.broadcast_to`.
args : tuple
Any positional arguments for ``method``.
kwargs : dict
Any keyword arguments for ``method``.  If the ``format`` keyword
argument is present, this will be used as the Time format of the
replica.
Examples
Some ways this is used internally::
copy : ``_apply(\'copy\')``
replicate : ``_apply(\'replicate\')``
reshape : ``_apply(\'reshape\', new_shape)``
index or slice : ``_apply(\'__getitem__\', item)``
broadcast : ``_apply(np.broadcast, shape=new_shape)``'

def _apply(self, method, *args, **kwargs):

    new_format = kwargs.pop(u'format', None)
    if (new_format is None):
        new_format = self.format
    if callable(method):
        apply_method = (lambda array: method(array, *args, **kwargs))
    elif (method == u'replicate'):
        apply_method = None
    else:
        apply_method = operator.methodcaller(method, *args, **kwargs)
    (jd1, jd2) = (self._time.jd1, self._time.jd2)
    if apply_method:
        jd1 = apply_method(jd1)
        jd2 = apply_method(jd2)
    tm = super(Time, self.__class__).__new__(self.__class__)
    tm._time = TimeJD(jd1, jd2, self.scale, self.precision, self.in_subfmt, self.out_subfmt, from_jd=True)
    for attr in (u'_delta_ut1_utc', u'_delta_tdb_tt', u'location', u'precision', u'in_subfmt', u'out_subfmt'):
        try:
            val = getattr(self, attr)
        except AttributeError:
            continue
        if apply_method:
            if (getattr(val, u'size', 1) > 1):
                val = apply_method(val)
            elif ((method == u'copy') or (method == u'flatten')):
                val = copy.copy(val)
        setattr(tm, attr, val)
    if (u'info' in self.__dict__):
        tm.info = self.info
    if (new_format not in tm.FORMATS):
        raise ValueError(u'format    must    be    one    of    {0}'.format(list(tm.FORMATS)))
    NewFormat = tm.FORMATS[new_format]
    tm._time = NewFormat(tm._time.jd1, tm._time.jd2, tm._time._scale, tm.precision, tm.in_subfmt, tm.out_subfmt, from_jd=True)
    tm._format = new_format
    return tm
