コード例 #1
0
ファイル: courses_filters.py プロジェクト: acoat/vacumm
sst1d_gen13 = generic1d(sst1d, 13)
sst1d_gen3 = generic1d(sst1d, [1., 1., 1.])
sst1d_sha = shapiro1d(sst1d)  # -> SHAPIRO AVEC GENERIC1D
sst1d_bar13 = bartlett1d(sst1d, 13)
# -> TESTEZ GAUSSIEN SUR 13 HEURES

# - plots
curve2(sst1d, 'k', label='Original', show=False, figsize=(12, 5))
curve2(sst1d_gen13, 'r', label='Generic 13 pts', show=False)
curve2(sst1d_gen3, 'g', label='Generic 3 pts', show=False)
curve2(sst1d_sha, 'b', label='shapiro', show=False)
curve2(sst1d_bar13, 'm', label='Bartlett', legend=True)

# -> MASQUEZ UNE PARTIE DES DONNEES ET JOUEZ AVEC LE PARAMETRE MASK=

# -> LISEZ UN BLOCK 3D ET FILTREZ LE SUIVANT LE TEMPS

# 2D

# - filtrage
sst2d_gen13 = generic2d(sst2d, 13)
sst2d_gau13 = gaussian2d(sst2d, 13)

# - plots
kw = dict(vmin=sst2d.min(), vmax=sst2d.max(), colorbar=False, nmax=18)
map2(sst2d, title='Original', figsize=(13, 3), subplot=131, show=False, **kw)
map2(sst2d_gen13, title='Generic 13', subplot=132, show=False, **kw)
map2(sst2d_gau13, title='Gauss 13', subplot=133, show=True, **kw)

# -> JOUEZ AVEC MASK=
コード例 #2
0
"""Test function :func:`~vacumm.misc.filters.generic2d`"""
from vcmq import generic2d, N

# Constant no mask
var0 = N.ones((10, 10))
wei0 = N.ones((3, 3))
N.testing.assert_allclose(generic2d(var0, wei0), 1.)

# Constant with mask
var1 = N.ma.array(var0)
var1[0:3, 0:3] = N.ma.masked
wei1 = wei0
#N.testing.assert_allclose(generic2d(var1, wei1).compressed(), 1.)

# Constant with variable weight
var2 = var1
wei2 = wei1.copy()
wei2[1, 1] = 2.
wei2[[0, 2, 2, 0], [0, 0, 2, 2]] = 0.
N.testing.assert_allclose(generic2d(var2, wei2, mask='minimal').compressed(), 1.)


コード例 #3
0
ファイル: courses_filters.py プロジェクト: jfleroux/vacumm
sst1d_bar13 = bartlett1d(sst1d, 13)
# -> TESTEZ GAUSSIEN SUR 13 HEURES

# - plots
curve2(sst1d, 'k', label='Original', show=False, figsize=(12, 5))
curve2(sst1d_gen13, 'r', label='Generic 13 pts', show=False)
curve2(sst1d_gen3, 'g', label='Generic 3 pts', show=False)
curve2(sst1d_sha, 'b', label='shapiro', show=False)
curve2(sst1d_bar13, 'm', label='Bartlett', legend=True)


# -> MASQUEZ UNE PARTIE DES DONNEES ET JOUEZ AVEC LE PARAMETRE MASK=

# -> LISEZ UN BLOCK 3D ET FILTREZ LE SUIVANT LE TEMPS


# 2D

# - filtrage
sst2d_gen13 = generic2d(sst2d, 13)
sst2d_gau13 = gaussian2d(sst2d, 13)

# - plots
kw = dict(vmin=sst2d.min(), vmax=sst2d.max(), colorbar=False, nmax=18)
map2(sst2d, title='Original', figsize=(13, 3), subplot=131, show=False, **kw)
map2(sst2d_gen13, title='Generic 13', subplot=132, show=False, **kw)
map2(sst2d_gau13, title='Gauss 13', subplot=133, show=True, **kw)


# -> JOUEZ AVEC MASK=
コード例 #4
0
"""Test function :func:`~vacumm.misc.filters.generic2d`"""
from vcmq import generic2d, N

# Constant no mask
var0 = N.ones((10, 10))
wei0 = N.ones((3, 3))
N.testing.assert_allclose(generic2d(var0, wei0), 1.)

# Constant with mask
var1 = N.ma.array(var0)
var1[0:3, 0:3] = N.ma.masked
wei1 = wei0
#N.testing.assert_allclose(generic2d(var1, wei1).compressed(), 1.)

# Constant with variable weight
var2 = var1
wei2 = wei1.copy()
wei2[1, 1] = 2.
wei2[[0, 2, 2, 0], [0, 0, 2, 2]] = 0.
N.testing.assert_allclose(
    generic2d(var2, wei2, mask='minimal').compressed(), 1.)