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

Support non-NaN nodata values in mosaic #92

Closed
gjoseph92 opened this issue Nov 29, 2021 · 2 comments · Fixed by #121
Closed

Support non-NaN nodata values in mosaic #92

gjoseph92 opened this issue Nov 29, 2021 · 2 comments · Fixed by #121

Comments

@gjoseph92
Copy link
Owner

From microsoft/PlanetaryComputerExamples#108 (comment).

Support a nodata=np.nan kwarg to stackstac.mosaic, so you can specify a different nodata value if that's what you're using.

The larger problem here is that we're not storing the nodata value in xarray metadata anywhere—just using the xarray convention that NaN is the standard nodata value. But if you set fill_value, that's no longer the case.

Broadly related to #50: rioxarray has a convention for storing nodata in attributes, which we could follow, it's just convoluted CF-style. A single nodata coordinate might be more sensible to xarray users. (The real answer is native missing-value support in xarray though pydata/xarray#4143 pydata/xarray#3955 pydata/xarray#1194.)

If we had this, mosiac could automatically use the nodata value stored in the data, not requiring you to keep track of it.

cc @TomAugspurger

@TomAugspurger
Copy link
Contributor

Thanks I was debating whether or not to open this :) I'm probably OK with just a keyword.

I agree that this really needs to be solved upstream in xarray / NumPy.

@gjoseph92
Copy link
Owner Author

I think a keyword is our best stopgap for now, plus maybe storing the metadata. Do you know if there's been any more activity around missing-value support for xarray/NumPy? I haven't kept track for a while.

gjoseph92 added a commit that referenced this issue Jan 20, 2022
gjoseph92 added a commit that referenced this issue Jan 20, 2022
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 a pull request may close this issue.

2 participants