Skip to main content

spectral-recovery

:artificial_satellite::evergreen_tree::chart_with_upwards_trend: supporting ecosystem restoration through spectral recovery analysis :chart_with_upwards_trend::evergreen_tree::artificial_satellite:

tests PyPI version Binder Code style: black


Github: https://github.com/PEOPLE-ER/spectral-recovery/

Documentation: https://people-er.github.io/spectral-recovery/

PyPi: https://pypi.org/project/spectral-recovery/

Overview

spectral-recovery is an open-source project and Python package that provides simple, centralized, and reproducible methods for performing spectral recovery analysis to support Ecosystem Restoration (ER) efforts in forested ecosystems.

The package provides straight-forward interfaces and supplementary documentation to encourage the use of well-founded remote sensing techniques in ER research and projects. To get started, users provide restoration site locations, the years of disturbance and restoration, and annual composites of spectral data. spectral-recovery handles the rest!

See Quick Start or our interactive notebooks to dive right in, (in-progress) tutorials for detailed instructions, or the theoretical basis for in-depth information.

Installation

pip install spectral-recovery

Quick Start

import spectral_recovery as sr
from spectral_recovery import data

# Read in timeseries data
spectral_ts = sr.read_timeseries(
    path_to_tifs=data.bc06_wildfire_landsat_bap_timeseries(),
    band_names={1: "blue", 2: "green", 3: "red", 4: "nir", 5: "swir16", 6: "swir22"},
)
# Compute indices
index_ts = sr.compute_indices(
    timeseries_data=spectral_ts,
    indices=["NBR", "NDVI"],
)
# Read in restoration site(s)
rest_site = sr.read_restoration_sites(
    path=data.bc06_wildfire_restoration_site(),
    dist_rest_years={0: [2005, 2006]},
)
# Compute recovery target for restoration site
median_hist = sr.recovery_targets.historic.median(
    timeseries_data=index_ts,
    restoration_sites=rest_site,
    reference_start=2003,
    reference_end=2005,
    scale="pixel",
)
# Compute recovery metrics for restoration site!
metrics = sr.compute_metrics(
    metrics=["Y2R", "R80P", "YrYr", "deltaIR", "RRI"],
    timeseries_data=index_ts,
    restoration_sites=rest_site,
    recovery_targets=median_hist,
)
# Inspect recovery metrics for the restoration site (site 0)
# e.g what is the site's mean R80P (porportion of 80% of the recovery target)?:
metrics[0].sel(metric="R80P").mean().compute()
# Or, write results out to a TIF:
metrics[0].sel(metric="Y2R").rio.to_raster("site0_y2r.tif")

Documentation

  • View background information, static tutorials, and API references in our project documentation.
  • Try out an interactive notebook: Binder

Contributing

  • Report bugs, suggest features, and see what others are saying on our GitHub Issues page.
  • Start discussions about the tool on our discussion page.
  • Want to contribute code? See our CONTRIBUTING document for more information.

How to Cite

Publication in progress. For now, when using this tool in your work we ask that you acknowledge as follows:

"spectral-recovery method developed in the PEOPLE-ER Project, managed by Hatfield Consultants, and financed by the European Space Agency."

License

Copyright 2023 Hatfield Consultants LLP

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Metadata

Release files for spectral-recovery 1.0.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 spectral-recovery 1.0.1
File Size Uploaded Provenance
spectral_recovery-1.0.1.tar.gz 820.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for spectral-recovery 1.0.1
File Interpreter ABI Platform
spectral_recovery-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 1.6 MB

Release files / spectral_recovery-1.0.1.tar.gz

Download URL spectral_recovery-1.0.1.tar.gz
Size 820.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e4cc6ddd4810e5fcd2251e61c1c8c4aca8f52666d562934bb10727fb31238f05
BLAKE2b-256 checksum
How to use checksums
dda62c19a61401a02f83e7f66df111b3c021d4064eaaa7c47494b42aaec02ac1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.10

Release files / spectral_recovery-1.0.1-py3-none-any.whl

Download URL spectral_recovery-1.0.1-py3-none-any.whl
Size 819.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa66f4935390f47538382d2f306aa3f149ee19e5cb714ea1840b77ba6f01859c
BLAKE2b-256 checksum
How to use checksums
f900f62937507b09b13697cdc231249b7d390de467f5fea9e2cb30e2adedbee4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.10

Security for spectral-recovery 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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