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

Provide fill_value, dtype to fetch_raster_window #114

Closed

Conversation

TomAugspurger
Copy link
Contributor

Closes #113

@@ -161,6 +163,8 @@ def asset_entry_to_reader_and_window(
def fetch_raster_window(
asset_entry: Optional[Tuple[Reader, windows.Window]],
slices: Tuple[slice, ...],
window_dtype: np.dtype = np.dtype("float64"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the keyword window_dtype, instead of dtype, to avoid a conflict with blockwise using dtype as well.

@gjoseph92
Copy link
Owner

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 #115 and see if that'll work for you?

@TomAugspurger
Copy link
Contributor Author

Yep, that seems to work.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fetch_raster_window should use fill_value
2 participants