var2 = var1.clone()
var2[:] = N.random.random((nt, ny, nx))
var1[3:13, :1, :1] = MV2.masked
var2[5:15, -1:, -1:] = MV2.masked
var2.long_name = 'Sea level'
var2.id = 'sla'
mask = var1.mask | var2.mask  # common mask
vmax = var2.max()
bins = N.linspace(-0.1 * vmax, 0.9 * vmax, 14)
nbins = len(bins)
restart_file5 = code_file_name(ext='5.nc')
restart_file7 = code_file_name(ext='7.nc')
print restart_file5

# Normal
sab = StatAccum(tall=True, sall=True, bins=bins)
sab += var1[:5], var2[:5]
#print sab.get_tmean()

# Dump
sab.dump(restart_file5)
sab += var1[5:7], var2[5:7]
sab.dump(restart_file7)

# Load from scratch
sa5 = StatAccum(restart=True, restart_file=restart_file5)
sa7 = StatAccum(restart=True, restart_file=restart_file7)

# Intermediate loads
sai = StatAccum(tall=True, sall=True, bins=bins)
sai += var1[:5], var2[:5]
var2 = var1.clone()
var2[:] = N.random.random((nt, ny, nx))
var1[3:13, :1, :1] = MV2.masked
var2[5:15, -1:, -1:] = MV2.masked
var2.long_name = 'Sea level'
var2.id = 'sla'
mask = var1.mask|var2.mask # common mask
vmax = var2.max()
bins = N.linspace(-0.1*vmax, 0.9*vmax, 14)
nbins = len(bins)
restart_file5 = code_file_name(ext='5.nc')
restart_file7 = code_file_name(ext='7.nc')
print restart_file5

# Normal
sab = StatAccum(tall=True, sall=True, bins=bins)
sab += var1[:5], var2[:5]
#print sab.get_tmean()

# Dump
sab.dump(restart_file5)
sab += var1[5:7], var2[5:7]
sab.dump(restart_file7)

# Load from scratch
sa5 = StatAccum(restart=True, restart_file=restart_file5)
sa7 = StatAccum(restart=True, restart_file=restart_file7)

# Intermediate loads
sai = StatAccum(tall=True, sall=True, bins=bins)
sai += var1[:5], var2[:5]
Пример #3
0
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""Calculs sur les gros fichiers"""

from vcmq import cdms2, Intervals, data_sample, StatAccum, cdtime, curve2, N

# Initialisations

# - ouverture du fichier et infos temporelles
f = cdms2.open(data_sample('mars3d.xt.xe.nc'))
ctimes = f['xe'].getTime().asComponentTime()

# - passage par un accumulateur de stats
sa = StatAccum(tmean=True)

# Boucle sur des intervals journaliers
for itv in Intervals((ctimes[0], ctimes[-1], 'cc'),
                     'day'):  # -> ESSAYER 2 JOURS

    # Lecture
    print itv
    tmp = f('xe', time=itv)

    # Accumulation
    sa += tmp
    del tmp

# Finalisation

# - restitution
xem = sa.get_tmean()
Пример #4
0
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""Calculs sur les gros fichiers"""

from vcmq import cdms2, Intervals, data_sample, StatAccum, cdtime, curve2, N


# Initialisations

# - ouverture du fichier et infos temporelles
f = cdms2.open(data_sample("mars3d.xt.xe.nc"))
ctimes = f["xe"].getTime().asComponentTime()

# - passage par un accumulateur de stats
sa = StatAccum(tmean=True)


# Boucle sur des intervals journaliers
for itv in Intervals((ctimes[0], ctimes[-1], "cc"), "day"):  # -> ESSAYER 2 JOURS

    # Lecture
    print itv
    tmp = f("xe", time=itv)

    # Accumulation
    sa += tmp
    del tmp

# Finalisation

# - restitution