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

Add XArray DataArray support via XRImage #4

Merged
merged 23 commits into from
Mar 1, 2018
Merged

Conversation

mraspaud
Copy link
Member

This PR implements support for xarray.DataArrays in trollimage (and indirectly dask arrays too).

@coveralls
Copy link

coveralls commented Oct 24, 2017

Coverage Status

Coverage decreased (-0.6%) to 90.457% when pulling 736a684 on feature-xarray-support into 8bf9cac on develop.

@coveralls
Copy link

coveralls commented Dec 11, 2017

Coverage Status

Coverage decreased (-6.7%) to 84.433% when pulling e1030c8 on feature-xarray-support into 8bf9cac on develop.

@coveralls
Copy link

coveralls commented Dec 11, 2017

Coverage Status

Coverage decreased (-3.5%) to 87.727% when pulling 4d33dfb on feature-xarray-support into 1e4d7ff on develop.

@coveralls
Copy link

Coverage Status

Coverage decreased (-6.7%) to 84.433% when pulling e1030c8 on feature-xarray-support into 8bf9cac on develop.

@mraspaud mraspaud changed the title Start working on trollimage for xarrays [WIP] Start working on trollimage for xarrays Feb 23, 2018
@mraspaud
Copy link
Member Author

See also this PR: pytroll/satpy#203

self.data = data.expand_dims('bands')
self.data['bands'] = ['L']
else:
raise ValueError("No 'bands' dimension provided.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like there is some dependence on the dimensions being named bands, y, x. Would it be possible to infer these dimensions from the shape of the input array? Or is it just safer to force the user to ensure the dimensions before using this class? This may be something we need to force in satpy since I don't think all readers use y/x as dimensions for swaths.

Either way, we should probably add an assertion that all three of the expected bands are in the input.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, at least x and y have to be there

@mraspaud
Copy link
Member Author

because xarray needs a loaded array for that (says the error you get when you don't)

@djhoese
Copy link
Member

djhoese commented Feb 28, 2018

So wouldn't it make sense to replace the Image's data attribute with the loaded data? Otherwise you compute it twice, right? Or is it possible to compute the data save and the quantile in the same operations. It would be similar to how I changed some of the stuff in pyresample. I'm ok leaving it this way for now too if it isn't used often.

@mraspaud
Copy link
Member Author

Ok, let me change it

@djhoese djhoese changed the title [WIP] Start working on trollimage for xarrays Add XArray DataArray support via XRImage Mar 1, 2018
@djhoese djhoese self-assigned this Mar 1, 2018
@djhoese djhoese merged commit b90d37b into develop Mar 1, 2018
@djhoese djhoese deleted the feature-xarray-support branch March 1, 2018 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants