Changelog
May 2, 2026 · View on GitHub
All notable changes to MultiClean are documented here.
Unreleased
0.3.0 - 2026-05-02
Changed
- Performance.
clean_arrayis substantially faster on multi-class inputs. On a 15669×18633 / 147-class land-use raster, end-to-end runtime dropped from ~85 s to ~40 s. On the 8011×7901 / 4-class Landsat cloud-and-shadow example, runtime dropped from ~2.5 s to ~1.1 s. Wins came from:- Replacing the float32 smoothed-labels buffer with a
uint8/uint16class-code array (selected automatically based on class count). The per-class equality scan is 2-4× cheaper in memory bandwidth. - Combining per-class small-island masks in flight instead of accumulating all K of them first.
- Filling invalid pixels in place rather than allocating a copy.
- Replacing
scipy.ndimage.distance_transform_edtwithcv2.distanceTransformWithLabelsfor the nearest-valid fill (~3.4× faster on the fill stage). Both algorithms produce mathematically equivalent output (the same minimum L2 distance); they differ only in which equidistant source pixel wins a tie.
- Replacing the float32 smoothed-labels buffer with a
- dtype preservation. The output now strictly matches the input dtype.
Previously the pipeline routed everything through float32 internally,
which silently downcast
float64inputs and roundedint32values larger than 2²⁴ (andint64values larger than 2⁵³).
Fixed
- All-NaN float input with
fill_nan=Truenow deterministically returns an all-NaN array. The previous code relied on whatever valuenp.emptyhappened to leave in the sentinel slot. - Large integer class values (
int32> 2²⁴,int64> 2⁵³) are now preserved bit-exactly, instead of being silently rounded by the internal float32 round-trip.
Removed
- Dropped the
scipyruntime dependency.cv2(already a runtime dependency) now handles the distance-transform fill.
0.2.0 - 2025-09-03
Added
fill_nanoption onclean_array: whenTrue, NaN values in float input arrays are filled from the nearest valid pixel rather than preserved as nodata.
0.1.0 - 2025-09-02
Added
- Initial public release.
clean_arrayAPI for morphological cleaning of multi-class 2D arrays: per-class edge smoothing (morphological opening), per-class small-island removal (connected components), and gap filling using nearest-valid via Euclidean distance transform.- Documentation: README, two example notebooks (land use, cloud shadow), and a Google Colab tutorial notebook.