Skip to content

Conversation

@TomAugspurger
Copy link
Contributor

Closes #113

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

@TomAugspurger TomAugspurger Dec 20, 2021

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