An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P....

33
An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University Department of Geosciences Geospatial Software Lab 06/17/22 AWRA Spring Specialty Conferenc on GIS and Water Resource

Transcript of An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P....

Page 1: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GISDaniel P. Ames, PhD PETed Dunsford, PhD Candidate

Idaho State UniversityDepartment of GeosciencesGeospatial Software Lab

04/21/23

AWRA Spring Specialty Conferenceon GIS and Water Resources

Page 2: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

OpenMI Intro/Review• Open standard and set of tools

for connecting models and performing integrated/holistic watershed modeling.

• Initially focused on hydrologic models but applicable to other modeling application areas.

• Developed by a consortium of industry and academic partners under the EU Water Framework Directive.

• Intended to be first, a standard and second, a toolkit and sample implementation…

04/21/232 of 33http://www.openmi.org/reloaded/about/using-openmi.php

Page 3: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

OpenMI Developers• The HarmoniT project (2002-2005)

consortium includes– CEH, RIZA– DHI, DHI Hydroinfom– Delft Hydraulics– Wallingford Software– University of Dortmund– Instituto di Ricerca Sulle Acque– National Technical University of Athens– WRc– Povodi Labe– Hydroprojekt CZ– Alterra BV– Cemagref

3 of 33http://www.openmi.org/reloaded/about/using-openmi.php

Active development community with all source code posted on sourceforge.net:

98.76% activity, 3,489 downloads since 2005-4-19

Active development community with all source code posted on sourceforge.net:

98.76% activity, 3,489 downloads since 2005-4-19

Page 4: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

4 of 33

OpenMI Compliant Models

Page 5: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

Integrated Modeling

5 of 33

Combining all elements in 1 model may not be practical, but linking models is an achievable goal.

Figure by Susan Anderson and Wiktoria Daniels, Wallingford Software

Page 6: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

Watershed/River Example…

6 of 33

Here we have a distributed watershed model and a stream routing model in 2 different code bases… How to link them together?

Runoff Model

River Model

GetValues(time, LinkID)

Return Runoff Values

Needs input from the runoff model

The OpenMI Document Series: Part B - Guidelines

Page 7: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

7 of 33

Figure by Susan Anderson and Wiktoria Daniels, Wallingford Software

Input/Output Exchange Items…

Element Set Element Set

“Quantities”Or

the “What”

“Elements”Or

the “Where”

Page 8: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

Linkable Components…• void Initialize(IArgument[] properties)• string ComponentID• string ComponentDescription• string ModelID• string ModelDescription• ITimeSpan TimeHorizon• int InputExchangeItemCount• IInputExchangeItem GetInputExchangeItem(int inputExchangeItemIndex)• int OutputExchangeItemCount• IOutputExchangeItem GetOutputExchangeItem(int

outputExchangeItemIndex)• void AddLink (ILink link)• void RemoveLink(string linkID)• string Validate()• void Prepare()• IValueSet GetValues(ITime time, string linkID)• ITimeStamp EarliestInputTime• void Finish()• void Dispose()

8 of 33

ILinkableComponent<<Interface>>

ILinkableComponent

PULL COMMAND

CREATE A LINK

INPUT EXCHANGE ITEMS

OUTPUT EXCHANGE ITEMS

Page 9: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

Data

Model run logic…

9 of 33

Model A

Model B

Model C

For each time step…

GetValues

GetValues

Data

Data

The OpenMI Document Series: Part B - Guidelines

Page 10: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

OPEN SOURCE GIS IMPLEMENTATION

So what are we doing with it…?

10 of 33

Page 11: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

MapWindow GIS in One Slide

11 of 22

• Open source standards based end user GIS and GIS software developer components for Windows.

http://www.mapwindow.org/

Page 12: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

MapWindow GIS in One Slide

12 of 22

• Open source standards based end user GIS and GIS software developer components for Windows.

http://www.mapwindow.org/

Conference spike?

~6000 downloads per month, international development team

Page 13: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

Creating a MapWindow/BASINS Project

