Skip to main content

Python library for post-fire assessment and wildfire analysis using Google Earth Engine.

Project description

wildfire-analyser

Python project for analyzing wildfires in natural reserves.

Installation and Usage

Follow the steps below to install and test wildfire-analyser inside an isolated environment:

mkdir /tmp/test
cd /tmp/test

python3 -m venv venv
source venv/bin/activate

pip install wildfire-analyser

Required Files Before Running the Client

Before running the client, you must prepare two items:


1. Add a GeoJSON polygon

Create a folder named polygons in the project root and place your ROI polygon file inside it:

/tmp/test/
├── polygons/
│   └── your_polygon.geojson
└── venv/

An example GeoJSON file is available in the repository.


2. Create the .env file with GEE authentication data

In the project root, add a .env file containing your Google Earth Engine authentication variables.

A .env template is also available in the GitHub repository.

/tmp/test/
├── .env
├── polygons/
└── venv/

Running the Client

After adding the .env file and your GeoJSON polygon:

python3 -m wildfire_analyser.client \
   --roi polygons/canakkale_aoi_1.geojson \
   --start-date 2023-07-01 \
   --end-date 2023-07-21 \
   --deliverables-all \
   --days-before-after 1

Possible options for --deliverables are: RGB_PRE_FIRE, RGB_POST_FIRE, NDVI_PRE_FIRE, NDVI_POST_FIRE, NBR_PRE_FIRE, NBR_POST_FIRE, DNDVI, DNBR, RBR, BURN_SEVERITY_MAP, RGB_PRE_FIRE_VISUAL, RGB_POST_FIRE_VISUAL, DNBR_VISUAL, RBR_VISUAL, BURN_SEVERITY_VISUAL, BURNED_AREA_STATISTICS,

This will start the analysis process, generate visual thumbnail links for use by the frontend, and save the scientific GeoTIFF images to the GCP bucket. All links will be displayed in the terminal.

for help, type:

python3 -m wildfire_analyser.client --help

You should see something like this:

usage: client.py [-h] --roi ROI --start-date START_DATE --end-date END_DATE
                 [--deliverables DELIVERABLES [DELIVERABLES ...]] [--deliverables-all]
                 [--days-before-after DAYS_BEFORE_AFTER]

Post-fire assessment using Google Earth Engine

options:
  -h, --help            show this help message and exit
  --roi ROI             Path to ROI GeoJSON file
  --start-date START_DATE
                        Start date (pre-fire) in YYYY-MM-DD format
  --end-date END_DATE   End date (post-fire) in YYYY-MM-DD format
  --deliverables DELIVERABLES [DELIVERABLES ...]
                        List of deliverables to generate. Example: --deliverables RGB_PRE_FIRE DNBR
  --deliverables-all    Generate all available deliverables
  --days-before-after DAYS_BEFORE_AFTER
                        Number of days before and after the event date to search imagery (default: 30)

Setup Instructions for Developers

  1. Clone the repository
git clone git@github.com:camargo-advanced/wildfire-analyser.git
cd wildfire-analyser
  1. Create a virtual environment
python3 -m venv venv
  1. Activate the virtual environment
source venv/bin/activate
  1. Install dependencies Make sure the virtual environment is activated, then run:
pip install -r requirements.txt
  1. Configure environment variables Copy your version of .env file to the root folder with your GEE authentication credentials. A template file .env.template is provided as an example.

  2. Run the sample client application

python3 -m wildfire_analyser.client \
   --roi polygons/canakkale_aoi_1.geojson \
   --start-date 2023-07-01 \
   --end-date 2023-07-21 \
   --deliverables-all \
   --days-before-after 1

Useful Commands

  • Deactivate the virtual environment:
deactivate
  • **Build a new PyPi lib and publish **:
rm -rf dist/*
python -m build
twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wildfire_analyser-0.2.6.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wildfire_analyser-0.2.6-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file wildfire_analyser-0.2.6.tar.gz.

File metadata

  • Download URL: wildfire_analyser-0.2.6.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for wildfire_analyser-0.2.6.tar.gz
Algorithm Hash digest
SHA256 cf7d76a134308ade798b73727463654fcd16ff8c453f61a1609cd2f5164e8edb
MD5 5f28ea583013ad438ad5a42c2536cce0
BLAKE2b-256 66ecf41ea4e87eea63982660242f3e635c335826f68e4df263034dd5bc8107b6

See more details on using hashes here.

File details

Details for the file wildfire_analyser-0.2.6-py3-none-any.whl.

File metadata

File hashes

Hashes for wildfire_analyser-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b67e1d8dbd7c1294b2e908c5f9bb8fcbbc09dd81d06bf0ed213cd28ac11ce974
MD5 e3fbe0cabd6347d528b372232d337525
BLAKE2b-256 38652013cf9719cd8bcbaeba67a6609f57638508b69f9939a8772017968ccbdd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page