ubarsc / pyshepseg

Python implementation of image segmentation algorithm of Shepherd et al (2019) Operational Large-Scale Segmentation of Imagery Based on Iterative Elimination. Remote Sensing 11(6).
https://www.pyshepseg.org
MIT License
10 stars 4 forks source link

cope with new version of scipy and changed behaviour of stats.mode #48

Closed gillins closed 8 months ago

gillins commented 8 months ago

As spotted by @t-hackwood pyshepseg fails to do tiled segmentation with a recent scipy as it tries to index a scalar. The problem is that the behaviour changed in scipy 1.9.0 where a keepdims parameter was added to the stats functions. Now returns a scalar for 1d inputs by default.

keepdims=True will revert to the previous behaviour (return a 1d array for 1d inputs), but since this wasn't an option on earlier scipy, this will break older installs.

So my approach was to do a test on what is returned. Tested on scipy 1.8 and 1.12.

Any thoughts @neilflood (no hurry on this) ?

neilflood commented 8 months ago

Well done to you both. Looks like scipy 1.9.0 was July 2022, so it would have been broken for a while. How annoying. Thank you both for tracking it down.

That fix seems good to me, thanks

gillins commented 8 months ago

Probably unnoticed until now because most people were using Ubuntu 22.04 as their base.

petescarth commented 6 months ago

I just hit this bug, but it's already fixed. Thanks!

gillins commented 6 months ago

Will do a new point release once Tim has confirmed the Batch stuff is working ok.