Skip to main content

Algorithms and tools python package for Forest Fire Research, Management and Analytics

Project description

Friendly graphical user interface click here

PyPI workflow auto pdoc workflow PyPI Version Python Versions License Downloads Code Style

fire2a-lib python package

Fire Advanced Analyitics research group scriptable knowledge base

  • Novel Algorithms related to landscape risk metrics, spatial decision optimization models, etc.
  • (Cell2) Fire (W) Simulator integration algorithms to facilitating placing firebreaks, measuring forest fire impacts, etc.
  • (Q)GIS algorithms to common tasks related to rasters, polygons, spatial clustering, etc.

Quickstart

Simplest: Use within QGIS

  1. Install QGIS
  2. Open QGIS Python Console
  3. Type (to install)::
!pip install fire2a-lib
  1. Visit fire2a-lib documentation, example:
from fire2a.downstream_protection_value import digraph_from_messages
digraph = digraph_from_messages('messages01.csv')

Command line usage

  1. Install QGIS
  • Docker users check qgis container
  • Linux developers could skip QGIS by apt install python3-gdal gdal-bin
  1. Use python from the terminal
  • Windows: Open OsGeo4W Shell app, python is available
  • MacOS: Open terminal app, use this /Applications/QGIS.app/Contents/MacOS/bin/python (see creating an alias below)
  • Linux: Do a system site packages aware python virtual environment python3 -m venv --system-site-packages qgis_venv
  1. Install
python -m pip install fire2a-lib
  1. Visit fire2a-lib documentation, example:
python -m fire2a.cell2fire -vvv --base-raster ../fuels.asc --authid EPSG:25831 --scar-sample Grids/Grids2/F
orestGrid03.csv --scar-poly propagation_scars.shp --burn-prob burn_probability.tif

Scripting tips

  • Check standalone scripting for more info on initializing a headless QGIS environment
  • Usage examples
  • Microsoft users check this VSCode integration
  • macOS users add a permanent alias, on the terminal app
echo "alias pythonq='/Applications/QGIS.app/Contents/MacOS/bin/python'" >> ~/.zshrc

Interactive

  • debbuging:
breakpoint()
from IPython import embed
embed()
  • sessions, with: IPython, qtconsole, jupyter-lab, or IPyConsole (QGIS plugin) compatible
# Interactive explore from IPython
In [1]: from fire2a.<press-tab>

# Select and Copy a whole module from line 1 up -but not included- to 'def main def main(argv=None):' line 
In [2]: %paste

# Choose your args 
In [3]: args = arg_parser.parse_args(['-vvv', '--base-raster', ...
# Skip:
    if argv is sys.argv:
        argv = sys.argv[1:]
    args = arg_parser(argv)

# Ready

Contributing

Building

Code of Conduct

Everyone interacting in the project's codebases, issue trackers, chat rooms, and fora is expected to follow the PSF Code of Conduct.

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

fire2a_lib-0.2.7.tar.gz (56.2 kB view hashes)

Uploaded Source

Built Distribution

fire2a_lib-0.2.7-py3-none-any.whl (57.5 kB view hashes)

Uploaded Python 3

Supported by

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