File size: 884 Bytes
4a3ac26
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
"""Map clearing in a small area from Python (Brigalow, a model that maps woody-vegetation clearing in Queensland).
Needs the weights (a model directory with model.json, or a .onnx file). The Queensland mask layers come from the public
mirror (-1/Brigalow-QLD-inputs) by default, no key needed; tern_root="DIR" uses local files instead. If the masks
cannot be read the run is Sentinel-2 only, and it says so."""
import geopandas as gpd, rasterio
from brigalow.cli import predict_area

run = predict_area((146.60, -22.70, 146.65, -22.65), 2025, "out_2025", weights="weights/brigalow")
alerts = gpd.read_file("out_2025/alerts.gpkg")                    # EPSG:4326, one row per alert
print(alerts.groupby("confidence").area_ha.agg(["count", "sum"]))
with rasterio.open("out_2025/probability.tif") as src:
    prob = src.read(1, masked=True) / 250.0                        # 255 = no data