gjoseph92 / stackstac

Turn a STAC catalog into a dask-based xarray
https://stackstac.readthedocs.io
MIT License
245 stars 49 forks source link

Provide fill_value, dtype to fetch_raster_window #114

Closed TomAugspurger closed 2 years ago

TomAugspurger commented 2 years ago

Closes #113

gjoseph92 commented 2 years ago

Thanks for the issue and the PR. Oddly I also happened to notice this a few days ago and fixed it on a local branch I was working on, but hadn't gotten around to pushing it up.

The one issue with this approach is that fill_value can currently be passed in as None (a never-used feature that results in whatever nodata value is written into the GeoTIFF's metadata as the nodata value acts as the fill value). When that's the case, np.array(fill_value, window_dtype) will fail (unless window_dtype is float, in which case you'll get NaN).

On my branch I just removed this feature. Why don't you take a look at https://github.com/gjoseph92/stackstac/pull/115 and see if that'll work for you?

TomAugspurger commented 2 years ago

Yep, that seems to work.

I think losing fill_value=None is OK, since that will ideally be included in the STAC metadata.