iris icon indicating copy to clipboard operation
iris copied to clipboard

Make dataless cubes work with cube operations

Open ESadek-MO opened this issue 9 months ago • 4 comments

Related: #4447 and #6303

✨ Feature Request

With #6253, Iris will be able to create dataless cubes, but not much else.

Currently, some of the biggest things that are yet to be implemented are cube operations such as Collapse, Extract etc.

I propose:

  • For single cube operations, such as collapse, extract and aggregate, that if the cube is dataless, these functions should ignore data altogether, and instead perform the functions on the shape, (and coords, metadata etc.).
  • For multi cube operations:
    • If all cubes involved are dataless, they should follow the above approach, ignore data and change shape instead.
    • If it's a mix of dataless and with-data cubes, it should either:
      • Raise an error, and commit to not doing this.
      • Convert dataless cubes into normal cubes, by creating a fully masked array in the shape of the cube. I'm yet to investigate, but I think this could be a relatively straightforward function for either DataManager or Cube. This may muddy the waters of what dataless means, but could add convenience for interoperability between dataless and with-data, generally.

ESadek-MO avatar Feb 25 '25 19:02 ESadek-MO

@bjlittle thoughts?

ESadek-MO avatar Feb 25 '25 19:02 ESadek-MO

I hadn't thought much about collapsing a dataless Cube but it would be pretty cool. The scalar coordinates and cell methods are useful information in their own right, and don't need data to be present.

trexfeathers avatar Mar 07 '25 13:03 trexfeathers

This should also include load/save round tripping, to allow for longer term regridding targets

ESadek-MO avatar May 01 '25 13:05 ESadek-MO

Discussed in @SciTools/peloton.

  • Saving dataless cubes would not be CF-Compliant. This would mean saving it to .netcdf using our current loaders would not work.
  • A potential solution for this would be to create a dataless saver, with a special NetCDF variable which would bypass CF checker when loading.
  • There is also the question of future usecases; if other usecases are found, the way we approach this might be slightly different.

ESadek-MO avatar May 14 '25 09:05 ESadek-MO