This module has functions to generate the burned areas predictions for near real time operational applications.

class RunManager[source]

RunManager(project_path:ProjectPath, region, time='today', product:str='VIIRS750', days=64)

RunManager.check_data[source]

RunManager.check_data()

Check existing and missing files in dataset folder.

RunManager.check_data[source]

RunManager.check_data()

Check existing and missing files in dataset folder.

RunManager.update_hotspots[source]

RunManager.update_hotspots(location, mode='7d', save=True)

Update hotspots file with new data. location is according to the data url naming format mode can be on of: 24h, 48h, 7d

RunManager.download_viirs[source]

RunManager.download_viirs()

Download viirs data needed for the dataset.

RunManager.preprocess_dataset[source]

RunManager.preprocess_dataset(max_size=None, max_workers=1, times=None)

RunManager.init_model_weights[source]

RunManager.init_model_weights(weight_files:list)

Downloads model weights if they don't exist yet on config directory.

RunManager.get_preds[source]

RunManager.get_preds(weight_files:list, threshold=0.5, save=True, max_size=2000)

Computes BA-Net predictions ensembling the models in the weight_files list.

RunManager.postprocess[source]

RunManager.postprocess(filename, threshold=0.5, interval_days=2, interval_pixels=2, min_size_pixels=25, area_epsg=None, keys=['burned', 'date'], geotiff_only=False, padding=1)

Computes tifs and shapefiles from outputs.

paths = ProjectPath('data')
manager = RunManager(paths, 'PI')
df = manager.update_hotspots('Europe', save=False)
plt.scatter(df.longitude, df.latitude);

The hotspots_region name should be defined according with the image bellow. Names with multiple words use _ in place of the spaces. More info here: https://firms.modaps.eosdis.nasa.gov/active_fire/#firms-txt

IPython.display.Image(url="https://firms.modaps.eosdis.nasa.gov/images/Regions_500px.jpg")

Running all processes looks like this:

region  = 'PI'
hotspots_region = 'Europe'
paths = ProjectPath('../hide/nrt_test')
weight_files = ['banetv0.20-val2017-fold0.pth', 
                'banetv0.20-val2017-fold1.pth',
                'banetv0.20-val2017-fold2.pth']
manager = RunManager(paths, region)
manager.update_hotspots(hotspots_region)
manager.download_viirs()
manager.preprocess_dataset()
manager.get_preds(weight_files)
manager.postprocess(filename=f'ba_{manager.time.strftime("%Y%m%d")}', 
                    threshold=0.5, area_epsg=3763)

You can easily run all this process using the console script banet_nrt_run.