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


Python N.concatenate方法代码示例

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


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

示例1: range

# 需要导入模块: from vcmq import N [as 别名]
# 或者: from vcmq.N import concatenate [as 别名]
yyi[:, 0] = y0 + N.arange(nyi) * dyi[1]
for j in range(1, nyi):
    yyi[:, j] = yyi[:, j-1] + dxi[1]
xxbi, yybi = meshbounds(xxi, yyi)
relpos2index = lambda fi, fj, nyi: fj * nyi + fi
ii, jj = N.meshgrid(N.arange(nxi)+.5, N.arange(nyi)+.5)
iib, jjb = meshbounds(ii, jj)
zzi = relpos2index(ii, jj, nyi)
zzbi = relpos2index(iib, jjb, nyi)

# Input random points
N.random.seed(0)
np = 100
xxo = N.random.random(np)*(xxbi.max()-xxbi.min()) + xxbi.min()
yyo = N.random.random(np)*(yybi.max()-yybi.min()) + yybi.min()
xxo = N.concatenate((xxo, xxi.ravel()))
yyo = N.concatenate((yyo, yyi.ravel()))
np = xxo.size

# Convert to relative indices
zzo = N.zeros(np)-1
for i, (xo, yo) in enumerate(zip(xxo, yyo)):
    p, q = curv2rel_single(xxbi, yybi, xo, yo)
#    print xo, yo, '|', p, q, (q-1) * nxi + p - 1
    if q>=0:
        zzo[i] = relpos2index(p-1, q-1, nyi)

# Plot
vmin = zzbi.min()
vmax = zzbi.max()
P.pcolor(xxbi, yybi, zzi, vmin=vmin, vmax=vmax)
开发者ID:VACUMM,项目名称:vacumm,代码行数:33,代码来源:test_regrid_fortran_curv2rel_single.py

示例2: DS

# 需要导入模块: from vcmq import N [as 别名]
# 或者: from vcmq.N import concatenate [as 别名]
from vacumm.misc.plot import add_map_lines

# Read data
ds = DS(data_sample(ncfile), 'mars', logger_level='critical')
temp = ds.get_temp(squeeze=True)
dens = ds.get_dens(squeeze=True)
depth = ds.get_depth(squeeze=True)

# Compute MLD
mld = mixed_layer_depth(dens, depth=depth, mode='deltadens', format_axes=True)
del dens

# Compute transect
tlons = (lon0,lon1)
tlats = (lat0,lat1)
tlons = N.concatenate([N.linspace(lon0,lon1,100.),N.linspace(lon1,lon1,100.)])
tlats = N.concatenate([N.linspace(lat0,lat1,100.),N.linspace(lat1,lat0,100.)])
xtemp, xlons, xlats = transect(temp, tlons, tlats, getcoords=True, outaxis='dist')
xdepth = transect(depth, tlons, tlats)
xmld = transect(mld, tlons, tlats)
xmld[:]*=-1

# Plot temperature
s = section2(xtemp, yaxis=xdepth, ymin=-800, fill='contourf', nmax=20,
    contour_linewidths=0.7, bgcolor='0.5', figsize=(7,4),
    cmap='vacumm_rnb2_hymex',
    title='%(long_name)s (dens) along temp transect', show=False)

# Plot MLD
curve2(xmld, 'w-', linewidth=2, show=False)
开发者ID:jfleroux,项目名称:vacumm,代码行数:32,代码来源:test_regrid_transect_mld.py


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