{
    "version":"0.1.0",
    "id":"swat-simulation",
    "use_case":"Catalunya Inland",
    "title":"SWAT, Soil and Water Assessment Tool",
    "description":"The Soil and Water Assessment Tool (SWAT) is a hydrological model used to simulate processes such as surface runoff, groundwater flow, and water quality across watersheds of varying scales. It evaluates the effects of land use, management practices, and climate scenarios on water resources. SWAT is widely used to study soil erosion, nonpoint source pollution, and watershed management (https://swat.tamu.edu/). The tool allows users to upload custom TxtInOut folders to model any watershed of interest in SWAT+ or SWAT2012 model version format. Users can define the simulation time range, calibration settings, output variables, and temporal resolution. This tool is using SWATrunR functions ( https://github.com/chrisschuerz/SWATplusR ) with executables rev60.5.7_64rel_linux (for SWAT+) and rev688_64rel_linux (for SWAT2012).",
    "jobControlOptions":[
        "sync-execute",
        "async-execute"
    ],
    "keywords":[
        "hydrology",
        "AquaINFRA",
        "R",
        "SWAT+",
        "SWAT2012",
        "watershed model"
    ],
    "links":[
        {
            "type":"text/html",
            "rel":"about",
            "title":"GitHub repo",
            "href":"https://github.com/AmandaBatlle/AquaINFRA_CaseUse_MedInlandModel",
            "hreflang":"en-US"
        },
        {
            "type":"text/html",
            "rel":"about",
            "is_oer":"yes",
            "title":"How to use a OGC processing service with R",
            "href":"https://github.com/AmandaBatlle/AquaINFRA_CaseUse_MedInlandModel",
            "hreflang":"en-US"
        },
        {
            "type":"text/html",
            "rel":"about",
            "is_oer":"yes",
            "title":"How to use a OGC processing service with python",
            "href":"https://github.com/AmandaBatlle/AquaINFRA_CaseUse_MedInlandModel",
            "hreflang":"en-US"
        },
        {
            "type":"application/json",
            "rel":"self",
            "href":"https://aquainfra.ogc.igb-berlin.de/pygeoapi/processes/swat-simulation?f=json",
            "title":"Process description as JSON",
            "hreflang":"en-US"
        },
        {
            "type":"text/html",
            "rel":"alternate",
            "href":"https://aquainfra.ogc.igb-berlin.de/pygeoapi/processes/swat-simulation?f=html",
            "title":"Process description as HTML",
            "hreflang":"en-US"
        },
        {
            "type":"text/html",
            "rel":"http://www.opengis.net/def/rel/ogc/1.0/job-list",
            "href":"https://aquainfra.ogc.igb-berlin.de/pygeoapi/jobs?f=html",
            "title":"Jobs list as HTML",
            "hreflang":"en-US"
        },
        {
            "type":"application/json",
            "rel":"http://www.opengis.net/def/rel/ogc/1.0/job-list",
            "href":"https://aquainfra.ogc.igb-berlin.de/pygeoapi/jobs?f=json",
            "title":"Jobs list as JSON",
            "hreflang":"en-US"
        },
        {
            "type":"application/json",
            "rel":"http://www.opengis.net/def/rel/ogc/1.0/execute",
            "href":"https://aquainfra.ogc.igb-berlin.de/pygeoapi/processes/swat-simulation/execution?f=json",
            "title":"Execution for this process as JSON",
            "hreflang":"en-US"
        }
    ],
    "inputs":{
        "swat_version":{
            "title":"SWAT version",
            "description":"Define the SWAT model version 'swatplus' or 'swat2012'. AquaINFRA has integrated the executable version rev60.5.7_64rel_linux for SWAT+ and rev688_64rel_linux for SWAT2012. Example: \"swatplus\".",
            "schema":{
                "type":"string"
            },
            "minOccurs":1,
            "maxOccurs":1,
            "keywords":[]
        },
        "TextInOut_URL":{
            "title":"URL to project folder",
            "description":"Provide URL to zipped TxtInOut SWAT project folder. Important: Do not include the SWAT executable in that folder \u2014 AquaINFRA has integrated the executable version rev60.5.7_64rel_linux for SWAT+ and rev688_64rel_linux for SWAT2012. Example, SWAT+ La Tordera watershed (Catalonia, Spain) model calibrated for water quantity (period 2000-2022) (Batlle-Morera, et al, 2026. https://doi.org/10.23728/b2share.am3bh-05a34):  https://b2share.eudat.eu/records/am3bh-05a34/files/TxtInOut.zip?download=1 .",
            "schema":{
                "type":"object",
                "contentMediaType":"application/zip"
            },
            "minOccurs":1,
            "maxOccurs":1,
            "keywords":[]
        },
        "par_cal":{
            "title":"Parameter inputs",
            "description":"(optional) JSON file including the parameter value change as defined by SWATrunR documentation (https://chrisschuerz.github.io/SWATrunR/articles/SWATrunR.html#parameter-inputs). Example format: https://github.com/AmandaBatlle/AquaINFRA_CaseUse_MedInlandModel/blob/main/example_inputs/par_cal.json",
            "schema":{
                "type":"object",
                "contentMediaType":"application/json"
            },
            "minOccurs":0,
            "maxOccurs":1,
            "keywords":[]
        },
        "unit":{
            "title":"Output Spatial unit",
            "description":"Specify the spatial unit for which to generate output. This corresponds to the ID of a river reach, HRU (Hydrologic Response Unit), or LSU (Landscape Unit) as defined in the SWAT+ watershed delineation. The value can be entered as a single number (e.g., 1), a range (e.g., 1:10), or a list of values (e.g., (1, 3, 25, 40)). Example unit for the La Tordera SWAT+ model (Batlle-Morera, et al, 2026) is 1.",
            "schema":{
                "type":"integer"
            },
            "minOccurs":1,
            "maxOccurs":1,
            "keywords":[]
        },
        "file":{
            "title":"SWAT Output File",
            "description":"Enter output file according to SWAT version. For SWAT+, the output file name consists of three elements separated by underscores (_): spatial unit, output category, and time step. For example, 'channel_sd_day'. The spatial unit defines the scale of the output and can be basin, hru, lsunit, channel, aquifer, or reservoir. The output category specifies the type of data such as wb (water balance), nb (nutrient balance), ls (losses), pw (plant and weather), or sd (streamflow and sediment in channels). The time step indicates the temporal resolution and can be day (daily), mon (monthly), yr (yearly), or aa (annual average). Combining these elements forms the output file name. For more details, refer to the SWAT+ OUTPUT FILES section in the SWAT+ documentation (https://swatplus.gitbook.io/io-docs) and SWATrunR documentation (https://chrisschuerz.github.io/SWATrunR/reference/run_swatplus.html). For SWAT2012 output files, valid inputs are 'rch', 'sub', 'hru', and 'sed', followed by '_', and the required output interval as a character string ('d' for daily, 'm' for monthly, or 'y' for yearly), for example: rch_m.  For more details, refer to the SWAT2012 OUTPUT FILES chapter in the SWAT documentation (https://swat.tamu.edu/media/116601/ch32_output.pdf), and SWATrunR documentation (https://chrisschuerz.github.io/SWATrunR/reference/run_swat2012.html). Example for SWAT+: \"channel_sd_day\". Example for SWAT2012:\"rch_d\" ",
            "schema":{
                "type":"string"
            },
            "minOccurs":1,
            "maxOccurs":1,
            "keywords":[]
        },
        "variable":{
            "title":"SWAT Variable",
            "description":"Variable to simulate. Example: \"flo_out\". For more details and extended capabilities, refer to the SWAT+ OUTPUT FILES section in the SWAT+ documentation (https://swatplus.gitbook.io/io-docs), or SWAT2012 OUTPUT FILES chapter in the SWAT documentation (https://swat.tamu.edu/media/116601/ch32_output.pdf). For one variable, enter the variable name. For multiple variables, enter them separated by a comma. Example for SWAT+: \"flo_out,water_temp\". Example for SWAT2012: \"FLOW_OUT\"",
            "schema":{
                "type":"string"
            },
            "minOccurs":1,
            "maxOccurs":1,
            "keywords":[]
        },
        "start_date":{
            "title":"Start Date",
            "description":"Start date of the simulation in the format yyyymmdd. Example: 20160101.",
            "schema":{
                "type":"integer"
            },
            "minOccurs":1,
            "maxOccurs":1,
            "keywords":[]
        },
        "skip_years":{
            "title":"Number of years of warm-up time ",
            "description":"(optional) Integer value to define the number of simulation years that are skipped before writing SWAT model outputs. Example: 2.",
            "schema":{
                "type":"integer"
            },
            "minOccurs":1,
            "maxOccurs":1,
            "keywords":[]
        },
        "end_date":{
            "title":"End Date",
            "description":"End date of the simulation in the format yyyymmdd. Example: 20201231.",
            "schema":{
                "type":"integer"
            },
            "minOccurs":1,
            "maxOccurs":1,
            "keywords":[]
        }
    },
    "outputs":{
        "swat_output_summary":{
            "title":"SWAT+ run summary",
            "description":"SQLite database (inputs.sqlite) containing all the parameters used in the executed SWAT+ run",
            "schema":{
                "type":"object",
                "contentMediaType":"application/x-sqlite3"
            }
        },
        "swat_output_file":{
            "title":"SWAT+ Variable Outputs Database",
            "description":"SQLite database (thread_1.sqlite) storing the simulated output values based on the defined time range and time step (daily, monthly, yearly, or annual average).",
            "schema":{
                "type":"object",
                "contentMediaType":"application/x-sqlite3"
            }
        }
    },
    "example":{
        "inputs":{
            "swatversion":"swatplus",
            "TextInOut_URL":"https://b2share.eudat.eu/records/am3bh-05a34/files/TxtInOut.zip?download=1",
            "par_cal":"NULL",
            "unit":1,
            "file":"channel_sd_day",
            "variable":"flo_out,water_temp",
            "start_date":20160101,
            "end_date":20201231,
            "years_skip":2
        }
    },
    "outputTransmission":[
        "value"
    ]
}