SingleCatchmentScenario

This plugin was written by Joel Rahman to make it easier to use the Rainfall runoff calibration tools with only defining the area of the catchment to create a scenario.

General Info

LicenseAs-is, use at your own risk
Typefree, open-source
Current version0.2

Plugin Description

Builds a geographic scenario with a single catchment, given an area.

Using the plugin

Once you have loaded the plugins and restarted Source, the plugin will be available in the project explorer:

Example Screenshot:

Sources

Source is available in the Source Community repository (https://bitbucket.org/ewater-ondemand/sourcecommunity) under SourcePlugins\SingleCatchmentScenario

using System;
using System.Linq;
using System.Windows.Forms;
using RiverSystem;
using RiverSystem.Catchments;
using RiverSystem.Controls;
using RiverSystem.TestingSupport;
using TIME.Core;
using TIME.Core.Metadata;
using TIME.ScenarioManagement;
 
namespace SingleCatchmentScenario
{
    [Aka("Single Catchment Scenario Builder"),
     WorksWith(typeof(RiverSystemProject)),
     Author("Joel Rahman")]
    public partial class SingleCatchmentScenarioBuilder : Form, IScenarioCreation
    {
        public SingleCatchmentScenarioBuilder()
        {
            InitializeComponent();
        }
 
        public AbstractScenario CreateScenario(Form parent, AbstractProject project)
        {
            ShowDialog();
            RiverSystemScenario testScenario = TestHelperRiverSystem.getAPreconfiguredTestScenarioWithAWBM(1, (RiverSystemProject)project);
            Catchment c = testScenario.Network.Catchments.First() as Catchment;
            c.characteristics.areaInSquareMeters = CatchmentAreaControl.GetValue(CommonUnits.squareMetres);
            foreach (var fu in c.FunctionalUnits)
                fu.areaInSquareMeters = 0;
            c.FunctionalUnits.First().areaInSquareMeters = c.characteristics.areaInSquareMeters;
            testScenario.Name += " " + (project as RiverSystemProject).GetRSScenarios().Length + 1;
            return testScenario;
        }

        public string Description
        {
            get { return "Single catchment scenario for rainfall runoff modelling"; }
        }
 
        public string IconPath
        {
            get { return "/RiverSystem.Forms;component/Resources/river-operator.ico"; }
        }

        private void BuildButton_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}