(WIP) Extend new_axis() to help concatenate cubes with ancils #3600
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Depends on either #3566 or #3583 changing the metadata structure of CellMeasure and AncillaryVariable.
The purpose of this pull request is to provide a simple workaround for cases where cubes can't merge properly because there are AuxCoords, CellMeasures or AncillaryVariables which ought to be merged in the final cube. In such a case, the function
iris.util.new_axis
is applied to all cubes and they are then concatenated. All AuxCoords, CellMeasures or AncillaryVariables which are to be merged in the final will be promoted byiris.util.new_axis
by specifying them with the keywordspromoted_aux
,promoted_cm
orpromoted_av
. This allows a greater degree of control than is possible with merge, since it will be possible to decide which AuxCoords, CellMeasures or AncillaryVariables should be merged (increasing their dimension) and which should be conserved (preserving their dimension).I think this extra functionality could help simplify a lot of potentially fiddly or unstable user code (
iris.util.new_axis
accounts for a lot of nasty edge cases). The workaround for merge would only have to be a couple extra lines, eg.vs
In addition, Ancillary Variables and Cell Measures are no longer thrown away by
new_axis
.