Python toolbox enabling an open source gSSURGO workflow
Project description
gssurgo
The gssurgo
python package enables open source workflows with the gSSURGO
dataset. It provides:
-
A shell script
extract_gssurgo_tif
for generating stand-alonegSSURGO
grids. These raster grids are distributed within file geodatabase archives and can only be extracted using ArcGIS, the fileGDB driver, or (in the case ofextract_gssurgo_tif
) thearcpy
python package. -
Python functions for converting Geodatabase files to geopackage format.
-
Python functions for returning the results of specific
SQL
queries ofgSSURGO
data. -
Python functions for referencing query results to corresponding (raster) grid cells.
Prereqs
-
The intial
tif
(grid) extraction step requies thearcpy
python module. This step assumes that a python executable linked toarcpy
can be found atC:\Python27\ArcGIS10.3\python.exe
. Edit bin/extract_gssurgo_tif to enable alternate locations. -
Remaining operations require the dependencies listed in environment.yml and requirements.txt. If using Anaconda, make sure you have the 64bit version. You can install an Anaconda virtual environment with:
conda env create -n gssurgo -f environment.yml
source activate gssurgo
Installation
# local install
# pip install -e .
# development install
pip install git+git://github.com/jsta/gssurgo.git
# development upgrade
# pip install --upgrade git+git://github.com/jsta/gssurgo.git
Usage
1. Extract tif and build gpkgs
extract_gssurgo_tif 'path/to/gSSURGO_STATE.gdb/MapunitRaster_10m' 'path/to/STATE.tif'
import gssurgo
gssurgo.build_gpkg("path/to/gSSURGO_STATE.gdb", "path/to/gSSURGO_STATE.gpkg")
2. Generate an Area of Interest (AOI)
gssurgo.aoi(in_raster_path = "tifs", out_raster = "path/to/aoi.tif", xmax = -88.34945, xmin = -88.35470, ymin = 38.70095, ymax = 38.70498)
3. Pull specific variable and merge with corresponding tif
gssurgo.query_gpkg(src_tif = "path/to/aoi.tif", sql_query = 'SELECT mukey, nonirryield_r FROM mucropyld WHERE (cropname = "Corn")', out_raster = "path/to/aoi_results.tif")
gssurgo.query_gpkg(src_tif = "tests/aoi.tif", sql_query = 'SELECT mukey, nonirryield_r FROM mucropyld WHERE (cropname = "Corn")', out_raster = "path/to/aoi_results.tif")
The
sql_query
parameter must give a two column result ofmukey
andsome_variable
where nomukey
entries are duplicated.
4. Visualize output
gssurgo.viz_numeric_output("path/to/aoi_results.tif", "path/to/aoi_results.png")
Project details
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 gssurgo-0.0.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c724a9d63c2a37cd8cf09dc86e52b799ead0f59670f7faad9bdf5683d73808ad |
|
MD5 | 05b57ec5f82e9c700d52d13a8116c2bd |
|
BLAKE2b-256 | 414a701cf89a504297d59c11dce22d633f1de5ae46c1bfc4eda0cbea50f25611 |