Skip to main content

hls-burn

Map burn scars from a pre-fire and a post-fire scene of NASA's Harmonized Landsat Sentinel-2 (HLS, 30 m). Scenes are searched and read from Microsoft Planetary Computer, so all you need is an area and the fire's dates.

There are three segmenters, and they all work the same way: segment() gives a class raster, polygonize() gives a GeoDataFrame.

segmenter method classes
ThresholdSegmenter thresholds on a burn index (dNBR by default) USGS-style severity, or your own bins
SklearnSegmenter bundled XGBoost model on burn indices, trained on ~1,000 US fires burned / unburned
DeepSegmenter 24M-param U-Net, trained on ~6,000 US pre/post pairs burned / unburned

Install

pip install hls-burn              # threshold + XGBoost
pip install "hls-burn[deep]"      # + U-Net (PyTorch)
pip install "hls-burn[map]"       # + polygon editor for notebooks
pip install "hls-burn[all]"

Python 3.11+.

Usage

The steps below follow examples.ipynb, which maps a February 2026 fire near Lake Okeechobee.

Get scenes

import shapely
from hls_burn.data.fire_data import HLSFireData

fire = HLSFireData()
fire.get_clearest_hls_scenes_pre_post(
    search_area=shapely.Point(-80.88, 27.11).buffer(0.1),  # lon/lat; a shapely geom or WKT
    start_date="2026-02-12",
    end_date="2026-02-15",
    pre_offset_days=30,   # search this far before start_date for a clear scene
    post_offset_days=30,  # and this far after end_date
)
fire.show_scenes()                               # true colour
fire.show_scenes(bands=("swir2", "nir", "red"))  # false colour: burns show up red

If either scene is mostly cloud, shadow or snow you get a warning.

Burn index

fire.calc_dnbr()
fire.plot_computed_index(vmin=0, vmax=0.5)

There are other indices too. Some of them need a perimeter or an unburned reference area.

Threshold segmentation

from hls_burn.segmenters.classical_segmenter import ThresholdSegmenter

seg = ThresholdSegmenter(index="dnbr")  # default bins: 6 USGS-style severity classes
seg.segment(fire)
seg.plot_segmentation()

seg.bins = (0.1,)                       # binary: dNBR > 0.1 is burned
seg.segment(fire)
seg.export_raster("mask.tif", crs=5070)

You'll usually have to tune the thresholds for each fire. The pretrained models don't need that.

Pretrained models

from hls_burn.segmenters.scikit_segmenter import SklearnSegmenter
from hls_burn.segmenters.deep_segmenter import DeepSegmenter   # needs [deep]

xgb = SklearnSegmenter()          # bundled model; or pass your own scikit-learn estimator
xgb.segment(fire)

unet = DeepSegmenter(cutoff=0.6)  # probability threshold
unet.segment(fire)
unet.plot_segmentation()

Unusable pixels (cloud, nodata) come back as 255.

Polygons

gdf = unet.polygonize()                 # one row per connected patch
gdf.explore(tiles="Esri.WorldImagery")  # it's a plain GeoDataFrame
unet.export_polygons("burned.fgb", crs=5070)

The polygons are also stored on the segmenter, and every call replaces them.

Edit polygons in a notebook ([map])

unet.edit_polygons(fire=fire, window="post")                  # false colour by default
unet.edit_polygons(fire=fire, bands=("red", "green", "blue"))

This opens a map with the scene under the polygons. You can move vertices, reshape polygons or delete them, then call export_polygons() when you're done.

Model Performance

The library currently ships with access to two pretrained models as shown above.

The XGBoost model performs better than un tuned threshholding in most cases and has an IOU of ~70%. It tends to fail in scenes where having a lot of context would be beneficial. e.g. fields. It's reliance on computed features (dnbr, rbr, etc...) also limit it. A good model, and cheap to run.

The UNET was trained on multi temporal image pairs. (3 best pairs within ~90-120 days pre/post and all thier valid permutations) It tends to perform very well and was measured with a ~90% IOU on held out fires. it was only trained on fires greater than 250 acres.

Both models used refined WFIGS permiters. by taking a rough final perimeter and refining it using dnbr we can more readily isolate the positve burn signal and reduce unburned island noise inherent in field perimeters.

License

MIT

Metadata

Release files for hls-burn 0.1.0

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

Source distribution (sdist)

Source distribution for hls-burn 0.1.0
File Size Uploaded Provenance Actions
hls_burn-0.1.0.tar.gz 341.2 kB Without provenance Details for hls_burn-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hls-burn 0.1.0
File Interpreter ABI Platform Actions
hls_burn-0.1.0-py3-none-any.whl Python 3 none any Details for hls_burn-0.1.0-py3-none-any.whl

Total release size: 694.0 kB

Release files / hls_burn-0.1.0.tar.gz

Download URL hls_burn-0.1.0.tar.gz
Size 341.2 kB
Tags Source
SHA-256 checksum
How to use checksums
43dd0add7a449aefd3983b26ba10a653d084f31b06ad2f0728ab9ef509dbfbf1
BLAKE2b-256 checksum
How to use checksums
5f0dfeb8b6ca08e1ed469450d1f91b2939c3187a8793c3e00993a12a89afd767
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / hls_burn-0.1.0-py3-none-any.whl

Download URL hls_burn-0.1.0-py3-none-any.whl
Size 352.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
77de3a26efabe8a28ff99f3ea5391bc448b0ccef810902175da2da7c21ef9184
BLAKE2b-256 checksum
How to use checksums
b1b596e84dc91d2bdb48ea6039918431139522d5249326b5906f5a58c53a9cf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Security for hls-burn 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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