• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python core.shape函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中numpy.core.shape函数的典型用法代码示例。如果您正苦于以下问题:Python shape函数的具体用法?Python shape怎么用?Python shape使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了shape函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: hfft

def hfft(a, n=None, axis=-1):
    """
    Compute the fft of a signal which spectrum has Hermitian symmetry.

    Parameters
    ----------
    a : array
        input array
    n : int
        length of the hfft
    axis : int
        axis over which to compute the hfft

    See also
    --------
    rfft
    ihfft

    Notes
    -----
    These are a pair analogous to rfft/irfft, but for the
    opposite case: here the signal is real in the frequency domain and has
    Hermite symmetry in the time domain. So here it's hermite_fft for which
    you must supply the length of the result if it is to be odd.

    ihfft(hfft(a), len(a)) == a
    within numerical accuracy.

    """

    a = asarray(a).astype(complex)
    if n is None:
        n = (shape(a)[axis] - 1) * 2
    return irfft(conjugate(a), n, axis) * n
开发者ID:GunioRobot,项目名称:numpy-refactor,代码行数:34,代码来源:fftpack.py


示例2: ihfft

def ihfft(a, n=None, axis=-1):
    """
    Compute the inverse fft of a signal whose spectrum has Hermitian symmetry.

    Parameters
    ----------
    a : array_like
        Input array.
    n : int, optional
        Length of the ihfft.
    axis : int, optional
        Axis over which to compute the ihfft.

    See also
    --------
    rfft, hfft

    Notes
    -----
    These are a pair analogous to rfft/irfft, but for the
    opposite case: here the signal is real in the frequency domain and has
    Hermite symmetry in the time domain. So here it's hermite_fft for which
    you must supply the length of the result if it is to be odd.

    ihfft(hfft(a), len(a)) == a
    within numerical accuracy.

    """

    a = asarray(a).astype(float)
    if n is None:
        n = shape(a)[axis]
    return conjugate(rfft(a, n, axis))/n
开发者ID:GunioRobot,项目名称:numpy-refactor,代码行数:33,代码来源:fftpack.py


示例3: graAscent02

def graAscent02(dataMatIn, labelMatIn):
    dataMatrix = array(dataMatIn)
    m, n = shape(dataMatIn)
    alpha = 0.01
    weights = ones(n)
    for i in range(m):
        h = sigmod(sum(dataMatrix[i] * weights))
        err = labelMatIn[i] - h
        offset = alpha * err * dataMatrix[i]
        weights = weights + offset
    return weights
开发者ID:shenhd,项目名称:Machine-Learning-Practice,代码行数:11,代码来源:logRegres.py


示例4: graAscent01

def graAscent01(dataMatIn, labelMatIn):
    dataMatrix = mat(dataMatIn)
    labelMatrix = mat(labelMatIn).transpose()
    m, n = shape(dataMatrix)
    alpha = 0.0001
    maxCycle = 500
    weights = ones((n, 1))
    for k in range(maxCycle):
        h = sigmod(dataMatrix * weights)
        err = labelMatrix - h
        weights = weights + alpha * dataMatrix.transpose() * err
    return weights
开发者ID:shenhd,项目名称:Machine-Learning-Practice,代码行数:12,代码来源:logRegres.py


示例5: ihfft

def ihfft(a, n=None, axis=-1):
    """
    Compute the inverse FFT of a signal which has Hermitian symmetry.

    Parameters
    ----------
    a : array_like
        Input array.
    n : int, optional
        Length of the inverse FFT.
        Number of points along transformation axis in the input to use.
        If `n` is smaller than the length of the input, the input is cropped.
        If it is larger, the input is padded with zeros. If `n` is not given,
        the length of the input along the axis specified by `axis` is used.
    axis : int, optional
        Axis over which to compute the inverse FFT. If not given, the last
        axis is used.

    Returns
    -------
    out : complex ndarray
        The truncated or zero-padded input, transformed along the axis
        indicated by `axis`, or the last one if `axis` is not specified.
        If `n` is even, the length of the transformed axis is ``(n/2)+1``.
        If `n` is odd, the length is ``(n+1)/2``.

    See also
    --------
    hfft, irfft

    Notes
    -----
    `hfft`/`ihfft` are a pair analogous to `rfft`/`irfft`, but for the
    opposite case: here the signal has Hermitian symmetry in the time domain
    and is real in the frequency domain. So here it's `hfft` for which
    you must supply the length of the result if it is to be odd:
    ``ihfft(hfft(a), len(a)) == a``, within numerical accuracy.

    Examples
    --------
    >>> spectrum = np.array([ 15, -4, 0, -1, 0, -4])
    >>> np.fft.ifft(spectrum)
    array([ 1.+0.j,  2.-0.j,  3.+0.j,  4.+0.j,  3.+0.j,  2.-0.j])
    >>> np.fft.ihfft(spectrum)
    array([ 1.-0.j,  2.-0.j,  3.-0.j,  4.-0.j])

    """

    a = asarray(a).astype(float)
    if n is None:
        n = shape(a)[axis]
    return conjugate(rfft(a, n, axis))/n