13 of 22

Page 14: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

Creating a MapWindow/BASINS Project

14 of 22

Page 15: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

OpenMI Model Manager

15 of 22

Page 16: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

OpenMI Model Manager

16 of 22

Page 17: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

OpenMI Model Manager

17 of 22

Page 18: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

OpenMI Model Manager

18 of 22

Page 19: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

OpenMI Model Manager

19 of 22

Page 20: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

OpenMI Model Manager

20 of 22

Currently this “element viewer” is not connected to the GIS… but gets its data points from the OMI file… We need to change that!

Currently this “element viewer” is not connected to the GIS… but gets its data points from the OMI file… We need to change that!

Page 21: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

OpenMI Model Manager

21 of 22

Page 22: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

OpenMI Model Manager

22 of 22

Page 23: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

OpenMI Model Manager

23 of 22

Page 24: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

OpenMI Model Manager

24 of 22

Output as text file… Instead we should be displaying the output directly in the map…

Output as text file… Instead we should be displaying the output directly in the map…

Page 25: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

Linkage to GIS

25 of 22

Implement both the OpenMI LinkableComponent and MapWindow plug-in interfaces

Implement both the OpenMI LinkableComponent and MapWindow plug-in interfaces

Now the model can interact with the map directly (through MapWindow.iPlugin), as well as with other models (through OpenMI.iLinkable Component).

Now the model can interact with the map directly (through MapWindow.iPlugin), as well as with other models (through OpenMI.iLinkable Component).

This approach serves as a design pattern that could be used to integrate OpenMI more tightly with ArcMap, for example.

This approach serves as a design pattern that could be used to integrate OpenMI more tightly with ArcMap, for example.

Page 26: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

Linkage to GIS

Next steps include:• Build a better OpenMI Configuration Editor “Model Manager”.

Next steps include:• Build a better OpenMI Configuration Editor “Model Manager”.

• Integrate geospatial data processing at time zero – and subsequent steps as needed.

• Integrate geospatial data processing at time zero – and subsequent steps as needed.

• Building a true temporal geospatial GIS.

• Building a true temporal geospatial GIS.

Page 27: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

An Integrated Time Series Modeling + GIS Scenario

27 of 33

Page 28: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

An Integrated Time Series Modeling + GIS Scenario

28 of 29NOAA Coastal Services Center

Page 29: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

An Integrated Time Series Modeling + GIS Scenario

29 of 29NOAA Coastal Services Center

Page 30: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

Summary: Integrating OpenMI with GIS Goals…• Provide seamless integration of OpenMI

compliant hydrologic models within an open source GIS framework.

• Provide an ESRI ModelBuilder–like modeling interface for geoprocessing – but take it further by integrating with complex hydro models.

• Provide opportunities improving integrated environmental modeling systems in MapWindow GIS (i.e. BASINS, D4EM, WaterBase, etc.)

30 of 33

Page 31: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

Summary: Integrating OpenMI with GIS • Current OpenMI Standard will work – all initial

geoprocessing takes place during time step zero.

• Time varying geoprocessing occurs at each time step (could be time consuming!)

• Existing caching mechanism for model outputs should alleviate potential problem of repetetive geoprocessing calls.

31 of 33

Page 32: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

Summary: OpenMI with GIS – changes I’d like to see…• Each Model or Component needs to be able to

be added to the composition or layout multiple times… (i.e. you may want to run Reprojection on multiple data sets.)

• Composition editor needs to explicitly show input and output data sets on the diagram to aid readability, interpretability.

• Compositions should be nestable.• Models should be runtime discoverable (i.e.

rather than opening an omi file)

32 of 33

Page 33: An OpenMI Model Interface Implementation for Hydrologic Modeling in an Open Source GIS Daniel P. Ames, PhD PE Ted Dunsford, PhD Candidate Idaho State University.

04/21/2333 of 33

Daniel P. Ames, PhD, PEIdaho State University

[email protected]

www.hydromap.comwww.mapwindow.org