Merged
Conversation
lib/iris/tests/test_concatenate.py
Outdated
Member
Author
There was a problem hiding this comment.
Oops! The _output() function is a hang-over from debug/testing and should be nuked.
lib/iris/x_concatenate.py
Outdated
Contributor
There was a problem hiding this comment.
"already existing"...as opposed to what, non-existent? 😁
Is this qualification necessary?
Member
Author
There was a problem hiding this comment.
My point was that concatenate deals with existing dimensions. Cube stack (or currently cube merge) generates new dimensions. Hence the reason for already existing.
Happy to reword if you think it's clumsy (which it is) to: Automatic concatenation of multiple cubes over one or more existing dimensions..
lib/iris/x_concatenate.py
Outdated
Member
There was a problem hiding this comment.
dimesion -> dimension
I also prefer "dimension(s)" to "dimension/s" to indicate the optional 's'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR introduces experimental functionality to support the concatenation of two or more cubes over a common and already existing dimension. This is opposed to cube merge (aka cube stack as it's currently being rebranded as) which creates new cube dimensions based on mutually common scalar coordinates.
As mentioned previously, the cube concatenation functionality is experimental, hence the
iris.x_concatenatenamespace. This will change once cube concatenation is eventually adopted into the Iris core functionality.Health warning ...
Due to limitations with the current Iris deferred loading mechanism,
iris.x_concatenate.concatenate()will load the data payload of all your cubes. Heed this warning! This restriction will be relaxed in future revisions when the appropriate infrastructure is in place.In a nutshell ...
The
iris.x_concatenate.concatenate()function takes a list of cubes and returns the least number of largest possible cubes concatenated as many times necessary over common existing single dimensions ... yeah, like that helped clarify the matter! I think some examples might help here ...E.g. The time-series cubes
A(t:2, y:m, x:n),B(t:4, y:m, x:n), andC(t:6, y:m, x:n)are all geo-located but differ by non-overlapping time points over the first dimention. Thusconcatenate([A, B, C])will return the following concatenated cube(t:12, y:m, x:n)within aniris.cube.CubeList.E.g. Building on the previous example, let its result be the cube named
X. In addition to this we have the following sequence of time-series cubesD(t:2, y:m, x:p),E(t:4, y:m, x:p),F(t:6, y:m, x:p), which are co-located in latitude with cubeXbut not in longitude. Also,AandDshare the same time points,BandEshare the same time points, andCandFshare the same time points.Then
concatenate([X, D, E, F])will return the single concatenated cube(t:12, y:m, x:n+p). Indeed,concatenate([A, B, C, D, E, F])will return exactly the same result. Naturally, ifD,EandFare west ofX, then we would get(t:12, y:m, x:p+n), if you know what I mean. Note that, the order of cubes in the list presented toconcatenate()does not matter. Soconcatenate([F, E, D, C, B, A])andconcatenate([B, A, D, F, E, C])or whatever, will all result in the same answer.Cubes that have one or more anonymous dimension are ambiguous, and as such are considered incompatible with all other cubes. Therefore no cube can be concatenated with another cube that has at least one anonymous dimension.
As with cube merge (aka stack)
concatenate()is strict and unforgiving. Cube metadata, dimensionality and coordinate metadata must match for two cubes to be considered compatible for concatenation. Beware lowlyhistoryentries in theattributesdictionary of a cube!The important point is that
concatenate()will discover the one common dimension and concatenate all compatible cubes into one cube. Only one degree of common dimensional freedom is permitted per concatenation, yet this can be any one single dimension, andconcatenate()will exhaustively concatenate until there is no such commonality.Note ...
TODOlist. See theiris.x_concatenate.pypreamble.