开发者ID:hitej,项目名称:meta-core,代码行数:52,代码来源:fftpack.py


示例6: graAscent03

def graAscent03(dataMatIn, labelMatIn):
    dataMatrix = array(dataMatIn) 
    m, n = shape(dataMatIn)
    weights = ones(n)
    numIter = 15
    for j in range(numIter):
        dataIndex = range(m)
        for i in range(m):
            alpha = 4.0 / (i + j + 1.0) + 0.001
            randIndex = int(random.uniform(0, len(dataIndex)))
            h = sigmod(sum(dataMatrix[randIndex] * weights))
            err = labelMatIn[randIndex] - h
            weights = weights + alpha * err * dataMatrix[randIndex]
    return weights
开发者ID:shenhd,项目名称:Machine-Learning-Practice,代码行数:14,代码来源:logRegres.py


示例7: hfft

def hfft(a, n=None, axis=-1):
    """
    Compute the FFT of a signal whose spectrum has Hermitian symmetry.

    Parameters
    ----------
    a : array_like
        The input array.
    n : int, optional
        The length of the FFT.
    axis : int, optional
        The axis over which to compute the FFT, assuming Hermitian symmetry
        of the spectrum. Default is the last axis.

    Returns
    -------
    out : ndarray
        The transformed input.

    See also
    --------
    rfft : Compute the one-dimensional FFT for real input.
    ihfft : The inverse of `hfft`.

    Notes
    -----
    `hfft`/`ihfft` are a pair analogous to `rfft`/`irfft`, but for the
    opposite case: here the signal is real in the frequency domain and has
    Hermite symmetry in the time domain. So here it's `hfft` for which
    you must supply the length of the result if it is to be odd:
    ``ihfft(hfft(a), len(a)) == a``, within numerical accuracy.

    Examples
    --------
    >>> signal = np.array([[1, 1.j], [-1.j, 2]])
    >>> np.conj(signal.T) - signal   # check Hermitian symmetry
    array([[ 0.-0.j,  0.+0.j],
           [ 0.+0.j,  0.-0.j]])
    >>> freq_spectrum = np.fft.hfft(signal)
    >>> freq_spectrum
    array([[ 1.,  1.],
           [ 2., -2.]])

    """

    a = asarray(a).astype(complex)
    if n is None:
        n = (shape(a)[axis] - 1) * 2
    return irfft(conjugate(a), n, axis) * n
开发者ID:258073127,项目名称:MissionPlanner,代码行数:49,代码来源:fftpack.py


示例8: ihfft

def ihfft(a, n=None, axis=-1):
    """hfft(a, n=None, axis=-1)
    ihfft(a, n=None, axis=-1)

    These are a pair analogous to rfft/irfft, but for the
    opposite case: here the signal is real in the frequency domain and has
    Hermite symmetry in the time domain. So here it's hfft for which
    you must supply the length of the result if it is to be odd.

    ihfft(hfft(a), len(a)) == a
    within numerical accuracy."""

    a = asarray(a).astype(float)
    if n == None:
        n = shape(a)[axis]
    return conjugate(rfft(a, n, axis))/n
开发者ID:ruschecker,项目名称:DrugDiscovery-Home,代码行数:16,代码来源:fftpack.py


示例9: ifft

def ifft(a, n=None, axis=-1):
    """
    Compute the one-dimensonal inverse fft along an axis.

    Return the `n` point inverse discrete Fourier transform of `a`.  The length
    `n` defaults to the length of `a`. If `n` is larger than the length of `a`,
    then `a` will be zero-padded to make up the difference. If `n` is smaller
    than the length of `a`, then `a` will be truncated to reduce its size.

    Parameters
    ----------

    a : array_like
        Input array.
    n : int, optional
        Length of the fft.
    axis : int, optional
        Axis over which to compute the inverse fft.

    See Also
    --------
    fft

    Notes
    -----
    The input array is expected to be packed the same way as the output of
    fft, as discussed in the fft documentation.

    This is the inverse of fft: ifft(fft(a)) == a within numerical
    accuracy.

    This is most efficient for `n` a power of two. This also stores a cache of
    working memory for different sizes of fft's, so you could theoretically
    run into memory problems if you call this too many times with too many
    different `n` values.

    """

    a = asarray(a).astype(complex)
    if n is None:
        n = shape(a)[axis]
    return _raw_fft(a, n, axis, fftpack.cffti, fftpack.cfftb, _fft_cache) / n
