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

CubeData object #18

Closed
gunbra32 opened this issue Dec 8, 2015 · 5 comments
Closed

CubeData object #18

gunbra32 opened this issue Dec 8, 2015 · 5 comments

Comments

@gunbra32
Copy link
Contributor

gunbra32 commented Dec 8, 2015

Currently the method get() of the CubveData class returns a masked numpy array with the data of the requested variable only. It does not, however, return the respective variable data of the dimensions, i.e. of time, lat, and lon. I think, it would be better if get() would instead return an object that contains the data of the varible itself, the dimensional variables, and even a land-sea-mask, or a country mask. This would ensure that a non-expert user could not easily mess up the dimensions.

For example:

albedo = your_cube_reader.get("Albedo", None, (0,10), (10,20))

would then give the user an object with data, lat,lon, and whatever you want to put there, even some basic methods:

albedo.data
albedo.lat
albedo.lon
albedo.country
albedo.plot_map(time=anytime)
albedo.slice([t_0,t_n],[lat_0,lat_n],[lon_0, lon_n])
@meggart
Copy link
Contributor

meggart commented Dec 15, 2015

I agree, this would make a lot of sense for the plotting API. What would you suggest when reading multiple variables at once? At the moment, a Dictionary is returned, can we leave it that way and do:

    values = your_cube_reader.get(("Albedo","Emission"), None, (0,10), (10,20))

    values.lon
    values.lat
    values["Albedo"]

or would you prefer values.data["Albedo"]?

@forman
Copy link
Member

forman commented Dec 15, 2015

I suggest making it self-similar:

values = your_cube_reader.get(("Albedo","Emission"), None, (0,10), (10,20))

values.lon
values.lat
values.country
values.plot_map(time=anytime)  # multi-variable plot

albedo = values["Albedo"]

albedo.data
albedo.lat
albedo.lon
albedo.country
albedo.plot_map(time=anytime) # plot of 'Albedo'

@meggart
Copy link
Contributor

meggart commented Dec 16, 2015

I suggest making it self-similar:

Even better! 😎

@forman
Copy link
Member

forman commented Mar 30, 2016

Issue would be solved or addressed, if we use xarray (http://xarray.pydata.org) to represent Cube objects.

@forman
Copy link
Member

forman commented Jul 13, 2016

Fixed by #29

@forman forman closed this as completed Jul 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants