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

class ProjectPath[source]

ProjectPath(path:Path, config_dir='config', ladsweb_dir='ladsweb', hotspots_dir='hotspots', dataset_dir='dataset', outputs_dir='outputs')

ProjectPath.create_dirs[source]

ProjectPath.create_dirs(paths_list)

Create directories in list.

paths = ProjectPath('data')
test_eq(sorted([o.name for o in paths.path.iterdir()]), 
        ['config', 'dataset', 'hotspots', 'ladsweb', 'outputs'])

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()

Apply pre-processing to the rawdata and saves results in dataset directory.

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)

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

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)

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