开发者ID:hadesain,项目名称:robothon,代码行数:42,代码来源:fftpack.py


示例10: irfft

def irfft(a, n=None, axis=-1):
    """
    Compute the one-dimensional inverse fft for real input.

    Parameters
    ----------
    a : array
        Input array with real data type.
    n : int
        Length of the fft.
    axis : int
        Axis over which to compute the fft.

    See Also
    --------
    rfft

    Notes
    -----
    Return the real valued `n` point inverse discrete Fourier transform
    of `a`, where `a` contains the nonnegative frequency terms of a
    Hermite-symmetric sequence. `n` is the length of the result, not the
    input. If `n` is not supplied, the default is 2*(len(`a`)-1). If you
    want the length of the result to be odd, you have to say so.

    If you specify an `n` such that `a` must be zero-padded or truncated, the
    extra/removed values will be added/removed at high frequencies. One can
    thus resample a series to m points via Fourier interpolation by: a_resamp
    = irfft(rfft(a), m).

    Within numerical accuracy ``irfft`` is the inverse of ``rfft``::

     irfft(rfft(a), len(a)) == a

    """

    a = asarray(a).astype(complex)
    if n is None:
        n = (shape(a)[axis] - 1) * 2
    return _raw_fft(a, n, axis, fftpack.rffti, fftpack.rfftb, _real_fft_cache) / n
开发者ID:hadesain,项目名称:robothon,代码行数:40,代码来源:fftpack.py


示例11: irfft

def irfft(a, n=None, axis=-1):
    """irfft(a, n=None, axis=-1)

    Return the real valued n point inverse discrete Fourier transform
    of a, where a contains the nonnegative frequency terms of a
    Hermite-symmetric sequence. n is the length of the result, not the
    input. If n is not supplied, the default is 2*(len(a)-1). If you
    want the length of the result to be odd, you have to say so.

    If you specify an n such that a must be zero-padded or truncated, the
    extra/removed values will be added/removed at high frequencies. One can
    thus resample a series to m points via Fourier interpolation by: a_resamp
    = irfft(rfft(a), m).

    This is the inverse of rfft:
    irfft(rfft(a), len(a)) == a
    within numerical accuracy."""

    a = asarray(a).astype(complex)
    if n == None:
        n = (shape(a)[axis] - 1) * 2
    return _raw_fft(a, n, axis, fftpack.rffti, fftpack.rfftb,
                    _real_fft_cache) / n
开发者ID:ruschecker,项目名称:DrugDiscovery-Home,代码行数:23,代码来源:fftpack.py


示例12: ihfft

def ihfft(a, n=None, axis=-1):
    """
    Compute the inverse FFT of a signal whose spectrum has Hermitian symmetry.

    Parameters
    ----------
    a : array_like
        Input array.
    n : int, optional
        Length of the inverse FFT.
    axis : int, optional
        Axis over which to compute the inverse FFT, assuming Hermitian
        symmetry of the spectrum. Default is the last axis.

    Returns
    -------
    out : ndarray
        The transformed input.

    See also
    --------
    hfft, irfft

    Notes
    -----
    `hfft`/`ihfft` are a pair analogous to `rfft`/`irfft`, but for the
    opposite case: here the signal is real in the frequency domain and has
    Hermite symmetry in the time domain. So here it's `hfft` for which
    you must supply the length of the result if it is to be odd:
    ``ihfft(hfft(a), len(a)) == a``, within numerical accuracy.

    """

    a = asarray(a).astype(float)
    if n is None:
        n = shape(a)[axis]
    return conjugate(rfft(a, n, axis))/n
开发者ID:258073127,项目名称:MissionPlanner,代码行数:37,代码来源:fftpack.py


示例13: ifft

