Skip to main content

Spatial raster prediction with scikit-learn estimators.

Project description

sklearn-raster

PyPI version Build status Documentation status

⚠️ WARNING: sklearn-raster is in active development! ⚠️

sklearn-raster extends scikit-learn and other compatible estimators to work directly with raster data. This allows you to train models with tabular data and predict raster outputs directly while preserving metadata like spatial references, band names, and NoData masks.

Features

  • ⚡ Parallelized functions + larger-than-memory data using Dask
  • 🌐 Automatic handling of spatial references, band names, and masks
  • 🔢 Support for n-dimensional feature arrays, e.g. time series rasters

Quick-Start

  1. Install optional dependencies for loading data and plotting results:

    pip install "sklearn-raster[tutorials]"
    
  2. Wrap a scikit-learn estimator with a FeatureArrayEstimator to enable raster-based predictions:

    from sklearn.ensemble import RandomForestRegressor
    from sklearn_raster import FeatureArrayEstimator
    
    est = FeatureArrayEstimator(RandomForestRegressor())
    
  3. Load a custom dataset of features and targets and fit the wrapped estimator:

    from sklearn_raster.datasets import load_swo_ecoplot
    
    X_image, X, y = load_swo_ecoplot(as_dataset=True)
    est.fit(X, y)
    
  4. Generate predictions from a numpy or xarray raster with predictors as bands:

    pred = est.predict(X_image)
    pred["PSME_COV"].plot()
    

Acknowledgements

Thanks to the USDA Forest Service Region 6 Ecology Team for the inclusion of the SWO Ecoplot dataset (Atzet et al., 1996). Development of this package was funded by:

  • an appointment to the United States Forest Service (USFS) Research Participation Program administered by the Oak Ridge Institute for Science and Education (ORISE) through an interagency agreement between the U.S. Department of Energy (DOE) and the U.S. Department of Agriculture (USDA).
  • a joint venture agreement between USFS Pacific Northwest Research Station and Oregon State University (agreement 19-JV-11261959-064).
  • a cost-reimbursable agreement between USFS Region 6 and Oregon State University (agreeement 21-CR-11062756-046).

References

  • Atzet, T, DE White, LA McCrimmon, PA Martinez, PR Fong, and VD Randall. 1996. Field guide to the forested plant associations of southwestern Oregon. USDA Forest Service. Pacific Northwest Region, Technical Paper R6-NR-ECOL-TP-17-96.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sklearn_raster-0.1.0.dev2.tar.gz (26.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sklearn_raster-0.1.0.dev2-py3-none-any.whl (32.3 kB view details)

Uploaded Python 3

File details

Details for the file sklearn_raster-0.1.0.dev2.tar.gz.

File metadata

  • Download URL: sklearn_raster-0.1.0.dev2.tar.gz
  • Upload date:
  • Size: 26.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sklearn_raster-0.1.0.dev2.tar.gz
Algorithm Hash digest
SHA256 3644a030aef7b7074be903615122bd14ccce34c862a30723fe918b17ebfa9745
MD5 009caf6823069d4382b7ea49c959ec69
BLAKE2b-256 57ed63f9ea1563a3906718deac78c5abcdfe17f41fceda724646087449b45115

See more details on using hashes here.

Provenance

The following attestation bundles were made for sklearn_raster-0.1.0.dev2.tar.gz:

Publisher: publish.yaml on lemma-osu/sklearn-raster

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sklearn_raster-0.1.0.dev2-py3-none-any.whl.

File metadata

File hashes

Hashes for sklearn_raster-0.1.0.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 38584c74badfb5ee2144d0504c1a985ae1971e59049c33425670c5db3c7c0e49
MD5 28a1999823fbad58f0e91bde0efd8784
BLAKE2b-256 d7da9ca1ee696f19b3eaffb6b173c0f83540df894ddafe12fae9732dc3130f66

See more details on using hashes here.

Provenance

The following attestation bundles were made for sklearn_raster-0.1.0.dev2-py3-none-any.whl:

Publisher: publish.yaml on lemma-osu/sklearn-raster

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page