Skip to content

API reference

The public API is exported from the top-level swatpy package:

from swatpy import (
    SwatModel, parseParameterName,
    fileCioManipulator, bsnManipulator, subManipulator, hruManipulator,
    solManipulator, gwManipulator, mgtManipulator, rteManipulator,
    rchOutputManipulator, subOutputManipulator, hruOutputManipulator,
    efficiency, fluxes,
)

Simulation management

SwatModel

Bases: object

initFromTxtInOut staticmethod

initFromTxtInOut(txtInOut, copy=None, target_dir=None, swat_version='2012', force=False)

initialise the SwatModel working object from loading a SWAT 2012 TxtInOut directory

Keyword arguments: argument -- description Return: return_description

loadModelFromDirectory staticmethod

loadModelFromDirectory(target_dir)

initialise the SwatModel working object from the metadata file from existing working directory

Keyword arguments: argument -- description Return: return_description

run

run(capture_logs=True, silent=False)

getFileManipulators

getFileManipulators(force_update=False)

reloadFileManipulators

reloadFileManipulators()

setParameter

setParameter(name, value)

Apply a calibration parameter (see parseParameterName) to all files of its type.

Changes are relative to the values read when the file manipulators were created.

enrichModelMeta

enrichModelMeta(verbose=True, update_meta=True)

is_runnable

is_runnable()

guess_model_text_encoding staticmethod

guess_model_text_encoding(model_dir)

parseParameterName

parseParameterName(name)

Split a calibration parameter name, e.g. "r__CN2__mgt" -> ("*", "CN2", "mgt", []).

The SWAT-CUP style qualifiers after the file extension are returned but not evaluated.

Input file manipulators

InputFileManipulator

Bases: object

fileCioManipulator

bsnManipulator

gwManipulator

mgtManipulator

subManipulator

hruManipulator

rteManipulator

solManipulator

solManipulationCorrection

solManipulationCheck

Output readers

OutputFileManipulator

Bases: object

rchOutputManipulator

subOutputManipulator

hruOutputManipulator

efficiency

fluxes