def ifft(a, n=None, axis=-1):
    """ifft(a, n=None, axis=-1)

    Return the n point inverse discrete Fourier transform of a.  n
    defaults to the length of a. If n is larger than the length of a,
    then a will be zero-padded to make up the difference. If n is
    smaller than the length of a, then a will be truncated to reduce
    its size.

    The input array is expected to be packed the same way as the output of
    fft, as discussed in it's documentation.

    This is the inverse of fft: ifft(fft(a)) == a within numerical
    accuracy.

    This is most efficient for n a power of two. This also stores a cache of
    working memory for different sizes of fft's, so you could theoretically
    run into memory problems if you call this too many times with too many
    different n's."""

    a = asarray(a).astype(complex)
    if n == None:
        n = shape(a)[axis]
    return _raw_fft(a, n, axis, fftpack.cffti, fftpack.cfftb, _fft_cache) / n
开发者ID:ruschecker,项目名称:DrugDiscovery-Home,代码行数:24,代码来源:fftpack.py


示例14: irfft

def irfft(a, n=None, axis=-1):
    """
    Compute the inverse of the n-point DFT for real input.

    This function computes the inverse of the one-dimensional *n*-point
    discrete Fourier Transform of real input computed by `rfft`.
    In other words, `irfft(rfft(a), len(a)) == a` to within numerical accuracy.
    (See Notes below for why `len(a)` is necessary here.)

    The input is expected to be in the form returned by `rfft`, i.e. the
    real zero-frequency term followed by the complex positive frequency terms
    in order of increasing frequency.  Since the discrete Fourier Transform of
    real input is Hermite-symmetric, the negative frequency terms are taken
    to be the complex conjugates of the corresponding positive frequency terms.

    Parameters
    ----------
    a : array_like
        Input array
    n : int, optional
        Length of the transformed axis of the output.
        For `n` output points, `n/2+1` input points are necessary.  If the
        input is longer than this, it is cropped.  If it is shorter than this,
        it is padded with zeros.  If `n` is not given, it is determined from
        the length of the input (along the axis specified by `axis`)
        as explained below.
    axis : int, optional
        Axis over which to compute the inverse FFT.

    Returns
    -------
    out : real ndarray
        The truncated or zero-padded input, transformed along the axis
        indicated by `axis`, or the last one if `axis` is not specified.
        The length of the transformed axis is `n`, or, if `n` is not given,
        `2*(m-1)` where `m` is the length of the transformed axis of the input.
        To get an odd number of output points, `n` must be specified.

    Raises
    ------
    IndexError
        if `axis` is larger than the last axis of `a`

    See Also
    --------
    numpy.fft : for definition of the DFT and conventions used
    rfft : The one-dimensional FFT of real input, of which `irfft` is inverse.
    fft : The one-dimensional FFT
    irfft2 : The inverse of the two-dimensional FFT of real input.
    irfftn : The inverse of the *n*-dimensional FFT of real input.

    Notes
    -----

    Returns the real valued `n`-point inverse discrete Fourier transform
    of `a`, where `a` contains the nonnegative frequency terms of a
    Hermite-symmetric sequence. `n` is the length of the result, not the
    input.

    If you specify an `n` such that `a` must be zero-padded or truncated, the
    extra/removed values will be added/removed at high frequencies. One can
    thus resample a series to `m` points via Fourier interpolation by:
    `a_resamp = irfft(rfft(a), m)`.


    Examples
    --------

    >>> from numpy.fft import ifft, irfft
    >>> ifft([1, -1j, -1, 1j])
    array([ 0.+0.j,  1.+0.j,  0.+0.j,  0.+0.j])
    >>> irfft([1, -1j, -1])
    array([ 0.,  1.,  0.,  0.])

    Notice how the last term in the input to the ordinary `ifft` is the
    complex conjugate of the second term, and the output has zero imaginary
    part everywhere.  When calling `irfft`, the negative frequencies are not
    specified, and the output array is purely real.

    """

    a = asarray(a).astype(complex)
    if n is None:
        n = (shape(a)[axis] - 1) * 2
    return _raw_fft(a, n, axis, fftpack.rffti, fftpack.rfftb,
                    _real_fft_cache) / n
开发者ID:GunioRobot,项目名称:numpy-refactor,代码行数:86,代码来源:fftpack.py


示例15: ifft

