get() method should return a Dictionary rather than a list of np.arrays
Closed this issue · 5 comments
gunbra32 commented
As it stands, the user can only access a multi-variable list of arrays by index and not by name.
forman commented
Issue would be solved or addressed, if we use xarray (http://xarray.pydata.org) to represent Cube objects.
forman commented
Actually, I don't understand the issue. We decided to return arrays because we want to be able to use the following syntax:
v1, v2, v3 = cube.data.get(['v1', 'v2', 'v3'], ...)
Where v1, v2, v3 are currently raw numpy arrays. Using xarray, these will be xarray.DataArray instances. I guess, you are asking for an xarray.Dataset-like API replacing the get() method?
gunbra32 commented
Correct, using xarray would solve this issue.
forman commented
For single variables, we may also introduce
v1 = cube.data.get('v1', time=...)
rather than having to write
v1, = cube.data.get(['v1'], time=...)
forman commented
We plan to remove the get() method