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

New syntax for Cube extraction #605

Closed
koldunovn opened this issue Jul 5, 2013 · 1 comment
Closed

New syntax for Cube extraction #605

koldunovn opened this issue Jul 5, 2013 · 1 comment

Comments

@koldunovn
Copy link

I just recently begin to use Iris, and enjoy it very much. It has a lot of promising features. However your syntax for "Cube extraction" just kill all the fun. Cutting different regions and periods from the data is very basic operation during data analysis, and doing this with a lot of lambda functions is neither fast, nor convenient in practice. If for cutting simple box from my data I have to do something like this:

latc = iris.Constraint(latitude=lambda cell: minlat <= cell <= maxlat)
lonc = iris.Constraint(longitude=lambda cell: minlon <= cell <= maxlon)
region = cube.extract(latc & lonc)

it makes me very very sad.

I just wounder if you might be interested in discussion about how to do this in a better way. I see that there were some suggestions made in Issue #77 , but I think this topic deserves it's own ticket :)

Let me start with my humble suggestions, so that you have something to criticize :) I would love to have syntax similar to Pandas, where you can explicitly use values of your dimensions to limit the data. Something like:

cube.ext( t=['1990-01-01':'2000-01-01'], x=['140E':'160W'], y=['10S':'20N'], z=['0':'2000'] )

This, as you might notice, resembles also the Ferret syntax, that I believe is very convenient, and would be useful to have. I understand that the cube can have more dimensions, but having this four covered would be already a great deal. I do not suggest to replace existent syntax with this one, but only to create additional method for the cube class (e.g. ext), that will allow this type of syntax for extraction of the region.

What do you think?

@rcomer
Copy link
Member

rcomer commented Sep 17, 2020

Hi @koldunovn, I’m just reviewing some old issues to see what still needs addressing. It looks like the cube.intersection method fits your suggestion for latitude and longitude at least. Time extraction has also moved on and become less painful since you opened this. So I’m going to close this now. If you are still using Iris and think there is more to do here then please feel free to open a new issue.

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

2 participants