I have a new project on, calculating some seasonal climate metrics. As part of this, I need to identify, eg the wettest quarter in a set of climatological monthly data:
print(pr_cube)
Precipitation / (mm) (time: 12; latitude: 125; longitude: 211)
Dimension coordinates:
time x - -
latitude - x -
longitude - - x
where time is every month, averaged across 30-years with coord('time) =
DimCoord([2030-01-01 00:00:00, 2030-02-01 00:00:00, 2030-03-01 00:00:00,
2030-04-01 00:00:00, 2030-05-01 00:00:00, 2030-06-01 00:00:00,
2030-07-01 00:00:00, 2030-08-01 00:00:00, 2030-09-01 00:00:00,
2030-10-01 00:00:00, 2030-11-01 00:00:00, 2030-12-01 00:00:00]
I was wondering if I could add a seasons coordinate for all sets of consecutive 3 months, including 'wrapping around', something like this:
iris.coord_categorisation.add_season(cube, coord, name='season',
seasons=(''jfm', 'fma', 'mam', 'amj', 'mjj', 'jja', 'jas', 'aso', 'son', 'ond', 'ndj', 'djf'))
or
season = ('jfm', 'fma', 'mam', 'amj', 'mjj', 'jja', 'jas', 'aso', 'son', 'ond', 'ndj', 'djf')
iris.coord_categorisation.add_season_membership(cube, coord, season, name='all_quarters')
Not tested this yet, just wondered if about suggestions or a recommendation?
And then, get the season with the max rainfall?
Qtr_max_rain = pr_cube.collapsed('season', iris.analysis.MAX)
Would that work correctly ?