Python toolbox enabling an open source gSSURGO workflow
Project description
gSSURGO
gSSURGO
contains multiple text format datasets referenced to a single raster grid. The raster grids are contained within file geodatabase archives and can only be extracted using ArcGIS (using the fileGDB driver).
This repo enables subsequent open source workflows by extracting the grid and aggregating it along with the remaining data into a geopackage. Specific queries of gSSURGO
data need to be constructed in SQL
and subsequently called against a given geopackage using the query_gpkg.py
script.
Prereqs
-
Download zip files from: https://nrcs.app.box.com/v/soils
-
Have the
arcpy
python module available for the intialtif
extraction step -
Have the
ogr2ogr
command available and working with theGPKG
driver -
Have the python modules listed in environment.yml installed. 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 .
# pypi install
pip install gssurgo
Usage
1. Extract tifs and build gpkgs
make all
2. Pull specific variable and merge with corresponding tif
Compose an SQL query that give a two column result of mukey
and some_variable
. For example, 'SELECT mukey, nonirryield_r FROM mucropyld WHERE (cropname = "Corn")'
. Pass this query to query_gpkg.py
along with a bounding box given by xmax
, xmin
, ymin
, ymax
. For example, the following call produces a tif or non irrigated corn yields clipped to the defined bounding box:
python query_gpkg.py gSSURGO_MI.gpkg 'SELECT mukey, nonirryield_r FROM mucropyld WHERE (cropname = "Corn")' tifs/gSSURGO_MI.tif 935594 925029.1 2214590 2225584 tests/nonirryield_r.tif
3. Visualize output
Pass the name of an output tif to viz_numeric_output.py
:
python viz_numeric_output.py tests/nonirryield_r.tif tests/nonirryield_r.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 Distributions
Hashes for gssurgo-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15f20521d724f4819b88977458531df2f2bd849bf257e175c11b84b6874c5ec3 |
|
MD5 | 36f29bd768ba5cf2662b9198eaca510f |
|
BLAKE2b-256 | 7d5cff3c766f2593d4034513c7ca45a71cce944ec670f7547ac949a4217bec91 |