sea_water_density / kg m-3 (*ANONYMOUS*: 29; model_level_number: 20; latitude: 144; longitude: 288)
Dimension coordinates:
model_level_number - x - -
latitude - - x -
longitude - - - x
Auxiliary coordinates:
forecast_period x - - -
season x - - -
time x - - -
year x - - -
depth - x - -
Scalar coordinates:
forecast_reference_time: 1924-11-01 00:00:00
Attributes:
Conventions: CF-1.5
STASH: m02s00i???
history: Mean of sea_water_density aggregated over season, year
source: Data from Met Office Unified Model
Cell methods:
mean: season, yearTraceback (most recent call last):
File "<console>", line 1, in <module>
File "/net/home/h02/nrobin/workspace/sandpit/spgcooling.py", line 147, in doAnal
seasTempClim, seasSalClim, seasDensClim = bySeason(tempClim, salClim, densClim)
File "/net/home/h02/nrobin/workspace/sandpit/spgcooling.py", line 135, in bySeason
a = _indBySeason(temp)
File "/net/home/h02/nrobin/workspace/sandpit/spgcooling.py", line 131, in _indBySeason
a = cube.aggregated_by([cube.coord('season'), cube.coord('year')], analysis.MEAN)
File "/project/avd/iris/live/testing/iris/cube.py", line 2348, in aggregated_by
key[dimension_to_groupby] = (0,) * len(groupby)
File "/project/avd/iris/live/testing/iris/analysis/__init__.py", line 937, in __len__
value = len([s for s in self.group()])
File "/project/avd/iris/live/testing/iris/analysis/__init__.py", line 834, in group
self._compute_shared_coords()
File "/project/avd/iris/live/testing/iris/analysis/__init__.py", line 920, in _compute_shared_coords
new_points = np.array(new_bounds).mean(-1)
TypeError: cannot perform reduce with flexible type
import iris
import iris.coord_categorisation
# grab some HadCRUT data and get the (loose) area-avg...
sat = iris.load_cube('HadCRUT*.nc', 'temperature')
sat_ts = sat.collapsed(['latitude', 'longitude'], iris.analysis.MEAN)
# create a smoothed version...
sat_ts.rolling_window('time', iris.analysis.MEAN, 12)
# add some additional coords (e.g. if we were thinking of doing some seasonal work)...
iris.coord_categorisation.add_season(sat_ts , 'time')
# repeat the smoothing..
sat_ts.rolling_window('time', iris.analysis.MEAN, 12)
/exports/home/obrowne/envs/geosSciTools/lib/python2.7/site-packages/iris/cube.pyc in rolling_window(self, coord, aggregator, window, **kwargs)
3099 # bounds)
3100 new_bounds = new_bounds[:, (0, -1)]
-> 3101 new_points = np.mean(new_bounds, axis=-1)
3102
3103 # wipe the coords points and set the bounds
/exports/home/obrowne/envs/geosSciTools/lib/python2.7/site-packages/numpy/core/fromnumeric.pyc in mean(a, axis, dtype, out, keepdims)
2714
2715 return _methods._mean(a, axis=axis, dtype=dtype,
-> 2716 out=out, keepdims=keepdims)
2717
2718 def std(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False):
/exports/home/obrowne/envs/geosSciTools/lib/python2.7/site-packages/numpy/core/_methods.pyc in _mean(a, axis, dtype, out, keepdims)
60 dtype = mu.dtype('f8')
61
---> 62 ret = um.add.reduce(arr, axis=axis, dtype=dtype, out=out, keepdims=keepdims)
63 if isinstance(ret, mu.ndarray):
64 ret = um.true_divide(
TypeError: cannot perform reduce with flexible type