def ifft(a, n=None, axis=-1):
    """
    Compute the one-dimensional inverse discrete Fourier Transform

    This function computes the inverse of the one-dimensional *n*-point
    discrete Fourier transform computed by `fft`.  In other words,
    `ifft(fft(a)) == a` to within numerical accuracy.
    For a general description of the algorithm and definitions,
    see `numpy.fft`.

    The input should be ordered in the same way as is returned by `fft`,
    i.e., `a[0]` should contain the zero frequency term,
    `a[1:n/2+1]` should contain the positive-frequency terms, and
    `a[n/2+1:]` should contain the negative-frequency terms, in order of
    decreasingly negative frequency.  See `numpy.fft` for details.

    Parameters
    ----------
    a : array_like
        Input array, can be complex
    n : int, optional
        Length of the transformed axis of the output.
        If `n` is smaller than the length of the input, the input is cropped.
        If it is larger, the input is padded with zeros.  If `n` is not given,
        the length of the input (along the axis specified by `axis`) is used.
        See notes about padding issues.
    axis : int, optional
        Axis over which to compute the inverse DFT.  If not given, the last
        axis is used.

    Returns
    -------
    out : complex ndarray
        The truncated or zero-padded input, transformed along the axis
        indicated by `axis`, or the last one if `axis` is not specified.

    Raises
    ------
    IndexError
        if `axes` is larger than the last axis of `a`

    See Also
    --------
    numpy.fft : An introduction, with definitions and general explanations
    fft : The one-dimensional (forward) FFT, of which `ifft` is the inverse
    ifft2 : The two-dimensional inverse FFT
    ifftn : The n-dimensional inverse FFT

    Notes
    -----

    If the input parameter `n` is larger than the size of the input, the input
    is padded by appending zeros at the end.  Even though this is the common
    approach, it might lead to surprising results.  If a different padding is
    desired, it must be performed before calling `ifft`.

    Examples
    --------

    >>> from numpy.fft import ifft
    >>> ifft([0, 4, 0, 0])
    array([ 1.+0.j,  0.+1.j, -1.+0.j,  0.-1.j])

    >>> from numpy import exp, pi, arange, zeros
    >>> import matplotlib.pyplot as plt
    >>> t = arange(400)
    >>> n = zeros((400,), dtype=complex)
    >>> n[40:60] = exp(1j*np.random.uniform(0, 2*pi, (20,)))
    >>> s = np.fft.ifft(n)
    >>> plt.plot(t, s.real, 'b-', t, s.imag, 'r--')
    >>> plt.legend(('real', 'imaginary'))
    >>> plt.show()

    Creates and plots a band-limited signal with random phases.

    """

    a = asarray(a).astype(complex)
    if n is None:
        n = shape(a)[axis]
    return _raw_fft(a, n, axis, fftpack.cffti, fftpack.cfftb, _fft_cache) / n
开发者ID:GunioRobot,项目名称:numpy-refactor,代码行数:81,代码来源:fftpack.py


示例16: hfft

def hfft(a, n=None, axis=-1):
    """
    Compute the FFT of a signal which has Hermitian symmetry (real spectrum).

    Parameters
    ----------
    a : array_like
        The input array.
    n : int, optional
        Length of the transformed axis of the output.
        For `n` output points, ``n//2+1`` input points are necessary.  If the
        input is longer than this, it is cropped.  If it is shorter than this,
        it is padded with zeros.  If `n` is not given, it is determined from
        the length of the input along the axis specified by `axis`.
    axis : int, optional
        Axis over which to compute the FFT. If not given, the last
        axis is used.

    Returns
    -------
    out : ndarray
        The truncated or zero-padded input, transformed along the axis
        indicated by `axis`, or the last one if `axis` is not specified.
        The length of the transformed axis is `n`, or, if `n` is not given,
        ``2*(m-1)`` where ``m`` is the length of the transformed axis of the
        input. To get an odd number of output points, `n` must be specified.

    Raises
    ------
    IndexError
        If `axis` is larger than the last axis of `a`.

    See also
    --------
    rfft : Compute the one-dimensional FFT for real input.
    ihfft : The inverse of `hfft`.

    Notes
    -----
    `hfft`/`ihfft` are a pair analogous to `rfft`/`irfft`, but for the
    opposite case: here the signal has Hermitian symmetry in the time domain
    and is real in the frequency domain. So here it's `hfft` for which
    you must supply the length of the result if it is to be odd:
    ``ihfft(hfft(a), len(a)) == a``, within numerical accuracy.

    Examples
    --------
    >>> signal = np.array([1, 2, 3, 4, 3, 2])
    >>> np.fft.fft(signal)
    array([ 15.+0.j,  -4.+0.j,   0.+0.j,  -1.-0.j,   0.+0.j,  -4.+0.j])
    >>> np.fft.hfft(signal[:4]) # Input first half of signal
    array([ 15.,  -4.,   0.,  -1.,   0.,  -4.])
    >>> np.fft.hfft(signal, 6)  # Input entire signal and truncate
    array([ 15.,  -4.,   0.,  -1.,   0.,  -4.])


    >>> signal = np.array([[1, 1.j], [-1.j, 2]])
    >>> np.conj(signal.T) - signal   # check Hermitian symmetry
    array([[ 0.-0.j,  0.+0.j],
           [ 0.+0.j,  0.-0.j]])
    >>> freq_spectrum = np.fft.hfft(signal)
    >>> freq_spectrum
    array([[ 1.,  1.],
           [ 2., -2.]])

    """

    a = asarray(a).astype(complex)
    if n is None:
        n = (shape(a)[axis] - 1) * 2
    return irfft(conjugate(a), n, axis) * n
