本文整理汇总了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
示例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 ---
#####--------------------------------------------------------------------------
示例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()
示例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()
示例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()
示例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()