fire2a-lib


Namefire2a-lib JSON
Version 0.3.3 PyPI version JSON
download
home_pageNone
SummaryAlgorithms and tools python package for Forest Fire Research, Management and Analytics
upload_time2024-11-19 17:24:30
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseGPLv3
keywords fire wildfires forest fires fire management fire analytics fire research fire modeling
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <span style="color: orange;"><strong><em><a href="https://fire2a.github.io/docs/docs/qgis-toolbox/README.html" style="color: orange;">
Friendly graphical user interface click here
</a></em></strong></span>

![PyPI workflow](https://github.com/fire2a/fire2a-lib/actions/workflows/publish-pypi.yml/badge.svg)
![auto pdoc workflow](https://github.com/fire2a/fire2a-lib/actions/workflows/auto-docs.yml/badge.svg)
![PyPI Version](https://img.shields.io/pypi/v/fire2a-lib.svg)
![Python Versions](https://img.shields.io/pypi/pyversions/fire2a-lib.svg)
![License](https://img.shields.io/github/license/fire2a/fire2a-lib.svg)
![Downloads](https://img.shields.io/pypi/dm/fire2a-lib.svg)
![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)

# 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. To install, type :
```python
!pip install fire2a-lib
```
4. Visit [fire2a-lib documentation](https://fire2a.github.io/fire2a-lib), example:
```python
from fire2a.downstream_protection_value import digraph_from_messages
digraph = digraph_from_messages('messages01.csv')
```
### Command line usage
1. Install QGIS

- 1.A. [Simple](https://qgis.org/download/)
- 1.B. Docker users check [qgis container](https://hub.docker.com/r/qgis/qgis)
- __Optional but worth it for Windows:__ Make QGIS's bundled python folder writable by your user
   - Three alternatives:
   - A. Open File Explorer, go to `C:\Program Files\QGIS 3.38.3\apps`, right-click `Python312` folder [Show more options]\Properties\Security\Edit\Allow Full control\OK
   - B. Open cmd administrator terminal, type:
     ```
     icacls "C:\Program Files\QGIS 3.38.3\apps\Python312" /grant %username%:F /T
     ```

     
2. Locate python, prepare environment

- 2.A. Windows
   - Open `OsGeo4W Shell` application, 
   - Run `bin\python-qgis.bat` once to configure all environment variables in the current session.
   - Also you could: `bin\python-qgis.bat your_script.py`
   - Recommended persistent [integration](https://github.com/fire2a/fire2a-lib/blob/main/qgis-launchers/README.md)
- 2.B. macOS 
   - Open terminal application, 
   - Use this python: `/Applications/QGIS.app/Contents/MacOS/bin/python` (see creating an alias below)
   - TODO: are all environment variables right?
- 2.C. Linux
   ```
   python3 -m venv --system-site-packages qgis_venv
   source qgis_venv/bin/activate
   ```
3. Install
```bash
python -m pip install fire2a-lib
# also recommended for development: ipython qtconsole jupyterlab
```
4. Visit [fire2a-lib documentation](https://fire2a.github.io/fire2a-lib), example for getting the burn probability from a simulator results directory:
```bash
python -m fire2a.cell2fire -vvv --base-raster ../fuels.asc --authid EPSG:25831 --scar-sample Grids/Grids2/ForestGrid03.csv --scar-poly propagation_scars.shp --burn-prob burn_probability.tif
```
## Scripting/Developing tips
- Check [standalone scripting](https://github.com/fire2a/fire-analytics-qgis-processing-toolbox-plugin/blob/main/script_samples/standalone.py) for more info on initializing a headless QGIS environment
- Usage [examples](https://github.com/fire2a/fire2a-lib/tree/main/usage_samples)
- macOS users add a permanent alias, on the terminal app
   ```zsh
   echo "alias pythonq='/Applications/QGIS.app/Contents/MacOS/bin/python'" >> ~/.zshrc
   ```
### Interactive 
1. Interactive sessions in IPython, qtconsole, jupyter-lab, or IPyConsole (QGIS plugin) compatible
```bash
# Press tab to auto-complete of available modules from IPython
In [1]: from fire2a.<press-tab>
```
2. Stop here interactive (colored terminal able):
```python
from IPython.terminal.embed import InteractiveShellEmbed
InteractiveShellEmbed()()
```
3. Stop here interactive (no colors):
```python
from IPython import embed
embed()
```
c. QGIS debugging:
```python
from qgis.PyQt.QtCore import pyqtRemoveInputHook
pyqtRemoveInputHook()
import pdb
pdb.set_trace()
from IPython.terminal.embed import InteractiveShellEmbed
InteractiveShellEmbed()()
```
3. Copy and paste the code interactive:
```bash
# 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 (reading args from sys.argv o main)
    if argv is sys.argv:
        argv = sys.argv[1:]
    args = arg_parser(argv)

# Ready to run the main interactively (args object ready)
```

# [Contributing](./CODING.md)
# [Building](./BUILDING.md)


# 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](https://www.python.org/psf/conduct).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "fire2a-lib",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "fire, wildfires, forest fires, fire management, fire analytics, fire research, fire modeling",
    "author": null,
    "author_email": "Fernando Badilla <fbadilla@ing.uchile.cl>",
    "download_url": "https://files.pythonhosted.org/packages/bb/06/6c4fc46d374d16524da788cd58a2f89eb5e1285aa1b157824a000f2faa17/fire2a_lib-0.3.3.tar.gz",
    "platform": null,
    "description": "<span style=\"color: orange;\"><strong><em><a href=\"https://fire2a.github.io/docs/docs/qgis-toolbox/README.html\" style=\"color: orange;\">\nFriendly graphical user interface click here\n</a></em></strong></span>\n\n![PyPI workflow](https://github.com/fire2a/fire2a-lib/actions/workflows/publish-pypi.yml/badge.svg)\n![auto pdoc workflow](https://github.com/fire2a/fire2a-lib/actions/workflows/auto-docs.yml/badge.svg)\n![PyPI Version](https://img.shields.io/pypi/v/fire2a-lib.svg)\n![Python Versions](https://img.shields.io/pypi/pyversions/fire2a-lib.svg)\n![License](https://img.shields.io/github/license/fire2a/fire2a-lib.svg)\n![Downloads](https://img.shields.io/pypi/dm/fire2a-lib.svg)\n![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)\n\n# fire2a-lib python package\nFire Advanced Analyitics research group scriptable knowledge base\n- Novel Algorithms related to landscape risk metrics, spatial decision optimization models, etc.\n- (Cell2) Fire (W) Simulator integration algorithms to facilitating placing firebreaks, measuring forest fire impacts, etc.\n- (Q)GIS algorithms to common tasks related to rasters, polygons, spatial clustering, etc.\n\n## Quickstart\n### Simplest: Use within QGIS\n1. Install QGIS\n2. Open QGIS Python Console\n3. To install, type :\n```python\n!pip install fire2a-lib\n```\n4. Visit [fire2a-lib documentation](https://fire2a.github.io/fire2a-lib), example:\n```python\nfrom fire2a.downstream_protection_value import digraph_from_messages\ndigraph = digraph_from_messages('messages01.csv')\n```\n### Command line usage\n1. Install QGIS\n\n- 1.A. [Simple](https://qgis.org/download/)\n- 1.B. Docker users check [qgis container](https://hub.docker.com/r/qgis/qgis)\n- __Optional but worth it for Windows:__ Make QGIS's bundled python folder writable by your user\n   - Three alternatives:\n   - A. Open File Explorer, go to `C:\\Program Files\\QGIS 3.38.3\\apps`, right-click `Python312` folder [Show more options]\\Properties\\Security\\Edit\\Allow Full control\\OK\n   - B. Open cmd administrator terminal, type:\n     ```\n     icacls \"C:\\Program Files\\QGIS 3.38.3\\apps\\Python312\" /grant %username%:F /T\n     ```\n\n     \n2. Locate python, prepare environment\n\n- 2.A. Windows\n   - Open `OsGeo4W Shell` application, \n   - Run `bin\\python-qgis.bat` once to configure all environment variables in the current session.\n   - Also you could: `bin\\python-qgis.bat your_script.py`\n   - Recommended persistent [integration](https://github.com/fire2a/fire2a-lib/blob/main/qgis-launchers/README.md)\n- 2.B. macOS \n   - Open terminal application, \n   - Use this python: `/Applications/QGIS.app/Contents/MacOS/bin/python` (see creating an alias below)\n   - TODO: are all environment variables right?\n- 2.C. Linux\n   ```\n   python3 -m venv --system-site-packages qgis_venv\n   source qgis_venv/bin/activate\n   ```\n3. Install\n```bash\npython -m pip install fire2a-lib\n# also recommended for development: ipython qtconsole jupyterlab\n```\n4. Visit [fire2a-lib documentation](https://fire2a.github.io/fire2a-lib), example for getting the burn probability from a simulator results directory:\n```bash\npython -m fire2a.cell2fire -vvv --base-raster ../fuels.asc --authid EPSG:25831 --scar-sample Grids/Grids2/ForestGrid03.csv --scar-poly propagation_scars.shp --burn-prob burn_probability.tif\n```\n## Scripting/Developing tips\n- Check [standalone scripting](https://github.com/fire2a/fire-analytics-qgis-processing-toolbox-plugin/blob/main/script_samples/standalone.py) for more info on initializing a headless QGIS environment\n- Usage [examples](https://github.com/fire2a/fire2a-lib/tree/main/usage_samples)\n- macOS users add a permanent alias, on the terminal app\n   ```zsh\n   echo \"alias pythonq='/Applications/QGIS.app/Contents/MacOS/bin/python'\" >> ~/.zshrc\n   ```\n### Interactive \n1. Interactive sessions in IPython, qtconsole, jupyter-lab, or IPyConsole (QGIS plugin) compatible\n```bash\n# Press tab to auto-complete of available modules from IPython\nIn [1]: from fire2a.<press-tab>\n```\n2. Stop here interactive (colored terminal able):\n```python\nfrom IPython.terminal.embed import InteractiveShellEmbed\nInteractiveShellEmbed()()\n```\n3. Stop here interactive (no colors):\n```python\nfrom IPython import embed\nembed()\n```\nc. QGIS debugging:\n```python\nfrom qgis.PyQt.QtCore import pyqtRemoveInputHook\npyqtRemoveInputHook()\nimport pdb\npdb.set_trace()\nfrom IPython.terminal.embed import InteractiveShellEmbed\nInteractiveShellEmbed()()\n```\n3. Copy and paste the code interactive:\n```bash\n# Select and Copy a whole module from line 1 up -but not included- to 'def main def main(argv=None):' line \nIn [2]: %paste\n\n# Choose your args \nIn [3]: args = arg_parser.parse_args(['-vvv', '--base-raster', ...\n\n# Skip (reading args from sys.argv o main)\n    if argv is sys.argv:\n        argv = sys.argv[1:]\n    args = arg_parser(argv)\n\n# Ready to run the main interactively (args object ready)\n```\n\n# [Contributing](./CODING.md)\n# [Building](./BUILDING.md)\n\n\n# Code of Conduct\n\nEveryone interacting in the project's codebases, issue trackers,\nchat rooms, and fora is expected to follow the\n[PSF Code of Conduct](https://www.python.org/psf/conduct).\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "Algorithms and tools python package for Forest Fire Research, Management and Analytics",
    "version": "0.3.3",
    "project_urls": {
        "documentation": "https://fire2a.github.io/fire2a-lib",
        "homepage": "https://www.fire2a.com",
        "repository": "https://github.com/fire2a/fire2a-lib"
    },
    "split_keywords": [
        "fire",
        " wildfires",
        " forest fires",
        " fire management",
        " fire analytics",
        " fire research",
        " fire modeling"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "147586e515b5087bba08a7831a12cfaa87629790ed439bf5169176cfcfb492c5",
                "md5": "2b9fc44b70b81f6decb270a90337d034",
                "sha256": "d8976de159b8096d96586be03b376f35df3c4b6c21e417b291e3270dcbbcc462"
            },
            "downloads": -1,
            "filename": "fire2a_lib-0.3.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2b9fc44b70b81f6decb270a90337d034",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 782808,
            "upload_time": "2024-11-19T17:24:27",
            "upload_time_iso_8601": "2024-11-19T17:24:27.375948Z",
            "url": "https://files.pythonhosted.org/packages/14/75/86e515b5087bba08a7831a12cfaa87629790ed439bf5169176cfcfb492c5/fire2a_lib-0.3.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bb066c4fc46d374d16524da788cd58a2f89eb5e1285aa1b157824a000f2faa17",
                "md5": "d24e5d22620f8b0e4f513795b9cb4cce",
                "sha256": "6e92437167be00305f52c5e9049bc06cd484072e071ca3a42e2b19c0b5f0a308"
            },
            "downloads": -1,
            "filename": "fire2a_lib-0.3.3.tar.gz",
            "has_sig": false,
            "md5_digest": "d24e5d22620f8b0e4f513795b9cb4cce",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 763052,
            "upload_time": "2024-11-19T17:24:30",
            "upload_time_iso_8601": "2024-11-19T17:24:30.998068Z",
            "url": "https://files.pythonhosted.org/packages/bb/06/6c4fc46d374d16524da788cd58a2f89eb5e1285aa1b157824a000f2faa17/fire2a_lib-0.3.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-19 17:24:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fire2a",
    "github_project": "fire2a-lib",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "fire2a-lib"
}
        
Elapsed time: 0.49574s