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

Keep in memory original data type for writing #305

Closed
remi-braun opened this issue Apr 20, 2021 · 5 comments · Fixed by #307
Closed

Keep in memory original data type for writing #305

remi-braun opened this issue Apr 20, 2021 · 5 comments · Fixed by #307
Labels
bug Something isn't working

Comments

@remi-braun
Copy link
Contributor

It could be very nice to keep in memory the original data type (ie. uint16 for landsat data or uint8 for classified data).

Indeed, for now (unless I missed something), if we open a dataset with masked=True and the data is casted to float, we lose the information of the original datatype.
So we always write the dataset on disk in float, even when it is not justified (when the nodata is replaced by its true value)

@remi-braun remi-braun added the proposal Idea for a new feature. label Apr 20, 2021
@snowman2
Copy link
Member

That is a really good idea. I think this discussion should start with xarray to ensure consistency.

@snowman2
Copy link
Member

snowman2 commented Apr 20, 2021

@snowman2
Copy link
Member

This seems more relevant: pydata/xarray#1194

@dcherian
Copy link

You should be able to set .encoding["dtype"] at write time.

I bet it's being saved in encoding at read time but then is lost later.

@snowman2 snowman2 added bug Something isn't working and removed proposal Idea for a new feature. labels Apr 20, 2021
@snowman2
Copy link
Member

snowman2 commented Apr 20, 2021

Fix in #307

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants