Hi Malcolm,
Thanks for posting - that's an interesting idea, especially the optimisation angle. For small datasets (i.e. fits in system memory) it might not make much difference overall, but for large datasets (support for these in collapsed() is on the way) it'd be much more efficient if Iris could compute the mean and standard deviation without reading the data twice. I'll add that to the
to-do list! ;-)
I'd suggest a small tweak to the syntax though, to allow keyword arguments to be targeted at specific aggregation operators (MEAN, STD_DEV, etc).
Currently we have:
percentile = cube.collapsed('time', iris.analysis.PERCENTILE, percent=90)
But if we're going to support multiple operators it might be better to have something more like:
percentile = cube.collapsed('time', iris.analysis.PERCENTILE(percent=90))
Richard