# FastFuels-Python
Python client library for the FastFuels API
## Install
You can install FastFuels through the Python Package Index.
```
pip install fastfuels
```
## Quickstart
### Connecting to a `.fio` resource
A `.fio` resource is a directory-in-file object where important metadata and fuel arrays are stored. Start by importing the FastFuels module and open a `.fio` resource. If you have one locally, specify the path and file name.
```python
>>> import fastfuels
>>> fio = fastfuels.open('./demo.fio', ftype='local')
```
If you have the appropriate credentials, you can connect to the remote resource stored in AWS S3.
```python
>>> fio = fastfuels.open('./ca.fio', ftype='s3', username='username', password='password')
```
### Explore the metadata
Let's take a look at some metadata. You can get the extent of the data in geographic coordinates (longitude and latitude) or in projected coordinates by changing the `mode` argument.
```python
>>> print(fio.get_extent(mode='geographic'))
(-120.73665218037868, 38.93933418427242, -120.6511979123941, 38.90135366961076)
>>> print(fio.get_extent(mode='projected'))
(-2100315.0, 2043015.0, -2094315.0, 2037015.0)
```
And the projection system is stored in the `proj` attribute.
```python
>>> print(fio.proj)
```
You can also view metadata for resolution and units
```python
>>> print(fio.res)
(1,1,1)
>>> print(fio.units)
'meters'
```
### Spatial queries
You can perform spatial queries by specifying geographic coordinates in decimal degrees
and a radius in meters. The radius parameter defines the size of the bounding square in which
fuels are queried.
```python
# this command will return a square kilometer of fuels (radius=500 meters)
roi = fio.query(-122.191, 41.208, 500)
```
### Viewing fuels in 3D
Fuel parameter arrays can be viewed interactively in 3D. To see the available parameters run
```python
print(roi.get_properties())
```
Then specify one of the properties in the `view()` method on the `roi` object.
```python
roi.view('sav')
```
![FastFuels SAV](https://storage.googleapis.com/fastfuels-landing-page/assets/fastfuels_sav.png)
### Writing fire model input files
With the `roi` object, you can write input files for various fire models. Here,
you may also decrease the resolution to save computation.
```python
roi.write('./outputs', model='quicfire', res_xyz=[2,2,1])
```
Raw data
{
"_id": null,
"home_page": "https://github.com/teamholtz/FastFuels-Python",
"name": "fastfuels",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "fire model, fuelscape, wildfire",
"author": "Holtz Technology and Development Services LLC",
"author_email": "lucas@holtztds.com",
"download_url": "https://files.pythonhosted.org/packages/09/9e/abae204073173028fb2135a01268895b69751642b078ab997199e54ee3d0/fastfuels-1.0.7.tar.gz",
"platform": null,
"description": "# FastFuels-Python \n\nPython client library for the FastFuels API\n\n## Install\n\nYou can install FastFuels through the Python Package Index.\n\n```\npip install fastfuels\n```\n\n## Quickstart\n\n### Connecting to a `.fio` resource\n\nA `.fio` resource is a directory-in-file object where important metadata and fuel arrays are stored. Start by importing the FastFuels module and open a `.fio` resource. If you have one locally, specify the path and file name.\n\n```python\n>>> import fastfuels\n>>> fio = fastfuels.open('./demo.fio', ftype='local')\n```\n\nIf you have the appropriate credentials, you can connect to the remote resource stored in AWS S3.\n\n```python\n>>> fio = fastfuels.open('./ca.fio', ftype='s3', username='username', password='password')\n```\n\n### Explore the metadata\n\nLet's take a look at some metadata. You can get the extent of the data in geographic coordinates (longitude and latitude) or in projected coordinates by changing the `mode` argument.\n\n```python\n>>> print(fio.get_extent(mode='geographic'))\n(-120.73665218037868, 38.93933418427242, -120.6511979123941, 38.90135366961076)\n>>> print(fio.get_extent(mode='projected'))\n(-2100315.0, 2043015.0, -2094315.0, 2037015.0)\n```\n\nAnd the projection system is stored in the `proj` attribute.\n\n```python\n>>> print(fio.proj)\n```\n\nYou can also view metadata for resolution and units\n\n```python\n>>> print(fio.res)\n(1,1,1)\n>>> print(fio.units)\n'meters'\n```\n\n### Spatial queries\n\nYou can perform spatial queries by specifying geographic coordinates in decimal degrees\nand a radius in meters. The radius parameter defines the size of the bounding square in which\nfuels are queried.\n\n```python\n# this command will return a square kilometer of fuels (radius=500 meters)\nroi = fio.query(-122.191, 41.208, 500)\n```\n\n### Viewing fuels in 3D\n\nFuel parameter arrays can be viewed interactively in 3D. To see the available parameters run\n\n```python\nprint(roi.get_properties())\n```\n\nThen specify one of the properties in the `view()` method on the `roi` object.\n\n```python\nroi.view('sav')\n```\n\n![FastFuels SAV](https://storage.googleapis.com/fastfuels-landing-page/assets/fastfuels_sav.png)\n\n### Writing fire model input files\n\nWith the `roi` object, you can write input files for various fire models. Here,\nyou may also decrease the resolution to save computation.\n\n```python\nroi.write('./outputs', model='quicfire', res_xyz=[2,2,1])\n```\n",
"bugtrack_url": null,
"license": "GNU GPLv3",
"summary": "3D fuelscapes for the contiguous US",
"version": "1.0.7",
"project_urls": {
"Homepage": "https://github.com/teamholtz/FastFuels-Python"
},
"split_keywords": [
"fire model",
" fuelscape",
" wildfire"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "df715058503de7ce3f88bd5e5c9c0dead906b29eea0a2c6499c89adbc2a63767",
"md5": "2c9b87cfc57480c014f4d3a043e9963a",
"sha256": "8b8d9581401f5286903ac6d3565de28cdedee9d727eb96a3e99d5ca2b2d8c972"
},
"downloads": -1,
"filename": "fastfuels-1.0.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2c9b87cfc57480c014f4d3a043e9963a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 27480,
"upload_time": "2024-04-30T18:23:34",
"upload_time_iso_8601": "2024-04-30T18:23:34.128717Z",
"url": "https://files.pythonhosted.org/packages/df/71/5058503de7ce3f88bd5e5c9c0dead906b29eea0a2c6499c89adbc2a63767/fastfuels-1.0.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "099eabae204073173028fb2135a01268895b69751642b078ab997199e54ee3d0",
"md5": "47f554366aa4174eb89528bae05088b4",
"sha256": "4e89a4b7d80ef8b163b77733fa171d96bc1592ad55d1ce21360764b1376e76b1"
},
"downloads": -1,
"filename": "fastfuels-1.0.7.tar.gz",
"has_sig": false,
"md5_digest": "47f554366aa4174eb89528bae05088b4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 26724,
"upload_time": "2024-04-30T18:23:35",
"upload_time_iso_8601": "2024-04-30T18:23:35.932085Z",
"url": "https://files.pythonhosted.org/packages/09/9e/abae204073173028fb2135a01268895b69751642b078ab997199e54ee3d0/fastfuels-1.0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-30 18:23:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "teamholtz",
"github_project": "FastFuels-Python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "fastfuels"
}