Closed rsignell closed 2 months ago
You have to use open_kwargs
. See: https://github.com/corteva/rioxarray/blob/6b768ec260fc65752c5396fbfe3a9b25e49ae2b1/rioxarray/xarray_plugin.py#L50
Yep, so this works:
import xarray as xr
https_url = 'https://s3.us-west-2.amazonaws.com/prod-is-usgs-sb-prod-publish/618e83cad34ec04fc9caa715/South_Carolina_CoNED_Topobathy_DEM_1m.tif'
ds = xr.open_dataset(https_url,
engine='rasterio',
backend_kwargs=dict(open_kwargs={'overview_level':6},masked=True)
).squeeze(drop=True)
thanks @snowman2 !
I use the awesome
overview_level
parameter in rioxarray all the time to explore big COG images before analysis. I just recently tried using it with the invocation from xarray (with engine='rasterio') and it surprised me when it failed with:Here's a MRE:
I'm raising the issue here instead of on xarray repo because it seems perhaps the problem is that
overview_level
argument seems undocumented in the method: https://corteva.github.io/rioxarray/stable/rioxarray.html#rioxarray-open-rasterio and only exists in the documentation in the COG example here: https://corteva.github.io/rioxarray/stable/examples/COG.htmlForgive me if I've got this all wrong! 🙃