Ejemplo n.º 1
0
print("\n**Other statistical operations**\n")

a = cf.read('timeseries.nc')[0]
print(a)
b = a.cumsum('T')
print(b)
print(a.coordinate('T').bounds[-1].dtarray)
print(b.coordinate('T').bounds[-1].dtarray)
q, t = cf.read('file.nc')
print(q.array)
indices, bins = q.digitize(10, return_bins=True)
print(indices)
print(indices.array)
print(bins.array)
h = cf.histogram(indices)
print(h)
print(h.array)
print(h.coordinate('specific_humidity').bounds.array)
q, t = cf.read('file.nc')
print(q.array)
indices = q.digitize(5)
b = q.bin('range', digitized=indices)
print(b)
print(b.array)
print(b.coordinate('specific_humidity').bounds.array)
p, t = cf.read('file2.nc')
print(t)
print(p)
t_indices = t.digitize(4)
p_indices = p.digitize(6)
Ejemplo n.º 2
0
print("\n**Other statistical operations**\n")

a = cf.read('timeseries.nc')[0]
print(a)
b = a.cumsum('T')
print(b)
print(a.coordinate('T').bounds[-1].dtarray)
print(b.coordinate('T').bounds[-1].dtarray)
q, t = cf.read('file.nc')
print(q.array)
indices, bins = q.digitize(10, return_bins=True)
print(indices)
print(indices.array)
print(bins.array)
h = cf.histogram(indices)
print(h)
print(h.array)
print(h.coordinate('specific_humidity').bounds.array)
g = q.copy()
g.standard_name = 'air_temperature'
import numpy
g[...] = numpy.random.normal(loc=290, scale=10, size=40).reshape(5, 8)
g.override_units('K', inplace=True)
print(g)
indices_t = g.digitize(5)
h = cf.histogram(indices, indices_t)
print(h)
print(h.array)
h.sum()
q, t = cf.read('file.nc')