Blosc / python-blosc2

https://www.blosc.org/python-blosc2
Other
85 stars 19 forks source link

Fixing Errors with the fill_special Method for Filling an SChunk with Special Values. #250

Closed omaech closed 2 months ago

omaech commented 2 months ago

When trying to use the fill_special method to fill an SChunk with a special value, I encountered an error related to the provided value. The issue was with how the special value was assigned to special_value. Initially, I tried using: special_value = blosc2.SpecialValue.VALUE. However, this assignment was incorrect because SpecialValue.VALUE was not the appropriate value and required an additional parameter to be correctly interpreted. The solution was to use a valid special value that does not require additional parameters. Instead of SpecialValue.VALUE, I used SpecialValue.ZERO, which is a predefined special value suitable for this purpose.

Additionally, the fill_special() method can be used to create arrays of zeros, NaNs, or other specific values, rather than relying on current approaches that use NumPy tricks (e.g., blosc2_ext.zeros() or blosc2_ext.full()).