Name | gridit JSON |
Version |
0.7
JSON |
| download |
home_page | None |
Summary | Spatial tools to translate raster or vector geometry data to regular grids |
upload_time | 2025-01-30 03:27:08 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | BSD 3-Clause |
keywords |
grid
rasterize
regular grid
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Gridit
[![Tests](https://github.com/mwtoews/gridit/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/mwtoews/gridit/actions/workflows/tests.yml)
[![Codcov](https://codecov.io/gh/mwtoews/gridit/branch/main/graph/badge.svg)](https://codecov.io/gh/mwtoews/gridit)
[![DOI](https://zenodo.org/badge/530041277.svg)](https://zenodo.org/badge/latestdoi/530041277)
## Description
Gridit provides spatial tools to translate raster or vector geometry data to regular grids.
## Installation
This package primarily depends on NumPy and SciPy, and has several optional dependencies.
Pip can be used to install all optional dependencies:
```bash
$ pip install gridit[optional]
```
Or from a clone of this repository, create an "editable" install:
```bash
$ pip install -e .[optional]
```
### Testing
Run `pytest -v`.
## Examples
### Python
```python
>>> import matplotlib.pyplot as plt # optional
>>> from gridit import Grid
>>> grid = Grid.from_vector("tests/data/Mana_polygons.shp", 100)
>>> print(grid)
<Grid: resolution=100.0, shape=(24, 18), top_left=(1748600.0, 5451200.0) />
>>> ar_vec = grid.array_from_vector("tests/data/Mana_polygons.shp", "K_m_d")
>>> plt.imshow(ar_vec)
<matplotlib.image.AxesImage at 0x7fb6c7dacf10>
>>> ar_rast = grid.array_from_raster("tests/data/Mana.tif")
>>> plt.imshow(ar_rast)
<matplotlib.image.AxesImage at 0x7fb6bc4ad6d0>
```
### Command line
Grid and array from vector, write PNG image and shapefile grid:
```bash
$ gridit --grid-from-vector tests/data/Mana_polygons.shp --resolution 100 \
--array-from-vector tests/data/Mana_polygons.shp \
--array-from-vector-attribute=K_m_d \
--write-image /tmp/Mana_Kmd.png \
--write-vector /tmp/Mana_Kmd.shp
```
Grid from bounding box, array from raster, write GeoTIFF raster:
```bash
$ gridit --grid-from-bbox 1748600 5448800 1750400 5451200 --resolution 100 \
--array-from-raster tests/data/Mana.tif \
--write-raster /tmp/Mana_100m.tif
```
Grid from vector, array from netCDF, write text array file for each time stat:
```bash
$ gridit --grid-from-vector tests/data/waitaku2.shp --resolution 250 \
--array-from-vector tests/data/waitaku2.shp \
--array-from-vector-attribute rid \
--array-from-netcdf tests/data/waitaku2.nc:rid:myvar:0 \
--time-stats "quantile(0.75),max" \
--write-text /tmp/waitaku2_cat.ref
```
Grid from MODFLOW, array from vector, write text array file:
```bash
$ gridit --grid-from-modflow tests/data/modflow/mfsim.nam:h6 \
--array-from-vector tests/data/waitaku2.shp \
--array-from-vector-attribute rid \
--write-text /tmp/waitaku2_rid.txt
```
See other options with:
```bash
$ gridit -h
```
## Funding
Funding for the development of gridit has been provided by New Zealand Strategic Science Investment Fund as part of GNS Science’s (https://www.gns.cri.nz/) Groundwater Research Programme.
Raw data
{
"_id": null,
"home_page": null,
"name": "gridit",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "grid, rasterize, regular grid",
"author": null,
"author_email": "Mike Taves <mwtoews@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/f7/80/1c763f62c043291a55d2eff01888869b03974a235a2baab24244ff6880b0/gridit-0.7.tar.gz",
"platform": null,
"description": "# Gridit\n\n[![Tests](https://github.com/mwtoews/gridit/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/mwtoews/gridit/actions/workflows/tests.yml)\n[![Codcov](https://codecov.io/gh/mwtoews/gridit/branch/main/graph/badge.svg)](https://codecov.io/gh/mwtoews/gridit)\n[![DOI](https://zenodo.org/badge/530041277.svg)](https://zenodo.org/badge/latestdoi/530041277)\n\n## Description\n\nGridit provides spatial tools to translate raster or vector geometry data to regular grids.\n\n## Installation\n\nThis package primarily depends on NumPy and SciPy, and has several optional dependencies.\n\nPip can be used to install all optional dependencies:\n```bash\n$ pip install gridit[optional]\n```\n\nOr from a clone of this repository, create an \"editable\" install:\n```bash\n$ pip install -e .[optional]\n```\n\n### Testing\n\nRun `pytest -v`.\n\n## Examples\n\n### Python\n\n```python\n>>> import matplotlib.pyplot as plt # optional\n>>> from gridit import Grid\n\n>>> grid = Grid.from_vector(\"tests/data/Mana_polygons.shp\", 100)\n>>> print(grid)\n<Grid: resolution=100.0, shape=(24, 18), top_left=(1748600.0, 5451200.0) />\n\n>>> ar_vec = grid.array_from_vector(\"tests/data/Mana_polygons.shp\", \"K_m_d\")\n>>> plt.imshow(ar_vec)\n<matplotlib.image.AxesImage at 0x7fb6c7dacf10>\n\n>>> ar_rast = grid.array_from_raster(\"tests/data/Mana.tif\")\n>>> plt.imshow(ar_rast)\n<matplotlib.image.AxesImage at 0x7fb6bc4ad6d0>\n```\n\n### Command line\n\nGrid and array from vector, write PNG image and shapefile grid:\n```bash\n$ gridit --grid-from-vector tests/data/Mana_polygons.shp --resolution 100 \\\n --array-from-vector tests/data/Mana_polygons.shp \\\n --array-from-vector-attribute=K_m_d \\\n --write-image /tmp/Mana_Kmd.png \\\n --write-vector /tmp/Mana_Kmd.shp\n```\n\nGrid from bounding box, array from raster, write GeoTIFF raster:\n```bash\n$ gridit --grid-from-bbox 1748600 5448800 1750400 5451200 --resolution 100 \\\n --array-from-raster tests/data/Mana.tif \\\n --write-raster /tmp/Mana_100m.tif\n```\n\nGrid from vector, array from netCDF, write text array file for each time stat:\n```bash\n$ gridit --grid-from-vector tests/data/waitaku2.shp --resolution 250 \\\n --array-from-vector tests/data/waitaku2.shp \\\n --array-from-vector-attribute rid \\\n --array-from-netcdf tests/data/waitaku2.nc:rid:myvar:0 \\\n --time-stats \"quantile(0.75),max\" \\\n --write-text /tmp/waitaku2_cat.ref\n```\n\nGrid from MODFLOW, array from vector, write text array file:\n```bash\n$ gridit --grid-from-modflow tests/data/modflow/mfsim.nam:h6 \\\n --array-from-vector tests/data/waitaku2.shp \\\n --array-from-vector-attribute rid \\\n --write-text /tmp/waitaku2_rid.txt\n```\n\nSee other options with:\n```bash\n$ gridit -h\n```\n\n## Funding\nFunding for the development of gridit has been provided by New Zealand Strategic Science Investment Fund as part of GNS Science\u2019s (https://www.gns.cri.nz/) Groundwater Research Programme.\n",
"bugtrack_url": null,
"license": "BSD 3-Clause",
"summary": "Spatial tools to translate raster or vector geometry data to regular grids",
"version": "0.7",
"project_urls": {
"Repository": "https://github.com/mwtoews/gridit"
},
"split_keywords": [
"grid",
" rasterize",
" regular grid"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "8798a73fed6753d055604c0ee018edd946165ec2c0dadee13037498b0f292c73",
"md5": "c56e12dc9ce8a9c578c97b93819a7505",
"sha256": "5d5d6b38676474469a8b85d3820eafb397c4e13d638ab6e17f62ea1d422c8cb8"
},
"downloads": -1,
"filename": "gridit-0.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c56e12dc9ce8a9c578c97b93819a7505",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 44000,
"upload_time": "2025-01-30T03:27:02",
"upload_time_iso_8601": "2025-01-30T03:27:02.429175Z",
"url": "https://files.pythonhosted.org/packages/87/98/a73fed6753d055604c0ee018edd946165ec2c0dadee13037498b0f292c73/gridit-0.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f7801c763f62c043291a55d2eff01888869b03974a235a2baab24244ff6880b0",
"md5": "c3ee730bcc2cddc94a74627672a7baa4",
"sha256": "3eec9ee5caee4f94551e4e9a6d6b91c4a934e43d5edac5212888ebeceea40700"
},
"downloads": -1,
"filename": "gridit-0.7.tar.gz",
"has_sig": false,
"md5_digest": "c3ee730bcc2cddc94a74627672a7baa4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 774377,
"upload_time": "2025-01-30T03:27:08",
"upload_time_iso_8601": "2025-01-30T03:27:08.576928Z",
"url": "https://files.pythonhosted.org/packages/f7/80/1c763f62c043291a55d2eff01888869b03974a235a2baab24244ff6880b0/gridit-0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-30 03:27:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mwtoews",
"github_project": "gridit",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "gridit"
}