Skip to contents

This function converts a user-defined soil CSV file to the soils.sol file required for SWAT+ model input.

Usage

usersoil_to_sol(csv_path, db_path = NULL)

Arguments

csv_path

Character, path to CSV file containing user-defined soil information (example "usersoil_lrew.csv"). The CSV file should have the following columns (* indicates not required, yet column should be present in the CSV file):

  • OBJECTID*: Identifier for each record.

  • MUID*: STATSGO mapping unit identifier.

  • SEQN*: STATSGO sequential number of a soil component.

  • SNAM: Name of soil type or identifier of the soil.

  • S5ID*: STATSGO soil component identifier.

  • CMPPCT*: Percentage of the soil component in the MUID.

  • NLAYERS: Number of layers.

  • HYDGRP: Hydrologic group.

  • SOL_ZMX: Maximum soil depth.

  • ANION_EXCL: Anion exclusion.

  • SOL_CRK: Soil cracking.

  • TEXTURE: Soil texture.

    For each available layer (up to 10 layers):

  • SOL_Z1 - SOL_Z10: Depth of each layer. Units: mm;

  • SOL_BD1 - SOL_BD10: Bulk density of each layer. Units: Mg/m3 or g/cm3;

  • SOL_AWC1 - SOL_AWC10: Available water capacity of each layer. Units: mm H2O/mm soil;

  • SOL_K1 - SOL_K10: Saturated hydraulic conductivity of each layer. Units: mm/hr;

  • SOL_CBN1 - SOL_CBN10: Carbon content of each layer. Units: % soil weight;

  • CLAY1 - CLAY10: Clay (particles <0.002 mm) content of each layer. Units: % soil weight;

  • SILT1 - SILT10: Silt (particles between 0.002 and 0.05 mm) content of each layer. Units: % soil weight;

  • SAND1 - SAND10: Sand (particles between 0.05 and 2 mm) content of each layer. Units: % soil weight;

  • ROCK1 - ROCK10: Rock (particles >2 mm) content of each layer. Units: % total weight;

  • SOL_ALB1 - SOL_ALB10: Soil albedo of each layer. Units: ratio (values 0-1);

  • USLE_K1 - USLE_K10: USLE K factor of each layer. Units: 0.013 (metric ton m2 hr)/(m3-metric ton cm);

  • SOL_EC1 - SOL_EC10: Soil electrical conductivity of each layer. Units: dS/m;

  • SOL_CAL1 - SOL_CAL10: Soil CaCO3 content of each layer. Units: % (values 0 - 50%);

  • SOL_PH1 - SOL_PH10: Soil pH of each layer. Units: pH (values 3-10).

    Soil properties data can be prepared using get_usersoil_table function and saved into the CSV file using write.csv(usertable, ".my_file.csv", row.names=FALSE, quote=FALSE).

db_path

(optional) Character path to SQLite project database (example "output/project.sqlite"). Default db_path = NULL, which means SWAT+ model setup .sqlite database will not be used to reduce the size of the soils.sol file by leveraging information from an SQLite database if there are fewer soil types in the database compared to the user's soil CSV file.

Value

Soils.sol file for SWAT+ model input.

See also

get_usersoil_table For details on 'soil.sol' file read SWAT+ Soils Input

Examples

if (FALSE) {
# Convert user-defined soil CSV to soils.sol
usersoil_to_sol("output/usersoil_lrew.csv")

# Convert using an SQLite project database to reduce the size of the soils.sol 
file
usersoil_to_sol("output/usersoil_lrew.csv", "output/project.sqlite")
}