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

dtype for GDAL CInt16, rasterio complex_int16 #353

Merged
merged 5 commits into from
Jun 24, 2021

Conversation

scottyhq
Copy link
Contributor

@scottyhq scottyhq commented Jun 10, 2021

Will follow up with a simple test and docs...

@scottyhq
Copy link
Contributor Author

@snowman2 would it be OK to put a small (100x100 Cint16) test here test/test_data/input/cint16.tif ? or is your preference for creating test datasets for example https://github.com/mapbox/rasterio/blob/master/tests/test_complex_dtypes.py#L37

@snowman2
Copy link
Member

@scottyhq thanks for the fix 👍. Either way works for me. If you do add the raster, please compress it.

rioxarray/raster_writer.py Outdated Show resolved Hide resolved
rioxarray/_io.py Outdated Show resolved Hide resolved
@snowman2
Copy link
Member

@scottyhq thanks for you patience with this. It is looking good. I added a couple of comments for things that would be good to consider.

@scottyhq
Copy link
Contributor Author

@snowman2 I added more tests to cover dealing with masking and nodata. Given the single dtype= kwarg in to_raster which by default matches the in-memory np.dtype, and the fact that CInt16 is a special case, I think it's easiest to just require an explicit dtype='complex_int16' if you want to write to that format. So I added a note in the docstring.

Tests pass for me locally, except for test_integration_merge.py, which seems unrelated to this PR, and is due to rounding changes in rasterio>1.2.5: (rasterio/rasterio#2202)

@snowman2
Copy link
Member

@scottyhq this looks great, thanks 👍

@snowman2
Copy link
Member

@scottyhq any issues if I squash and merge?

@scottyhq
Copy link
Contributor Author

@scottyhq any issues if I squash and merge?

Fine by me! Thanks for the guidance @snowman2

@snowman2 snowman2 merged commit 18af305 into corteva:master Jun 24, 2021
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.

TypeError: data type 'complex_int16' not understood
3 participants