Ability to specify the desired dtype when decoding a variable with scale_factor
and add_offset
#285
Replies: 1 comment
-
Sorry, wrong repository... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I create this discussion following a recent xarray update that changes the decoding of encoded data via attributes
scale_factor
andadd_offset
. Long story short, before, myuint16
was decoded to afloat32
, but now is decoded tofloat64
. Thefloat32
was desirable for my usecase.More details on this comment I made on the issue: pydata/xarray#2304 (comment)
_choose_float_dtype
implementation in the associated PR: https://github.com/pydata/xarray/pull/8713/files#diff-ebbe6dc9f2f17dc4a9777193c923783413a3a6814f6e85d82ade7ca9f8ca65c9R396My question would be: is it possible to specify the desired target dtype? Either via a special encoding attribute (like
scale_factor
andadd_offset
, we could imagineencoded_dtype='uint16'
anddecoded_dtype='float32'
? Or via a special kwarg to pass toopen_dataset
, likeopen_dataset(decode_cf=True, decoding_mapping={'/path/to/my_variable': 'float32'}
?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions