sDRIPS Documentation

Home

  • sDRIPS
  • Motivation

Model

  • Conceptual Model
  • Computational Model

Quick Start

  • Getting Ready
  • Download Guide

Configuration

  • Script Configuration File
  • Crop Configuration File
  • Command Area Configuration File
  • Secrets File

Data Description

  • Directory Structure
  • Global Database

Tutorials

  • Creating Command Areas (Optional)
    • Command Line Interface
    • Notebook
  • Creating Command Area Config Files
    • Command Line Interface
    • Notebook

Application

  • sDRIPS-Sense
  • sDRIPS-Ukulima

Development

  • Recent Adjustments
  • Patch Notes
  • Dev Version

Contact

  • Contact

Disclaimer

  • Disclaimer
sDRIPS Documentation
  • Tutorials
  • Creating Command Area Config Files
  • Notebook
  • Edit on GitHub

Importing the Command config module¶

In [1]:
Copied!
from sdrips.cmd_config import run_cmd_config
from sdrips.cmd_config import run_cmd_config

Checking docstrings to see the input parameters¶

In [2]:
Copied!
run_cmd_config?
run_cmd_config?
Signature:
run_cmd_config(
    shp_path: Union[str, pathlib.Path],
    column_name: str,
    default_planting_date: str = '2023-04-01',
    default_crop_type: str = 'Rice',
    default_soil_coef: float = 0.5,
    default_distribution_unif: float = 1.0,
    output_path: Union[str, pathlib.Path, NoneType] = None,
    layer: Union[str, int, NoneType] = None,
) -> pathlib.Path
Docstring:
Generate a YAML configuration file for command areas found in a vector dataset.

This function reads a vector dataset (e.g., Shapefile, GeoJSON, GeoPackage, FileGDB)
using GeoPandas, extracts the unique command‑area identifiers from the specified
attribute column, and writes a YAML config with one section per ID plus a DEFAULT
section containing baseline parameters. Here Shapefile format is highly recommended as it 
can be integrated with Google Earth Engine easily. 

Parameters
----------
shp_path : str or pathlib.Path
    Path to the vector dataset. Can be a file (e.g., ``.shp``, ``.geojson``,
    ``.gpkg``) or a directory/container supported by your GDAL/Fiona build
    (e.g., a File Geodatabase ``.gdb``). Zipped shapefiles (``.zip``) are also
    supported by GeoPandas. Here ``.shp`` format is highly recommended as it 
    can be integrated with Google Earth Engine easily.
column_name : str
    Name of the attribute column that contains the unique command‑area IDs to
    index the YAML sections (e.g., ``"CA_ID"``).
default_planting_date : str, optional
    Default planting date to write into both the DEFAULT section and each
    per‑ID section (ISO format ``YYYY-MM-DD``). Default is ``"2023-04-01"``.
default_crop_type : str, optional
    Default crop type (e.g., ``"Rice"``, ``"Wheat"``, ``"Corn"``). Written to
    the DEFAULT section and each per‑ID section. Default is ``"Rice"``.
default_soil_coef : float, optional
    Default soil coefficient value (dimensionless) to include in the config.
    Default is ``0.5``.
default_distribution_unif : float, optional
    Default distribution uniformity (DU) value (dimensionless, e.g., 0.7–1.0)
    representing irrigation application efficiency. Default is ``1.0``.
output_path : str, pathlib.Path, or None, optional
    Where to write the YAML file. If ``None``, the file is written to
    ``config_files/ca_config.yaml``. Parent directories are created if missing.

Returns
-------
pathlib.Path
    Path to the written YAML file.
File:      c:\users\skhan7\onedrive - uw\desktop\research\phd\chapter2\github\sdrips\src\sdrips\cmd_config.py
Type:      function
In [3]:
Copied!
ca_path = run_cmd_config(shp_path = '../../Shapefiles/cmd_area_wgs/Teesta_Command_Areas.shp',column_name = 'CNLNM', default_planting_date = '2025-07-07', default_crop_type='Wheat', output_path='../Data/cmd_config.yaml')
ca_path = run_cmd_config(shp_path = '../../Shapefiles/cmd_area_wgs/Teesta_Command_Areas.shp',column_name = 'CNLNM', default_planting_date = '2025-07-07', default_crop_type='Wheat', output_path='../Data/cmd_config.yaml')
In [4]:
Copied!
print(ca_path)
print(ca_path)
..\Data\cmd_config.yaml

The output (a command area configureation file) is saved at the desired location. A snapshot of the YAML file is shown below.

Config YAML
Previous

Developed by Shahzaib Khan
Copyright © 2025, University of Washington SASWE Research Group

Built with MkDocs using a theme provided by Read the Docs.
GitHub « Previous