-
Notifications
You must be signed in to change notification settings - Fork 85
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
ENH: Add xarray entrypoint #197
Comments
I'm willing to contribute a PR with the plugin, but I'd really prefer @snowman2 would you evaluate such a PR? |
I would check whether it is a DataArray or Dataset returned by |
This has been something that I have been on the fence about for the sake of consistency for the user. I think it would be good to have some input from others who might use this interface for their opinions on this. As an alternative, when converting to a dataset, you could set the name of the DataArray to For example: >>> import xarray as xr
>>> xds = xr.open_dataset("myfile.jp2", engine="gdal")
>>> xds.band_data.sel(band=1) |
Another reason for doing it the way you suggest here allows adding band specific metadata in the |
Thanks for getting started on this @alexamici 👍 |
After giving it some more thought, I don't think we should go this route. This is due to the fact that GDAL also supports netCDF/HDF/grib/etc.. Within each of the data variables for those scenarios, there needs to be a mechanism to select the band (which could be named |
I implemented the check for Current implementation returns: >>> ds = xr.open_dataset("myRGB.tif")
>>> ds
<xarray.Dataset>
Dimensions: (band: 3, x: 19087, y: 3932)
Coordinates:
* band (band) int64 1 2 3
* y (y) float64 ...
* x (x) float64 ...
Data variables:
spatial_ref int64 ...
band_data (band, y, x) float32 ...
>>> ds.band_data
<xarray.DataArray 'band_data' (band: 3, y: 3932, x: 19087)>
[225150252 values with dtype=float32]
Coordinates:
* band (band) int64 1 2 3
* y (y) float64 ...
* x (x) float64 ...
Attributes:
scale_factor: 1.0
add_offset: 0.0
grid_mapping: spatial_ref |
I think opening bands as variables or as a dimensions needs to be an option. For example using bands as variables I can easily add xarray |
This sounds like modifications would be needed for |
Relevant issues:
The text was updated successfully, but these errors were encountered: