Pyretechnics
Provides modules that implement the fundamental equations used in most operational wildland fire behavior models like GridFire, ELMFIRE, FlamMap, FARSITE, FSIM, and BehavePlus.
https://github.com/pyregence/pyretechnics
Category: Biosphere
Sub Category: Wildfire
Last synced: about 11 hours ago
JSON representation
Repository metadata
A new, more scriptable fire model
- Host: GitHub
- URL: https://github.com/pyregence/pyretechnics
- Owner: pyregence
- License: epl-2.0
- Created: 2023-12-05T17:45:13.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2026-05-05T14:25:10.000Z (7 days ago)
- Last Synced: 2026-05-07T09:05:29.824Z (6 days ago)
- Language: HTML
- Size: 17.3 MB
- Stars: 12
- Watchers: 5
- Forks: 0
- Open Issues: 4
- Releases: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
README.md
Pyretechnics
A Python library for simulating fire behavior in a variety of ways.
Latest API Documentation: https://pyregence.github.io/pyretechnics/
Conda installation instructions: https://www.anaconda.com/docs/tools/working-with-conda/packages/pip-install
Overview
The Pyretechnics library provides modules that implement the fundamental equations used in most operational wildland fire behavior models like GridFire, ELMFIRE, FlamMap, FARSITE, FSIM, and BehavePlus. These fall into the following categories:
- pyretechnics.fuel_models: Fuel Model and Moisture Definitions
- pyretechnics.surface_fire: Surface Fire Equations
- pyretechnics.crown_fire: Crown Fire Equations
- pyretechnics.spot_fire: Spot Fire Equations
- pyretechnics.burn_cells: Burning Cells on a Grid
- pyretechnics.eulerian_level_set: Fire Spread Algorithm (ELMFIRE)
In addition, it provides a module for unifying 0D (constant), 1D (temporal), 2D (spatial), and 3D (spatiotemporal) input datasets (of potentially different resolutions) for fuels, topography, wind, and moisture called pyretechnics.space_time_cube.
The user of this library simply loads in their input datasets as Numpy arrays, wraps them in SpaceTimeCube objects to make all of their dimensions and resolutions match, and feeds them into the functions for burning cells (pyretechnics.burn_cells) or spreading a fire from a point or existing burn scar (pyretechnics.eulerian_level_set).
The cell-burning functions will return the fire behavior metrics for the burned cell (i.e., fire type, spread rate, spread direction, fireline intensity, flame length) as a Python dictionary. The fire spreading functions return a dictionary containing these same metrics (+ time of arrival) in Numpy arrays, covering the simulation area.
Since the library's main functions take and return Numpy arrays, you are free to create them as needed for your own projects. You can load arrays from numerous geospatial file formats using the Python rasterio library. You could grab data from a PostGIS raster using psycopg2 or load in NetCDF files with the netCDF4 library. You could also create your own arrays using Numpy or Scipy functions based on your needs. And, of course, you could use these same libraries to apply random noise, value perturbations, or other preprocessing steps on the arrays before initiating fire spread simulations.
Similary, you can use any Python library or algorithm to post-process the output arrays into aggregate arrays (e.g., annual/conditional burn frequency), visualize them (e.g., with matplotlib), and/or write them out as raster files, CSVs, or any other format that you can think of.
Notably, Pyretechnics is written as a Literate Program, which you can read online here: https://pyregence.github.io/pyretechnics
Each module has its own dedicated chapter, with two subsections:
- For Developers
- For Users
The For Developers sections are the literate programming implementation of the equations and algorithms included in that module. Read these sections if you want to understand the science and engineering behind that module.
The For Users sections are notebook programming examples of how to use the public functions in each module along with their computed outputs. If you just want to use the Pyretechnics library, you can jump to these sections and cut-and-paste the example scripts into your own Python file or Jupyter notebook to get yourself going quickly.
Design Principles
Free and Open Source Software
To promote open review and encourage collaborative development of the
various algorithms implemented in Pyretechnics, this library is
released under a free and open source license. See the
License section in this document for more information.
Reproducible Research
One of the most persistently challenging aspects of software
development is the fact that the environments in which software is
built vary from one person's computer to another, including but not
limited to different types and versions of operating systems,
applications, libraries, and services installed. Since most software,
including Pyretechnics, is written so as to rely on external libraries
and applications at both build and run time, it is necessary to be
able to easily reproduce the computer environments needed for these
steps on new users' machines.
To do so, Pyretechnics uses GNU Guix to
automatically install software dependencies and create ephemeral
development environments without requiring root privileges or
interfering with the main package manager of the underlying operating
system.
If you are running a GNU/Linux distribution on your computer, the
easiest way to install Guix is to simply follow the "Binary
Installation" instructions in the manual here:
https://guix.gnu.org/manual/en/html_node/Binary-Installation.html
This will add the guix command as an auxiliary package, environment,
and container manager on your machine.
If you are not running GNU/Linux, you will need to run Guix System in
a virtual machine. This is a complete GNU/Linux distribution that uses
Guix as its package manager and Shepherd as its service manager. You
can find instructions on getting this installed and running through
QEMU in the "Running Guix in a Virtual Machine" section of the Guix
manual here:
https://guix.gnu.org/manual/en/html_node/Running-Guix-in-a-VM.html
-
Creating a Reproducible Development Environment
Once installed, you can tell Guix to download all the necessary
dependencies for Pyretechnics development and enter a shell in
which they are available by running this command from the root
directory of this repository:./make.sh shellOn its first invocation, this command will download the necessary
software packages and install them under/gnu/store. When this
is done, you will be dropped into a shell environment in which the
environment variables have been automatically configured to point
to these newly downloaded packages.On subsequent calls to
./make.sh shell, you should be dropped
directly into the shell environment without the need to install
any new software unless the guix.scm or
channels.scm files have been updated. -
Authorizing Guix to Automatically Read guix.scm
The first time that you run
./make.sh shell, you will be
prompted to authorize Guix to read the guix.scm file
in this repository for instructions on what to download and how to
set up your ephemeral shell environment. Assuming you have set the
PYRETECHNICS_REPOshell variable to the directory containing
this repository, you can do so with this command:echo $PYRETECHNICS_REPO >> $HOME/.config/guix/shell-authorized-directories -
Exiting the Reproducible Development Environment
You can always exit from the shell with this command:
exit -
Running the Test Suite
You can run the Pyretechnics library's test suite by invoking
pytestthrough the Guix shell like so:./make.sh test -
Building the Pyretechnics Library with Guix
To build the Pyretechnics library, including running its tests,
constructing a Python wheel, and unpacking it into the Guix
/gnu/store directory, simply run this command:./make.sh build-guix -
Building the Pyretechnics Library as a Distribution
To create a dist folder containing source (.tar.gz) and built (.whl)
distributions of the Pyretechnics library, you can run this command:./make.sh build-dist -
Uploading the Built Distribution to TestPyPI
To upload the built distribution to
TestPyPI, you can use this command:./make.sh upload-testpypiYou will be prompted for a username and password. For the
username, use__token__. For the password, use the TestPyPI API
token value that you created
here, including the
pypi-prefix. -
Uploading the Built Distribution to PyPI
To upload the built distribution to PyPI, you
can use this command:./make.sh upload-pypiYou will be prompted for a username and password. For the
username, use__token__. For the password, use the PyPI API
token value that you created
here, including the
pypi-prefix. -
Installing the Pyretechnics Library with Guix
You have two options for installing the Pyretechnics library locally:
First, you can simply install it into a temporary shell
environment like so:./make.sh install-shellYou can leave this shell by typing
exit.Your second option is to install the Pyretechnics library into
your Guix profile with this command:./make.sh install-guixNext, you will need to invoke the following Bash commands in your
shell to make the newly installed library available via
$GUIX_PYTHONPATH. This environment variable is referenced
automatically by the Guix-installed Python package.GUIX_PROFILE="$HOME/.guix-profile" . "$GUIX_PROFILE/etc/profile"It is recommended that you add these two lines to your
$HOME/.bash_profile, so that they are run automatically each
time you login. -
Using the Pyretechnics Library
Once you have installed the library into a temporary shell
environment, installed it into your Guix profile, or downloaded it
from PyPI, you should be able to launch
pythonand load the library as follows:import pyretechnics
Literate Programming
Pyretechnics has been coded as a literate
program using
Emacs' org-mode. This
means that its source code is embedded within a larger document, which
explains the rationale behind the code using text, equations,
citations, tables, and figures. The reason for this approach is to
make the science and engineering decisions within Pyretechnics fully
transparent to our users, whether or not they feel confident reading
source code directly. We believe that this better promotes the goals
of open science than open source software alone.
What this means practically is that the org directory in this
software repository contains a single literate program document called
org/pyretechnics.org, which is used to
automatically generate all of the other source code and documentation
files within this repository.
-
Regenerating HTML Documentation
The latest HTML documentation can always be found in
docs/index.html.After editing org/pyretechnics.org, you can
regenerate the HTML documentation by running this command:./make.sh weave -
Regenerating the Source Code Tree
After editing org/pyretechnics.org, you can
regenerate all the source code files in this repository by running
this command:./make.sh tangle -
Bringing Source Code File Edits Back into the Literate Program
If you edit a source code file directly, its changes can be
automatically incorporated back into the literate program by
running this command:./make.sh detangle -
Running All the Source Code Blocks in the Literate Program
If your changes would impact the results of the example code
blocks in the literate program, then you can run them again to
update their results in
org/pyretechnics.org with this command:./make.sh org-eval
Contact
Authors
-
Gary W. Johnson, PhD
- Email: gjohnson@sig-gis.com
- Web: https://sig-gis.com
-
Valentin Waeselynck
- Email: vwaeselynck@sig-gis.com
- Web: https://sig-gis.com
-
Chris Lautenberger, PhD, PE
- Email: chris@cloudfire.com
- Web: https://cloudfire.com
-
David Saah, PhD
- Email: dsaah@sig-gis.com
- Web: https://sig-gis.com
License
Copyright © 2023-2026 Spatial Informatics Group, LLC.
Pyretechnics is distributed by Spatial Informatics Group, LLC. under
the terms of the Eclipse Public License version 2.0 (EPLv2). See
LICENSE in this directory for more information.
Owner metadata
- Name: pyregence.org
- Login: pyregence
- Email: dssaah@usfca.edu
- Kind: organization
- Description: EPIC: Open Fire Modeling Environment
- Website: https://pyregence.org
- Location: San Francisco, CA USA
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/61761393?v=4
- Repositories: 1
- Last ynced at: 2023-06-28T20:27:20.472Z
- Profile URL: https://github.com/pyregence
GitHub Events
Total
- Delete event: 12
- Pull request event: 7
- Issues event: 1
- Watch event: 6
- Issue comment event: 5
- Public event: 1
- Push event: 264
- Create event: 21
Last Year
- Pull request event: 2
- Issues event: 1
- Watch event: 1
- Issue comment event: 4
- Push event: 29
- Create event: 2
Committers metadata
Last synced: 4 days ago
Total Commits: 769
Total Committers: 5
Avg Commits per committer: 153.8
Development Distribution Score (DDS): 0.082
Commits in past year: 57
Committers in past year: 1
Avg Commits per committer in past year: 57.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| Gary Johnson | l****c@d****g | 706 |
| Ubuntu | u****u@i****l | 35 |
| Valentin Waeselynck | v****k@g****m | 23 |
| Valentin Waeselynck | v****l@g****m | 4 |
| Gary Johnson | g****n@s****m | 1 |
Committer domains:
- sig-gis.com: 1
- goshawk.sig.sig-gis.com: 1
- ip-172-31-45-92.eu-north-1.compute.internal: 1
- disroot.org: 1
Issue and Pull Request metadata
Last synced: 8 months ago
Total issues: 1
Total pull requests: 5
Average time to close issues: N/A
Average time to close pull requests: 3 months
Total issue authors: 1
Total pull request authors: 2
Average comments per issue: 0.0
Average comments per pull request: 0.0
Merged pull request: 1
Bot issues: 0
Bot pull requests: 0
Past year issues: 1
Past year pull requests: 4
Past year average time to close issues: N/A
Past year average time to close pull requests: 10 days
Past year issue authors: 1
Past year pull request authors: 2
Past year average comments per issue: 0.0
Past year average comments per pull request: 0.0
Past year merged pull request: 1
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- mengsig (1)
Top Pull Request Authors
- vvvvalvalval (4)
- mengsig (1)
Top Issue Labels
Top Pull Request Labels
Package metadata
- Total packages: 1
-
Total downloads:
- pypi: 517 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 13
- Total maintainers: 1
pypi.org: pyretechnics
A Python library for simulating fire behavior in a variety of ways.
- Homepage: https://pyregence.github.io/pyretechnics/
- Documentation: https://pyregence.github.io/pyretechnics/
- Licenses: epl-2.0
- Latest release: 2026.3.25 (published about 2 months ago)
- Last Synced: 2026-05-09T12:20:08.056Z (3 days ago)
- Versions: 13
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 517 Last month
-
Rankings:
- Dependent packages count: 10.111%
- Average: 33.508%
- Dependent repos count: 56.905%
- Maintainers (1)
Dependencies
- hatchling *
- matplotlib *
- numpy *
- pytest *
- rasterio *
- twine *
- hatchling ==1.14.0
- matplotlib ==3.8.2
- numpy ==1.23.2
- pytest ==8.2.2
- rasterio ==1.3.7
- twine ==5.1.1
Score: 10.632001876933364