当前位置: 首页>>代码示例>>Python>>正文


Python ma.vstack方法代码示例

本文整理汇总了Python中numpy.ma.vstack方法的典型用法代码示例。如果您正苦于以下问题:Python ma.vstack方法的具体用法?Python ma.vstack怎么用?Python ma.vstack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在numpy.ma的用法示例。


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

示例1: sen_seasonal_slopes

# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import vstack [as 别名]
def sen_seasonal_slopes(x):
    x = ma.array(x, subok=True, copy=False, ndmin=2)
    (n,_) = x.shape
    # Get list of slopes per season
    szn_slopes = ma.vstack([(x[i+1:]-x[i])/np.arange(1,n-i)[:,None]
                            for i in range(n)])
    szn_medslopes = ma.median(szn_slopes, axis=0)
    medslope = ma.median(szn_slopes, axis=None)
    return szn_medslopes, medslope 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:11,代码来源:mstats_basic.py

示例2: sen_seasonal_slopes

# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import vstack [as 别名]
def sen_seasonal_slopes(x):
    x = ma.array(x, subok=True, copy=False, ndmin=2)
    (n,_) = x.shape
    # Get list of slopes per season
    szn_slopes = ma.vstack([(x[i+1:]-x[i])/np.arange(1,n-i)[:,None]
                            for i in range(n)])
    szn_medslopes = ma.median(szn_slopes, axis=0)
    medslope = ma.median(szn_slopes, axis=None)
    return szn_medslopes, medslope


#####--------------------------------------------------------------------------
#---- --- Inferential statistics ---
#####-------------------------------------------------------------------------- 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:16,代码来源:mstats_basic.py

示例3: sum_stats

# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import vstack [as 别名]
def sum_stats():
    """Accumulate numpies for all realisations and then do stats.

    This will be quite memory intensive, and memory consumption will
    increase linearly.
    """

    propsd = {}

    for irel in range(NRUN):
        # load as Eclipse run; this will look for EGRID, INIT, UNRST

        print("Loading realization no {}".format(irel))
        grd = xtgeo.grid3d.Grid()
        grd.from_file(
            GRIDFILEROOT,
            fformat="eclipserun",
            initprops=INITPROPS,
            restartprops=RESTARTPROPS,
            restartdates=RDATES,
        )

        for prop in grd.props:
            if prop.name not in propsd:
                propsd[prop.name] = []
            if prop.name == "PORO":
                prop.values += irel * 0.001  # mimic variability aka ensembles
            else:
                prop.values += irel * 1  # just to mimic variability

            propsd[prop.name].append(prop.values1d)

    # find the averages:
    porovalues = npma.vstack(propsd["PORO"])
    poromeanarray = porovalues.mean(axis=0)
    porostdarray = porovalues.std(axis=0)
    print(poromeanarray)
    print(poromeanarray.mean())
    print(porostdarray)
    print(porostdarray.mean())
    return poromeanarray.mean() 
开发者ID:equinor,项目名称:xtgeo,代码行数:43,代码来源:grid3d_compute_stats.py

示例4: sum_running_stats

# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import vstack [as 别名]
def sum_running_stats():
    """Find avg per realisation and do a cumulative rolling mean.

    Memory consumption shall be very low.
    """

    for irel in range(NRUN):
        # load as Eclipse run; this will look for EGRID, INIT, UNRST

        print("Loading realization no {}".format(irel))

        grd = xtgeo.grid3d.Grid()
        grd.from_file(
            GRIDFILEROOT,
            fformat="eclipserun",
            restartprops=RESTARTPROPS,
            restartdates=RDATES,
            initprops=INITPROPS,
        )

        nnum = float(irel + 1)
        for prop in grd.props:
            if prop.name == "PORO":
                prop.values += irel * 0.001  # mimic variability aka ensembles
            else:
                prop.values += irel * 1  # just to mimic variability

            if prop.name == "PORO":
                if irel == 0:
                    pcum = prop.values1d
                else:
                    pavg = prop.values1d / nnum
                    pcum = pcum * (nnum - 1) / nnum
                    pcum = npma.vstack([pcum, pavg])
                    pcum = pcum.sum(axis=0)

    # find the averages:
    print(pcum)
    print(pcum.mean())
    return pcum.mean() 
开发者ID:equinor,项目名称:xtgeo,代码行数:42,代码来源:grid3d_compute_stats.py

示例5: sum_running_stats

# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import vstack [as 别名]
def sum_running_stats():
    """Find avg per realisation and do a cumulative rolling mean.

    Memory consumption shall be very low.
    """

    for irel in range(NRUN):
        # load as Eclipse run; this will look for EGRID, INIT, UNRST

        print("Loading realization no {}".format(irel))

        srf = xtgeo.RegularSurface(EXPATH1)

        nnum = float(irel + 1)
        srf.values += irel * 1  # just to mimic variability

        if irel == 0:
            pcum = srf.values1d
        else:
            pavg = srf.values1d / nnum
            pcum = pcum * (nnum - 1) / nnum
            pcum = npma.vstack([pcum, pavg])
            pcum = pcum.sum(axis=0)

    # find the averages:
    print(pcum)
    print(pcum.mean())
    return pcum.mean() 
开发者ID:equinor,项目名称:xtgeo,代码行数:30,代码来源:regsurf_compute_stats.py

示例6: sum_running_stats_bytestream

# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import vstack [as 别名]
def sum_running_stats_bytestream():
    """Find avg per realisation and do a cumulative rolling mean.

    Memory consumption shall be very low.
    """

    for irel in range(NRUN):
        # load as Eclipse run; this will look for EGRID, INIT, UNRST

        print("Loading realization no {}".format(irel))

        with open(EXPATH1, "rb") as myfile:
            stream = io.BytesIO(myfile.read())

        srf = xtgeo.RegularSurface(stream, fformat="irap_binary")

        nnum = float(irel + 1)
        srf.values += irel * 1  # just to mimic variability

        if irel == 0:
            pcum = srf.values1d
        else:
            pavg = srf.values1d / nnum
            pcum = pcum * (nnum - 1) / nnum
            pcum = npma.vstack([pcum, pavg])
            pcum = pcum.sum(axis=0)

    # find the averages:
    print(pcum)
    print(pcum.mean())
    return pcum.mean() 
开发者ID:equinor,项目名称:xtgeo,代码行数:33,代码来源:regsurf_compute_stats.py


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