Skip to main content

smoother.py 🧹

Spatial smoothing methods for probability maps.

Installation

To install the package, you can use pip:

pip install smoother-py

Methods available

Currently, the smoother implements the Bayes smoothing method, adapting the code from the sits R package.

Usage

First, import the package:

import smoother

Then, use the smooth function on the numpy data of your map. The smoothing method is selected with method (defaults to "bayes"), and any method-specific options are passed as keyword arguments:

smoothed = smoother.smooth(your_numpy_array)

# selecting the method explicitly and tuning it
smoothed = smoother.smooth(your_numpy_array, method="bayes", window_size=5)

You can use rasterio or other library to load the numpy array.

xarray

smooth also accepts xarray objects. To use it, first install the xarray dependencies:

pip install "smoother-py[xarray]"

Then, using your xarray data, you can call the smooth function:

# DataArray with class, y and x dimensions
smoothed = smoother.smooth(your_data_array)

# dimension names are inferred (e.g. band/class, y/latitude, x/longitude)
# you can also name them explicitly
smoothed = smoother.smooth(your_data_array, class_dim="band")

Extra dimensions (e.g. time) are smoothed per layer automatically.

Discovering the options

smoother.smooth documents every option, the smoothing parameters and the xarray-only dimension names:

help(smoother.smooth)

Development

The project uses uv to manage the development environment:

# create the environment and build/install the package
uv sync

# run the tests
uv run pytest

Learn more

The smoothing methods implemented in this package uses the approach described in the sits documentation. This method helps in refining the probability maps by considering the spatial context of each pixel.

Acknowledgments

We would like to thank the developers and contributors of the sits R package for their work on spatial smoothing methods for Earth observation data. Their comprehensive documentation and methodologies have been invaluable in the development of smoother.py.

Contributing

We welcome contributions! If you have suggestions for improvements or bug fixes, please feel free to fork the repository and submit a pull request.

License

Code is licensed under the GNU General Public License v2.0. See the LICENSE file. The bayes smooth code is ported from the sits R package.

Metadata

Release files for smoother-py 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smoother-py 0.1.1
File Size Uploaded
smoother_py-0.1.1.tar.gz 357.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for smoother-py 0.1.1
File Interpreter ABI Platform
smoother_py-0.1.1-cp312-abi3-macosx_26_0_arm64.whl CPython 3.12 abi3 macOS 26.0+ ARM64 Details

Total release size: 426.4 kB

Release files / smoother_py-0.1.1.tar.gz

Download URL smoother_py-0.1.1.tar.gz
Size 357.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c26adf1920f861df0d03f41ed77173c2d8b9a1ca8c5cfa62d510b7e14a58f9cf
BLAKE2b-256 checksum
How to use checksums
cd21b91c870f962fc088ea62cb80a2fab296968491e04c9f94b6089773c9b874
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / smoother_py-0.1.1-cp312-abi3-macosx_26_0_arm64.whl

Download URL smoother_py-0.1.1-cp312-abi3-macosx_26_0_arm64.whl
Size 68.6 kB
Tags CPython 3.12 abi3 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
1b66f70253cf43ebd1ef096c11cdb9e759785c17f1d9744425e7040e7e11dc8b
BLAKE2b-256 checksum
How to use checksums
17d10cd5296c693b7f965325a7211f51f37ebeb4ee86688581a2b282d94d108b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page