开发者ID:hitej,项目名称:meta-core,代码行数:71,代码来源:fftpack.py


示例17: __getattr__

            self.array.__setattr__(attr, value)
        except AttributeError:
            object.__setattr__(self, attr, value)

    # Only called after other approaches fail.
    def __getattr__(self,attr):
        if (attr == 'array'):
            return object.__getattribute__(self, attr)
        return self.array.__getattribute__(attr)

#############################################################
# Test of class container
#############################################################
if __name__ == '__main__':
    temp=reshape(arange(10000),(100,100))

    ua=container(temp)
    # new object created begin test
    print dir(ua)
    print shape(ua),ua.shape # I have changed Numeric.py

    ua_small=ua[:3,:5]
    print ua_small
    ua_small[0,0]=10  # this did not change ua[0,0], which is not normal behavior
    print ua_small[0,0],ua[0,0]
    print sin(ua_small)/3.*6.+sqrt(ua_small**2)
    print less(ua_small,103),type(less(ua_small,103))
    print type(ua_small*reshape(arange(15),shape(ua_small)))
    print reshape(ua_small,(5,3))
    print transpose(ua_small)
开发者ID:beiko-lab,项目名称:gengis,代码行数:30,代码来源:user_array.py


示例18: _rc

 def _rc(self, a):
     if len(shape(a)) == 0: return a
     else: return self.__class__(a)
开发者ID:beiko-lab,项目名称:gengis,代码行数:3,代码来源:user_array.py


示例19: enumerate

 # Use cdutil averager functions to generate annual means
 print "** Calculating annual mean **"
 time_anncalc_start = time.time()
 try:
     # Determine first January
     for counter,compTime in enumerate(dtc):
         if compTime.month == 1:
             index_start = counter
             break
     # Determine last December
     for counter,compTime in reversed(list(enumerate(dtc))):
         if compTime.month == 12:
             index_end = counter
             break
     # Report inconsistent start/end times of data
     if (index_start != 0 or index_end != (shape(d)[0])-1) and not mod(len(range(index_start,index_end+1)),12):
         print "".join(['** WARNING: data sub-indexed to generate annual mean timeseries from: ',l,' **'])
         print "".join(['Start index: ',str(index_start),' End index: ',str(index_end),' var length: ',str(shape(d)[0]),' start ctime: ',str(dtc[index_start]),' end ctime: ',str(dtc[index_end])])         
         if 'logfile' in locals():
             writeToLog(logfile,"".join(['** WARNING: data sub-indexed to generate annual mean timeseries from: ',l,' **']))
     # Check valid number of months are being processed to create annual means
     elif mod(len(range(index_start,index_end+1)),12):
         # Report failure to logfile
         print "".join(['** PROBLEM 2 (incomplete monthly mean data) with: ',l,' found and breaking to next loop entry.. **'])
         #print "".join(['Start time: ',str(lb),' End time: ',str(ub),' input shape: ',str(d.shape),' output shape: ',str(dan.shape)])
         nc_bad2 = nc_bad2 + 1;
         if 'logfile' in locals():
             logtime_now = datetime.datetime.now()
             logtime_format = logtime_now.strftime("%y%m%d_%H%M%S")
             time_since_start = time.time() - start_time ; time_since_start_s = '%09.2f' % time_since_start
             err_text = 'PROBLEM 2 (incomplete monthly mean data) creating '
开发者ID:durack1,项目名称:cmip5,代码行数:31,代码来源:make_cmip_annualMeans.py



注:本文中的numpy.core.shape函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python core.sqrt函数代码示例发布时间:2022-05-27
下一篇:
Python core.remainder函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap