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

unexpected and undocumented behaviour in dim coord assoc. #609

Closed
cpelley opened this issue Jul 10, 2013 · 6 comments
Closed

unexpected and undocumented behaviour in dim coord assoc. #609

cpelley opened this issue Jul 10, 2013 · 6 comments

Comments

@cpelley
Copy link

cpelley commented Jul 10, 2013

        if not matches:
            matches = [(dim,) for coord_, dim in self._dim_coords_and_dims if
                       coord_.name() == coord.name()]

        # Search aux coords
        if not matches:
            matches = [dims for coord_, dims in self._aux_coords_and_dims if
                       coord_.name() == coord.name()]

https://github.com/SciTools/iris/blob/master/lib/iris/cube.py#L791

Currently we are looking at whether the given coord shares its name with a coordinate on the cube. I really dont think this belongs in coord_dims at all and may result in unexpected results to users.

Effected tests:
test_contrived_differential1 (iris.tests.test_analysis_calculus.TestCalculusWKnownSolutions)
test_contrived_spherical_curl1 (iris.tests.test_analysis_calculus.TestCalculusWKnownSolutions)
test_contrived_sphrical_curl2 (iris.tests.test_analysis_calculus.TestCalculusWKnownSolutions)

Since this is not documented, I would at the very least label it as a bug, further more, the test failures based on its removal require investigation, determining why its necessary.

Happy to look into this myself when I have time.

@ajdawson
Copy link
Member

ajdawson commented Nov 7, 2013

Was this issue fixed by #587? If so can we close this?

@rhattersley
Copy link
Member

Was this issue fixed by #587? If so can we close this?

Unfortunately not. The lines in question are still present:

### Search by coord name, if have no match

@pelson pelson added this to the v1.7 milestone Jun 25, 2014
@pelson
Copy link
Member

pelson commented Jun 25, 2014

I've put this in the v1.7 milestone as it sounds like there is a bug here, I just don't know what it is - can anyone shed any light?

@pelson pelson added the bug label Jun 26, 2014
@pelson
Copy link
Member

pelson commented Jun 26, 2014

Ah, I see (it has taken a long time to understand the problem, but I has finally clicked - perhaps the issue description could have been a little cleared in describing the problem).

Essentially I believe the complaint is that cube.coord_dims() takes a coord instance, first checking whether the given coord actually exists on the cube. If not, the coord definition will be used to find the appropriate coordinate and its dimensions. If there is still no luck, then the coordinate name is used instead.

It is the ambiguity of using the coordinate name that is the complaint/bug here.

I'm going to push this out of v1.7 as I don't think it is a show stopped.

@pelson pelson removed the bug label Jun 26, 2014
@pelson pelson removed this from the v1.7 milestone Jun 26, 2014
@cpelley
Copy link
Author

cpelley commented Jul 30, 2014

It is the ambiguity of using the coordinate name that is the complaint/bug here.

Thank you for your interest, yes this is what was intended as the 'issue' raised.

Cheers @pelson, still on my radar! will look into it!

@rcomer
Copy link
Member

rcomer commented Sep 16, 2020

No idea when they were removed, but those name matching lines are no longer present.

@rcomer rcomer closed this as completed Sep 16, 2020
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

5 participants