__init__.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:PaleoView 作者: GlobalEcologyLab 项目源码 文件源码
def addcyclic(arrin,lonsin):
    """
    ``arrout, lonsout = addcyclic(arrin, lonsin)``
    adds cyclic (wraparound) point in longitude to ``arrin`` and ``lonsin``,
    assumes longitude is the right-most dimension of ``arrin``.
    """
    nlons = arrin.shape[-1]
    newshape = list(arrin.shape)
    newshape[-1] += 1
    if ma.isMA(arrin):
        arrout  = ma.zeros(newshape,arrin.dtype)
    else:
        arrout  = np.zeros(newshape,arrin.dtype)
    arrout[...,0:nlons] = arrin[:]
    arrout[...,nlons] = arrin[...,0]
    if ma.isMA(lonsin):
        lonsout = ma.zeros(nlons+1,lonsin.dtype)
    else:
        lonsout = np.zeros(nlons+1,lonsin.dtype)
    lonsout[0:nlons] = lonsin[:]
    lonsout[nlons]  = lonsin[-1] + lonsin[1]-lonsin[0]
    return arrout,lonsout
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号