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

Bring cubelist "extract_strict" into line with other Iris methods #3695

Closed
pp-mo opened this issue Apr 3, 2020 · 2 comments · Fixed by #3715
Closed

Bring cubelist "extract_strict" into line with other Iris methods #3695

pp-mo opened this issue Apr 3, 2020 · 2 comments · Fixed by #3715

Comments

@pp-mo
Copy link
Member

pp-mo commented Apr 3, 2020

There's a tweak to CubeList.extract_strict which makes it return a single cube as it is, instead of return a "list of one cube".
We just documented this more fully
But, as mentioned there I don't personally like returning different types of object from different operations, which I think is a bit of an anti-pattern...

IIRC this is why we have provided other functions in multiple convenience versions,
like "load or load_cube" and "cube.coords or cube.coord" : these forms combine convenience + syntactic elegance with better clarity as to the exact function + interface.
Even more relevant, right here in CubeList, we have merge() / merge_cube() and concatenate / concatenate_cube.

In this case, there is a bit of an obstacle in the dual choice between "cube or cubes", and "strict or not". I guess we are not going to have all of "extract, extract_strict, extract_cube, extract_cube_strict" ...

To be definite, I propose we should drop extract_strict altogether,
and replace it with extract_cube and extract_cubes.
I think that works, and would be much more in line with the other methods.

So, for examples of usage change :

  • extract_strict(some_constraints) --> extract_cubes(some_constraints).
  • extract_strict(one_constraint) --> extract_cube(one_constraint).
@pp-mo pp-mo added this to the v3.0.0 milestone Apr 3, 2020
@rcomer
Copy link
Member

rcomer commented Apr 3, 2020

extract_cubes would also be consistent with load_cubes 👍

@pp-mo
Copy link
Member Author

pp-mo commented May 27, 2020

#3715 addresses

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants