Algorithms and tools python package for Forest Fire Research, Management and Analytics
Project description
Welcome to Fire2a research group algorithms and tools python package.
Novel Algorithms to calculate metrics, clustering, placing firebreaks, measuring forest fire impacts, etc.
Tools related to GIS, graphs, optimization, etc.
Documentation
User: https://fire2a.github.io/fire2a-lib
All our releases: https://fire2a.github.io/docs
About us: https://www.fire2a.com
Developers: template package tutorial or https://github.com/fdobad/template-python-package
Quickstart
-
Installing QGIS, cover most of our requirements.txt.
-
Activate QGIS python environment:
Windows users runpython-qgis-cmd.bat
in acmd terminal
. more info.
Linux users: just launch QGIS from a venv activated terminal. -
Install
(qgis_python_venv) $ pip install git+https://github.com/fire2a/fire2a-lib.git
(qgis_python_venv) $ pip install -r requirements.txt
- Use Any language-server-protocol enabled environment is recommended:
(qgis_python_venv) $ ipython
In [1]: from fire2a.<press-tab-to-continue>
On your project: append to requirements.txt
Choose latest, branch, tag or commit
# latest main
fire2a-lib @ git+https://github.com/fire2a/fire2a-lib.git
# latest branch
fire2a-lib @ git+https://github.com/fire2a/fire2a-lib.git@branch
# tag
fire2a-lib @ git+https://github.com/fire2a/fire2a-lib.git@v1.2.3
# commit
fire2a-lib @ git+https://github.com/fire2a/fire2a-lib.git@e855bdb96202db42dc9013ea5c5cf934cee3f8d1
This is a developing repo, anchor your code to a commit to disable any incoming (possibly breaking) changes.
Development Setup
Fork it before cloning to contribute!
git clone git@github.com:fire2a/fire2a-lib.git
cd fire2a-lib
git checkout -b my_branch
# choose your hook [if any, very optional]
cp hooks/* .git/hooks/.
chmod u+x .git/hooks/pre-commit .git/hooks/pre-push
#
## activate QGIS python environment (check next paragraph)
#
pip install -r requirements.dev.txt
pip install --editable .
pdoc --html --http : --config latex_math=True fire2a
Watch out! GDAL is not listed on requirements! The easiest way is to install QGIS, then:
Linux users should make a venv with the --system-site-packages
flag
Windows + VSCode users: this repo includes .vscode\settings.json
that automates enabling the environment by calling python-qgis-cmd.bat
, so they should:
- (all users will be affected) Make their QGIS python env writable
- Open this repo folder as new window
- (Ctrl+Shift+P) 'Python: Select Interpreter' > ... Select interpreter path: C:\Program Files\QGIS 3.32.2\apps\Python\python.exe
- (Ctrl+Shift+P) 'Python: Create Terminal' enables the environment, now you can pip install!
- Bewate: git push only works from the terminal! Not the buttons!
- Also, selecting code and pressing Shift+Enter executes it on the python terminal.
A nice trick is exiting python and then opening ipython
Then select, send with 'Shift+Enter', then Ctrl+` to switch between code and terminal windows
Live view a single installed package
pip install --requirement requirements.doc.txt
pip install --editable .
pdoc --html --http : --config latex_math=True <fire2 package name>
Packages are directories under src
with at least a __init__.py
file inside
Build the full static webpage
if directory exists remove, then build
if [ -d doc/fire2a-lib ]; then
rm -r doc/fire2a-lib
fi
pdoc --html --force --output-dir doc --filter=src,tests --config latex_math=True .
Build and versioning
# clean (-n is dry-run, remove to delete)
git clean -dfX -n
# tag
git tag -a v1.2.3 -m 'message'
git push origin v1.2.3
# view calculated version to check is not dirty
python -m setuptools_scm
# build : creates `dist` with .whl & tar.gz files
python -m build
Uninstall
pip uninstall fire2a-lib
Troubleshoot
- Can't commit or push, some deleted file is messing git up: Temporarily delete .git/hooks/pre-commit and/or .git/hooks/pre-push; restore them when wanting to publish another webpage
Coding style
Here
TL;DR: Use black formatter, pytests; write standard docstrings and avoid needless complexity.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for fire2a_lib-0.2.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e7f2c89956a8b71f5f3f4010c67a2236f6e82a4115e7f2f729ff3f325da1d13 |
|
MD5 | 4071f0449a7265e1a66880c0666cc711 |
|
BLAKE2b-256 | 2616303f15d439fac57680c2bfb2172c1ae558bacdb299390139ad6ffea1fb02 |