Skip to content

Deprecation warning in SDS_preprocess.py due to remove_small_objects(min_size=...) #22

Description

@2320sharon

Description

Running CoastSeg triggers repeated FutureWarning messages from coastsat/SDS_preprocess.py related to a deprecated parameter in skimage.morphology.remove_small_objects.

The warning points to:

File: coastsat/SDS_preprocess.py

Line: 973

Warning

C:\development\doodleverse\coastseg\CoastSeg\.pixi\envs\default\Lib\site-packages\coastsat\SDS_preprocess.py:973: FutureWarning: Parameter `min_size` is deprecated since version 0.26.0 and will be removed in 2.0.0 (or later). To avoid this warning, please use the parameter `max_size` instead. For more details, see the documentation of `remove_small_objects`. Note that the new threshold removes objects smaller than **or equal to** its value, while the previous parameter only removed smaller ones.
  cloud_mask = morphology.remove_small_objects(

This warning is emitted multiple times during execution.

Cause

skimage.morphology.remove_small_objects() has deprecated the min_size parameter as of scikit-image 0.26.0. The code in SDS_preprocess.py still appears to use min_size, which will eventually break once support is removed in scikit-image 2.0.0 or later.

Suggested fix

Update the call at SDS_preprocess.py:973 to use max_size instead of min_size, while preserving current behavior as closely as possible.

One thing to note from the warning:

max_size removes objects smaller than or equal to the threshold

min_size previously removed objects only smaller than the threshold

So the replacement may need an off-by-one adjustment depending on intended behavior.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions