Is there a similar function at iris to cf_xarray resample using mean?
mean
dataset.cf.resample(T="Y").mean()
Although not very elegant, I found a way to make it possible for year:
year
import iris import iris.coord_categorisation def year_mean(dataset): # 1st step: Create an auxialiary coordinate iris.coord_categorisation.add_year(dataset, "time", name="year") # 2nd step: Mean over the auxiliary coordinate result = dataset.aggregated_by(["year"], iris.analysis.MEAN) # 3rd step: Fix cell_methods method = iris.coords.CellMethod('mean', coords=['time'], intervals='1 year') result.cell_methods = result.cell_methods[:-1] result.add_cell_method(method) # 4rd step: Remove the auxiliary coordinate result.remove_coord("year") return result
I think this produces the most CF standard output.
Although not very elegant, I found a way to make it possible for
year:I think this produces the most CF standard output.