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

ENH: Add ability to load bands as data_vars #296

Closed
snowman2 opened this issue Apr 13, 2021 · 3 comments · Fixed by #600
Closed

ENH: Add ability to load bands as data_vars #296

snowman2 opened this issue Apr 13, 2021 · 3 comments · Fixed by #600
Labels
proposal Idea for a new feature.
Milestone

Comments

@snowman2
Copy link
Member

snowman2 commented Apr 13, 2021

@alexamici brought this up in #197 and has been something I have thought about for a while and haven't come up with a great solution yet.

xarray-gdal implementation: https://github.com/bopen/xarray-gdal/blob/main/xarray_gdal/xarray_plugin.py

Benefits:

Why hasn't it been done already?

  • Backwards compatibility/consistency with xarray.open_rasterio
  • Loading it as a DataArray allows open_rasterio to work with multidimensional files where the band is a coordinate (time).
  • The coordinate mechanism provides a nice interface for selecting the band you are interested in by an index rds.sel(band=1).

It may make sense to have an option such as band_as_variable where you can toggle this mode on.

@ashleysommer
Copy link

ashleysommer commented Mar 3, 2022

This looks like a really useful feature (and directly related to my issue in #484)

In the gdalbuildvrt tool, you can pass the option -separate that puts each file into a separate band in the VRT file (and in this case each source file can have a different dtype).

So I propose, if you make this an optional behavior, the option could be called separate.

@snowman2
Copy link
Member Author

snowman2 commented May 12, 2022

@snowman2
Copy link
Member Author

snowman2 commented Nov 2, 2022

For those interested, see #600.

@snowman2 snowman2 added this to the 0.13.0 milestone Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Idea for a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants