MetOffice / CSET

Toolkit for evaluation and investigation of numerical models for weather and climate applications.
https://metoffice.github.io/CSET/
Apache License 2.0
10 stars 4 forks source link

Handle CubeLists in all operators that operate on Cubes #721

Open jfrost-mo opened 3 months ago

jfrost-mo commented 3 months ago

What problem does your feature request solve?

Currently there is not a good way to run operators that only take a single cube over all cubes in a CubeList. For example, regridding.

Describe the solution you'd like

These operators should be expanded to handle a CubeList. This should be done by looping over the cubes inside the operator, before returning another CubeList of the processed cubes.

Describe alternatives you've considered

We could add another operator to loop the existing single cube operators. It would have a signature similar to this:

- operator: misc.apply_to_all
  operator_to_apply: regrid.regrid_onto_xyspacing
  args:
    xspacing: 0.5
    yspacing: 0.5

I'm tempted to avoid it however, as it makes recipes harder to understand, and this functionality is part of making an operator more valuable than the underlying iris code. Looping within the operators also unlocks opportunities, like caching the regridder in #720.

jwarner8 commented 3 months ago

@jfrost-mo I will probably create a branch to update the regrid operator to handle a cubelist (realise this issue is for operators more generally). Reason for this is that to implement regrid caching, for one of the functions I need this capability (see comment in #720). Mentioning here to avoid duplication in case you start this work on all operators including regrid!

jfrost-mo commented 3 months ago

That sounds good. We probably want a few different branches for the different operators that need conversion to make reviewing easy.