Skip to main content

gssurgo

PyPiVersion Project Status: Active - The project has reached a stable, usable state and is being actively developed. PYPI Downloads Build Status Code DOI

The gssurgo python package enables open source workflows with the gSSURGO dataset. It provides:

  • A shell script extract_gssurgo_tif for generating stand-alone gSSURGO grids. These raster grids are distributed within file geodatabase archives and can only be extracted using ArcGIS, the fileGDB driver, or (in the case of extract_gssurgo_tif) the arcpy python package.

  • Python functions for converting Geodatabase files to geopackage format.

  • Python functions for returning the results of specific SQL queries of gSSURGO data.

  • Python functions for referencing query results to corresponding (raster) grid cells.

Prereqs

  • The intial tif (grid) extraction step requies the arcpy python module. This step assumes that a python executable linked to arcpy can be found at C:\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

A demonstration workflow using the gssurgo python package can be found at: https://github.com/jsta/gssurgo_data

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 = "tests/aoi.tif", gpkg_path = "path/to/gkpgs/", sql_query = 'SELECT mukey, nonirryield_r FROM mucropyld WHERE (cropname = "Corn")', out_raster = "tests/aoi_results.tif")

gssurgo.query_gpkg(src_tif = "tests/aoi.tif", gpkg_path = "path/to/gpkgs/", sql_query = 'SELECT mukey, nonirryield_r FROM mucropyld WHERE (cropname = "Corn")', out_raster = "tests/aoi_results.tif")

The sql_query parameter must give a two column result of mukey and some_variable where no mukey entries are duplicated.

4. Visualize output

gssurgo.viz_numeric_output("path/to/aoi_results.tif", "path/to/aoi_results.png")

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gssurgo-1.0.1.tar.gz (3.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gssurgo-1.0.1-py3-none-any.whl (3.3 MB view details)

Uploaded Python 3

File details

Details for the file gssurgo-1.0.1.tar.gz.

File metadata

  • Download URL: gssurgo-1.0.1.tar.gz
  • Upload date:
  • Size: 3.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/3.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for gssurgo-1.0.1.tar.gz
Algorithm Hash digest
SHA256 614895717fc201b195911dc57f9d5e83129400f76c08d70c69d1641d48de4254
MD5 3beb73a5bd13c57339f7b2ffe36f186c
BLAKE2b-256 92b7976bc463422d56566d22ed2236080813018ec7c8065bf0032514a8c9bbdd

See more details on using hashes here.

File details

Details for the file gssurgo-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: gssurgo-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/3.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for gssurgo-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c78d44b00803de0832726888a4f2e4f79b67b199b87881f4b1d4a26f51c7d892
MD5 db8b1d2f7071c39e29ff623d4109b616
BLAKE2b-256 4e2de30e054d389458208ae68790d850d921355c1544180ee8f677e9e2bc5d0d

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 files

1.0.0

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

3 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page