Some methods, like Li, have some special handling for nan values, but that is not uniform across all our methods, as you have seen. 😂 I would suggest:

```python
t = threshold_otsu(image[np.isfinite(image)])
```

That will only pass the non-nan, non-inf pixels to Otsu to do the calculation.

Hope this helps!

Juan.

On 18 Dec 2020, at 7:19 am, Laurynas Gedminas <laurynasgedminas@gmail.com> wrote:

Hello,
I have NDVI image, its not a square, and has some None values,
I am trying to create otsu threshold, but getting error:
autodetected range of [nan, nan] is not finite

how to go around that?

<image.png>

Thank you,