dtype changes after `most_common`
SarahAlidoost opened this issue · 1 comments
SarahAlidoost commented
It seems that da.regrid.most_common(...)
changes the dtype
of da from uint8
to float32
. Is this change needed? I tested this issue using demo notebook, just inspect dtype
before and after regrid.
BSchilperoort commented
Hi Sarah, thanks for raising this issue. This is not the intended behavior.
It turns out there are two problems:
- When restoring the input data's properties (attrs etc.), we use
.where
which will cast data to a floating point number so NaN can be used. - I forgot to expose the
fill_value
kwarg toregrid.most_common
, so no fill value can be passed by the user.