Closed tsnow03 closed 1 year ago
Thanks for opening your first issue here at xarray! Be sure to follow the issue template! If you have an idea for a solution, we would really welcome a Pull Request with proposed changes. See the Contributing Guide for more. It may take us a while to respond here, but we really value your contribution. Contributors like you help make xarray better. Thank you!
Hi @tsnow03 , nice to see you! :wave:
Xarray's open_rasterio
function was deprecated then removed completely in favour of using the backend entrypoint system (see https://github.com/pydata/xarray/issues/4697).
What this means for users is that they should install rioxarray
and use xr.open_dataset(path, engine='rasterio')
, see rioxarray docs on reading files. There should have been a warning raised about this automatically for the past 2 years.
In your case the offending open_rasterio
call is happening inside intake_xarray
. You should try updating that package, and if that doesn't work raise this issue again on the intake_xarray repository (exactly how you have done here, this is very clear, thank you).
However I'm surprised I can't find an issue about this there already - perhaps @scottyhq knows?
Ok. Thank you @TomNicholas! I'll work on fixing this.
However I'm surprised I can't find an issue about this there already - perhaps @scottyhq knows?
intake-stac (which uses intake-xarray behind the scenes) development is somewhat stalled. The idea being that there are now tools to go directly from STAC catalogs to Xarray without needing intake as an intermediary.
Check out these alternatives: https://pypi.org/project/xpystac/ https://github.com/opendatacube/odc-stac https://github.com/gjoseph92/stackstac
@tsnow03 for a single asset like you've shown above here is an alternative:
# Requires local credentials for USGS Landsat on AWS
os.environ["AWS_REQUEST_PAYER"] = "requester"
asset = items[0].assets['qa_pixel']
href = asset.extra_fields['alternate']['s3']['href']
band = xr.open_dataset(href, engine='rasterio', chunks=dict(band=1, x=512, y=512))
band
Thanks @scottyhq for the code example! You saved me a lot of time. This will get updated in our JupyterBook too.
What happened?
Hello! An old version of xarray worked fine with my code, but after an accidental update to 2023.05.0, creates this AttributeError with xarray open_rasterio. Downgrading to xarray 2023.03.0 fixed the issue, but all versions after had the bug including 2023.07.0. It seems related to corteva/rioxarray/issues/254. Thanks for all of your help!
What did you expect to happen?
No response
Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
Anything else we need to know?
No response
Environment