Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow concatenate of cube with anonymous dimensions #851

Closed
niallrobinson opened this issue Nov 21, 2013 · 5 comments
Closed

Allow concatenate of cube with anonymous dimensions #851

niallrobinson opened this issue Nov 21, 2013 · 5 comments

Comments

@niallrobinson
Copy link
Contributor

I just tried to concatenate two cubes like this with contiguous time coords

sea_water_potential_temperature / (degC) (time: 12; depth: 5; *ANONYMOUS*: 1021; *ANONYMOUS*: 1442)
     Dimension coordinates:
          time                                x          -               -                  -
          depth                               -          x               -                  -

Concatenate failed until I added dummy coords to dims 2 and 3 (i.e. lat and lon). I propose that in such circumstances, concatenate assumes that anonymous coords that are the same size and dimension are assumed to be compatible, with a warning issues to the user accordingly.

@niallrobinson
Copy link
Contributor Author

Just found #336

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.

I understand the logic, but I think, given the criteria or similar dim/length, it should be allowed with a warning. Either that, or the user can pass an argument to disambiguate.

@ajdawson
Copy link
Member

When I initially read this I thought that it sounded like a jolly good idea, as long as a warning is raised. However, this could lead to problems and may be difficult to implement. For instance, what happens if you have multiple anonymous dimensions of the same size?

@niallrobinson
Copy link
Contributor Author

may be difficult to implement

I never said it would be easy 😉

what happens if you have multiple anonymous dimensions of the same size?

I think there are two options:

The assumption would also be based on dimension number. If cube A and cube B dim 2 and dim 3 both have anonymous 100 pt coords it would be perverse to try and concatenate 2A with 3B and 3A with 2B. Its an assumption, but a fairly reasonable one, and a warning is raised

or

Scratch any automated guess and just require the user to pass a mapping list when there are anonymous coords present.

Essentially the logic at the minute is:
Compatible dimensions must have identical units

However, in reality the logic should be:
Incompatible dimensions must have different units.

i.e. if a dimension is anonymous, its possible that it is compatible with another anonymous coord...(or indeed a non-anonymous coord...but lets not get into that)

@ajdawson
Copy link
Member

The assumption would also be based on dimension number. If cube A and cube B dim 2 and dim 3 both have anonymous 100 pt coords it would be perverse to try and concatenate 2A with 3B and 3A with 2B. Its an assumption, but a fairly reasonable one, and a warning is raised

I absolutely agree with that, but there is always the worry that people will use this to go wildly wrong and get work with some incorrect data. Having said that, a suitable warning should be sufficient to avoid this.

However, in reality the logic should be: Incompatible dimensions must have different units.

I think that is a good way of describing it.

i.e. if a dimension is anonymous, its possible that it is compatible with another anonymous coord...(or indeed a non-anonymous coord...but lets not get into that)

Well perhaps we should get into that. Allowing anonymous coords to be compatible would be to make a common operation less painful, and is done only in the presence of a clear warning. It does not make sense to allow an anonymous coord to be compatible with a non-anonymous one, it unleashes a lot of painful ways to go wrong and it isn't really in the scope of what we are trying to achieve. In my mind this case is simple: an anonymous coord can only be compatible with another anonymous coord (in the presence of a clear warning), and not with a non-anonymous coord.

@pelson
Copy link
Member

pelson commented Oct 24, 2017

Closing due to inactivity.

@pelson pelson closed this as completed Oct 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants