You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently updated to stackstac 0.5.1 and found a bug/incorrect documentation with stackstac.stack() and the fill_value and dtype parameters. This is related to #250 and tracks back to numpy.can_cast().
Take this example, where I want to grab just the fmask band from HLS L30 over an area at the smallest possible dtype ('unit8'):
The above will fail with: ValueError: The fill_value 255 is incompatible with the output dtype uint8. Either use dtype='int64', or pick a different fill_value.
Providing another value between 0-255 results in the same error.
Providing a fill_value of np.uint8(255) works and creates a stack with the correct dtype (verified with stack.load():
Checking numpy.can_cast(), which the above error points to, we see:
Previously, you could just provide an int like 255. So I am not sure if this is a bug or the documentation for stackstac.stack() needs to be updated to indicate that fill_value should specifically be a numpy dtype.
The text was updated successfully, but these errors were encountered:
Hello,
I recently updated to stackstac 0.5.1 and found a bug/incorrect documentation with
stackstac.stack()
and thefill_value
anddtype
parameters. This is related to #250 and tracks back tonumpy.can_cast()
.Take this example, where I want to grab just the fmask band from HLS L30 over an area at the smallest possible dtype ('unit8'):
Example:
The above will fail with:
ValueError: The fill_value 255 is incompatible with the output dtype uint8. Either use dtype='int64', or pick a different fill_value.
Providing another value between 0-255 results in the same error.
Providing a
fill_value
ofnp.uint8(255)
works and creates a stack with the correctdtype
(verified withstack.load()
:Checking
numpy.can_cast()
, which the above error points to, we see:Previously, you could just provide an
int
like 255. So I am not sure if this is a bug or the documentation forstackstac.stack()
needs to be updated to indicate thatfill_value
should specifically be anumpy dtype
.The text was updated successfully, but these errors were encountered: