BMPs Using SWAT, C#, DotSpatial and SQLite An … Interface for Watershed Evaluating of Agricultural...

16
An Interface for Watershed Evaluating of Agricultural BMPs Using SWAT, C#, DotSpatial and SQLite Zhiqiang (Michael) Yu [email protected]

Transcript of BMPs Using SWAT, C#, DotSpatial and SQLite An … Interface for Watershed Evaluating of Agricultural...

Page 1: BMPs Using SWAT, C#, DotSpatial and SQLite An … Interface for Watershed Evaluating of Agricultural BMPs Using SWAT, C#, DotSpatial and SQLite Zhiqiang (Michael) Yu hawklorry@gmail.com

An Interface for Watershed Evaluating of Agricultural BMPs Using SWAT, C#, DotSpatial and SQLite

Zhiqiang (Michael) [email protected]

Page 2: BMPs Using SWAT, C#, DotSpatial and SQLite An … Interface for Watershed Evaluating of Agricultural BMPs Using SWAT, C#, DotSpatial and SQLite Zhiqiang (Michael) Yu hawklorry@gmail.com

OverviewWhen: 2012Where: South Tobacco Creek watershed near Miami, MBTeam: Watershed Evaluation Group, University of GuelphProject: Watershed Evaluation of Beneficial Management Practices (WEBs), AAFCObjective: Develop an interface to create and evaluate what-if agricultural BMP scenarios to help conservation districts/authorities gain understanding on water quantity and quality effects and allocate limited resources for BMP implementation

Page 3: BMPs Using SWAT, C#, DotSpatial and SQLite An … Interface for Watershed Evaluating of Agricultural BMPs Using SWAT, C#, DotSpatial and SQLite Zhiqiang (Michael) Yu hawklorry@gmail.com

Roles and Responsibilities● Design the main architecture and determine required

technologies● Design the GUI and code with C#● Design the interface between GUI and SWAT with the

scenario definition file● Modify SWAT sourced codes to support SQLite results

and scenario definition file

Page 4: BMPs Using SWAT, C#, DotSpatial and SQLite An … Interface for Watershed Evaluating of Agricultural BMPs Using SWAT, C#, DotSpatial and SQLite Zhiqiang (Michael) Yu hawklorry@gmail.com

Architecture

GUI(C#, DotSpatial)

SWAT(Fortran, C)

Scenario Definition File

SWAT SQLite Results

Page 5: BMPs Using SWAT, C#, DotSpatial and SQLite An … Interface for Watershed Evaluating of Agricultural BMPs Using SWAT, C#, DotSpatial and SQLite Zhiqiang (Michael) Yu hawklorry@gmail.com

Technology - GUI● DotSpatial

o Basic map functionso Feature selectiono Change symbology based on SWAT, economic and

integrated results● MS Chart Control● C#

Page 6: BMPs Using SWAT, C#, DotSpatial and SQLite An … Interface for Watershed Evaluating of Agricultural BMPs Using SWAT, C#, DotSpatial and SQLite Zhiqiang (Michael) Yu hawklorry@gmail.com

Technology - Modified SWAT● SQLite C library - Write SWAT results to a

SQLite database● Mix-language compilation with gcc and

gfortran in Eclipse

Page 7: BMPs Using SWAT, C#, DotSpatial and SQLite An … Interface for Watershed Evaluating of Agricultural BMPs Using SWAT, C#, DotSpatial and SQLite Zhiqiang (Michael) Yu hawklorry@gmail.com

Highlights● User-friendly GUI with less pop-up windows● Modify SWAT to communicate with GUI● Add SQLite support to SWAT● Modify DotSpatial source codes to generate

given symbology● Change shapefile attributes on-the-fly to

quickly update symbology

Page 8: BMPs Using SWAT, C#, DotSpatial and SQLite An … Interface for Watershed Evaluating of Agricultural BMPs Using SWAT, C#, DotSpatial and SQLite Zhiqiang (Michael) Yu hawklorry@gmail.com

Screenshot - Project Tree● A project is consist of several

scenarios and a scenario could have five BMPs

● Project tree is the navigator of the interface. The central view would change as a node is selected.

Page 9: BMPs Using SWAT, C#, DotSpatial and SQLite An … Interface for Watershed Evaluating of Agricultural BMPs Using SWAT, C#, DotSpatial and SQLite Zhiqiang (Michael) Yu hawklorry@gmail.com

Screenshot - Project View

A project represents a watershed. It includes the geospatial and model information.

Page 10: BMPs Using SWAT, C#, DotSpatial and SQLite An … Interface for Watershed Evaluating of Agricultural BMPs Using SWAT, C#, DotSpatial and SQLite Zhiqiang (Michael) Yu hawklorry@gmail.com

Screenshot - Scenario View

A scenario is a combination of various BMPs including small dams, holding ponds, grazing, tillage and forage conversion. SWAT and economic model could be run for each scenario.

Results could be viewed after the simulation is done.

Page 11: BMPs Using SWAT, C#, DotSpatial and SQLite An … Interface for Watershed Evaluating of Agricultural BMPs Using SWAT, C#, DotSpatial and SQLite Zhiqiang (Michael) Yu hawklorry@gmail.com

Screenshot - Small Dam View

Select/deselect small dam on map or from the list on the right to enable/disable them in model

Page 12: BMPs Using SWAT, C#, DotSpatial and SQLite An … Interface for Watershed Evaluating of Agricultural BMPs Using SWAT, C#, DotSpatial and SQLite Zhiqiang (Michael) Yu hawklorry@gmail.com

Screenshot - Tillage View, Field Level

Select/deselect fields on map or from the list on the right to apply tillage. Farm level and subbasin level is also supported.

Page 13: BMPs Using SWAT, C#, DotSpatial and SQLite An … Interface for Watershed Evaluating of Agricultural BMPs Using SWAT, C#, DotSpatial and SQLite Zhiqiang (Michael) Yu hawklorry@gmail.com

Screenshot - Result View, SWAT Results● Display results with

different colors for polygon and different sizes for point

● Select a feature to view time series in chart at the bottom

● Control result display using the right panel

Page 14: BMPs Using SWAT, C#, DotSpatial and SQLite An … Interface for Watershed Evaluating of Agricultural BMPs Using SWAT, C#, DotSpatial and SQLite Zhiqiang (Michael) Yu hawklorry@gmail.com

Screenshot - Result View, Economic Results

Page 15: BMPs Using SWAT, C#, DotSpatial and SQLite An … Interface for Watershed Evaluating of Agricultural BMPs Using SWAT, C#, DotSpatial and SQLite Zhiqiang (Michael) Yu hawklorry@gmail.com

Screenshot - Result View, Integrated Results● Cost-effectiveness, i.e.

the amount of reduction (on water, sediment, N or P) per $1000 between two scenarios.

● Most valuable for conservation districts and authorities

Page 16: BMPs Using SWAT, C#, DotSpatial and SQLite An … Interface for Watershed Evaluating of Agricultural BMPs Using SWAT, C#, DotSpatial and SQLite Zhiqiang (Michael) Yu hawklorry@gmail.com

Screenshot - Result View, Off-site Integrated Results

Off-side is for the result at the watershed outlet and is good for whole watershed evaluation.