soilapis

Package for soil apis


License
MIT
Install
pip install soilapis==0.0.1

Documentation

gis-scripts

This project will contain most of my general purposes Python or R scripts related to GIS stuff.

The scripts require a virtual env:

conda create -n gis-scripts_env python=3.7
conda activate scripts_env
pip install -r requirements.txt

Project proj-lstfd20:

This script is optimized only for Thailand as of now. Follow the steps to get the script running:

  1. Downlaod this project
  2. Downlaod layers.zip
  3. Unzip layers.zip
  4. Copy 'layers' directory into the 'proj-lstfd20' directory
  5. 'proj-lstfd20' should only have two directories now
  6. Run summary_soil_property.py from your env
  7. Please disregard any warning about "pj_obj_create*"

Usage:

summary_soil_property.py [-h] --lon LON --lat LAT --win WIN --depth DEPTH [--format FORMAT]

Example of simulations:

  • To retrieve the TAW file needed to to run the soil water balance:

$ (gis-scripts_env) python path/to/summary_soil_property.py --lon=103.84 --lat=15.76 --win=3 --depth=350

Check directory for the following file: path/to/scripts/outputs/SoilTAW350mm.csv

  • To retrieve the .SOL file needed to to run DSSAT

$ (gis-scripts_env) python path/to/summary_soil_property.py --lon=103.84 --lat=15.76 --win=3 --depth=500 --format=dssat

Check directory for the following file: path/to/scripts/outputs/TH.SOL

  • To get help, please run:

$ (gis-scripts_env) python path/to/summary_soil_property.py -h

This script interpolates TAW value for a specific location in Thailand

optional arguments: -h, --help show this help message and exit

--lon LON longitude value, e.g. 103.98

--lat LAT latitude value, e.g. 15.88

--win WIN window size, e.g. enter '3' for a window size of 3x3. In this case, the location becomes the center of a grid > containing 9 other locations neighboring that center.

--depth DEPTH depth value in mm, e.g. 350

--format FORMAT (this is optional). For this, choose either:

.....1 "swb" for soil water balance to output TAW (this is the default option)

.....OR

.....2 "dssat" for DSSAT for .SOL

The SoilTAW[Depth]mm.csv output file contains three entries needed for Soil Water Balance:

  • codeID: this is just a unique ID for the TAW value. It's an integer
  • Soil type: This is used by the water balance model to link a computational unit with the data. Possible values are: SiltLoam, SAND, SiltClayL, Loam, ClayLoam, SandyLoam, etc...
  • TAW: this is a float value corresponding to the TAW calculated by the script. This value is in mm