state of r in hydrological modelling

22
State of R in Hydrological Modelling Torres & Pebesma Motivation Functionality in R Data management and R Spatial- temporal analysis Hydrological analysis in R Contribution Conclusions Questions Bibliography State of R in Hydrological Modelling Jairo A. Torres Edzer Pebesma Institute for Geoinformatics, ifgi, University of M¨ unster, Germany 2nd OpenWater symposium and workshops September 16th, 2013 Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 1 / 22

Upload: others

Post on 05-Jan-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

State of R in Hydrological Modelling

Jairo A. TorresEdzer Pebesma

Institute for Geoinformatics, ifgi, University of Munster, Germany

2nd OpenWater symposium and workshopsSeptember 16th, 2013

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 1 / 22

Page 2: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Motivation

Justification

I Material flows to coastal waters: complex interactionI catchment boundaries,I human activities therein,I trade of materials.

I Trans-boundary processesI residence time,I transport and fate of WQ determinants

I physical,I chemical,I microbiological.

I WQ status: global implications

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 2 / 22

Page 3: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Motivation

Purpose

I Models for real-time flow predictionI improve decision making [Beven, 2012]

I water resources planningI flood protectionI mitigation of contamination

German Federal Institute of Hydrology - BfG. 26.06.2013 19:40

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 3 / 22

Page 4: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Motivation

Purpose

I model comparison in structure, calibration methods andsimulation events is essential for choosing objectively thesuitable model configuration in hydrological modelling

I a novel, versatile, and open source language is providedby the R Project for Statistical Computing[Ihaka and Gentleman, 1996, R Development Core Team, 2013]

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 4 / 22

Page 5: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Motivation

Motivation

I Several packages have been developed in R code fordeveloping, implementing and evaluating differenthydrological modelling tools and frameworks

I R language is an emerging environment where researchand development are the primary purpose

I R is mostly being developed by its users, i.e. domainexperts, not by programmers without hydrologyknowledge (this implies commitment and long-terminvolvement, but also at times messy code)

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 5 / 22

Page 6: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Motivation

Motivation

I Comprehensive modelling framework

I Uncertainty analysisI Identify primary physical controlsI Coupling inland hydrological models with coastalI Regional, transboundary and global scales

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 6 / 22

Page 7: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Motivation

Motivation

I Open source data and software in R, for:

I statistical analysis and graphicsI suitable and reproducible modelling frameworkI basic data manipulation

(import, export, selection, joining of tables)I spatial interpolationI calibration and simulationI uncertainty analysisI geospatial capabilities for querying, updating, sharing and

visualization of data, methods and resultsI general tools as support in hydrological analysis

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 7 / 22

Page 8: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Functionality in R

Useful functionality in R

I R as statistical computing and graphics environment,provides a large amount of generic functionality useful inhydrological modelling:

I MCMC outputs

I print quality visualising

I time series

I spatial and spatio-temporal data

I geostatistics, downscaling, upscaling,

I aggregation and disaggregation

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 8 / 22

Page 9: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Functionality in R

Useful functionality in R

I Higher level functionality:

I cross platformI easy dissemination and new extensionI reproducible researchI support

open mailing lists, forums, companies, booksI open and active community

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 9 / 22

Page 10: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Data management and R

Data management and R

I reproducibility in research:I share a common data

modelI independence of modelling

framework

I standardised open data forresearch:

I ECRINS datasetI EOBS datasetI web services

22°0'0"E

20°0'0"E

20°0'0"E

18°0'0"E

18°0'0"E

16°0'0"E

16°0'0"E

14°0'0"E

14°0'0"E

12°0'0"E

12°0'0"E

10°0'0"E

10°0'0"E

8°0'0"E

8°0'0"E

7°0'0"E6°0'0"E

6°0'0"E

5°0'0"E4°0'0"E

4°0'0"E

3°0'0"E2°0'0"E

2°0'0"E

1°0'0"E0°0'0"

0°0'0"

1°0'0"W2°0'0"W

2°0'0"W

3°0'0"W4°0'0"W

4°0'0"W

5°0'0"W

6°0'0"W8°0'0"W

53°0'0"N52°0'0"N

52°0'0"N51°0'0"N

51°0'0"N50°0'0"N

50°0'0"N49°0'0"N

49°0'0"N48°0'0"N

48°0'0"N47°0'0"N

47°0'0"N46°0'0"N

46°0'0"N45°0'0"N

45°0'0"N44°0'0"N

44°0'0"N43°0'0"N

43°0'0"N42°0'0"N

42°0'0"N

Legendc_tr_RDouro-Z_C0000049c_tr_RSabor-Z_C0000034C_SS_RSabor

18°0'0"E

18°0'0"E

17°0'0"E

17°0'0"E

16°0'0"E

16°0'0"E

15°0'0"E

15°0'0"E

48°0'0"N

48°0'0"N

47°0'0"N

47°0'0"N

Legendc_tr-Stralher3-6c_tr_RDouro-Z_C0000049c_tr_RSabor-Z_C0000034C_SS_RSabor

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 10 / 22

Page 11: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Data management and R

Database access and manipulation

I foreign package [R Core Team et al., 2013]

I read.dbf: importing .dbf file −→ R dataframe

I sp package [Pebesma and Bivand, 2012]

I ESRI polygon shapefile −→ SpatialPolygonsI SpatialPoints & SpatialLines

I geospatial data abstraction library (GDAL) −→ rgdal[Bivand et al., 2013]

I multiple classes of spI projection/transformation operations −→ PROJ.4 libraryI ESRI Shapefiles and PGDBs .mdb files −→ OGR library

I igraph: network analysis and visualization

(Csardi, 2013)

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 11 / 22

Page 12: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Spatial-temporal analysis

Spatial and temporal analysis

spacetime package

I container forspatio-temporallyreferenced

I time series of points

I spatio-temporal fields

I catchment time series

[Pebesma, 2012]

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 12 / 22

Page 13: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Spatial-temporal analysis

Web services and interoperability

I RObsDat by Reusser and Liersch (this Symposium)

I R provides generic interfaces to curl and libxml

I RCurl package [Lang, 2013a]

I XML package [Lang, 2013b]

I access web servicesI sos4R [Nust et al., 2011]I retrieve sensor data from an OGC sensor observation

serviceI retrieve data in waterML.

I Rserve package −→ web service interface [Urbanek, 2013]

I WPS4R [Hinz et al., 2013]: higher-level, generic OGC WPSinterface

52◦North WPS

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 13 / 22

Page 14: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Hydrological analysis in R

Hydrological Model Assessmentand Development, hydromad

[Andrews et al., 2011]

IHACRES CWI model with exponential unit hydrograph

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 14 / 22

Page 15: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Hydrological analysis in R

topmodel, semi-distributed model

[Beven et al., 1995, Beven, 1997]

I 1995 Fortran version byKeith Beven

I R version by [Buytaert, 2012]

I new functionality developedas part of the RHydro

package on R-Forge

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 15 / 22

Page 16: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Hydrological analysis in R

Further hydrological functionality

I there are nearly 5000 packages on CRANI several additional packages published at CRAN in the

area of hydrologyI HydroMe packageI hydroTSM packageI hydroGOFI hydroPSOI EcoHydRologyI wasimI seacarbI StreamMetabolismI oceI nsRFAI boussinesqI rtop

http://cran.r-project.org/web/views/Environmetrics.html

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 16 / 22

Page 17: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Contribution

Current contribution

watersheds package

I spatial analysis for watershedsaggregation

I spatial drainage networks analysis

I based on sp and rgeos packages(Pebesma & Bivand, 2005-2012)

Looking forward:

I Modelling framework for real-timeflow prediction

I flood assessmentI mitigation of contamination

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 17 / 22

Page 18: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Conclusions

Conclusions

I we present an introduction to the state-of-art ofhydrological modelling as is developed in the opensource software R.

I this constitutes a starting point for researchbecause it grants a suitable programming platformwhere standardised tests and comparisons ofmodels is possible, searching for reproducibility ofmethods and results as is often required in thecontext of science and research.

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 18 / 22

Page 19: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Questions

Thank you!

Questions?

[email protected]

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 19 / 22

Page 20: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Bibliography

Bibliography I

Andrews, F. T., Croke, B. F. W., and Jakeman, A. J. (2011).

An open software environment for hydrological model assessment and development.Environmental Modelling and Software, 26.

Beven, K., Lamb, R., Quinn, P., Romanowicz, R., and Freer, J. (1995).

TOPMODEL.In Sing, V. P., editor, Computer Models of Watershed Hydrology. Water Resources Publications,Colorado. pp. 627-668.

Beven, K. J. (1997).

Distributed Hydrological Modelling: Applications of the TOPMODEL Concept.Wiley.

Beven, K. J. (2012).

Rainfall-Runoff Modelling: The Primer.Wiley-Blackwell.Lancaster University, UK.

Bivand, R., Keitt, T., Rowlingson, B., Pebesma, E., Sumner, M., and Hijmans, R. (2003-2013).

Package ”rgdal”: Bindings for the Geospatial Data Abstraction Library.The Comprehensive R Archive Network, CRAN, 0.8-9 edition.

Buytaert, W. (2012).

Package ’topmodel’.The Comprehensive R Archive Network, CRAN.

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 20 / 22

Page 21: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Bibliography

Bibliography II

Hinz, M., Nust, D., Proß, B., and Pebesma, E. (2013).

Spatial Statistics on the Geospatial Web.short paper, Agile 2013 proceedings.

Ihaka, R. and Gentleman, R. (1996).

R: a languague for data analysis and graphics.Journal of Computational and Graphical Statistics, 5:299–314.

Lang, D. T. (2000-2013b).

Package ”XML”: Tools for parsing and generating XML within R and S-Plus.The Comprehensive R Archive Network, CRAN, 3.96-1.1 edition.

Lang, D. T. (2004-2013a).

Package ”RCurl”: General network (HTTP/FTP/...) client interface for R.The Comprehensive R Archive Network, CRAN, 1.95-4.1 edition.

Nust, D., Stasch, C., and Pebesma, E. J. (2011).

Connecting R to the Sensor Web.In Geertman, S., Reinhardt, W., and Toppen, F., editors, Advancing Geoinformation Science for aChanging World, Proceedings of AGILE, pages 227 – 246. Springer Lecture Notes in Geoinformationand Cartography.

Pebesma, E. (2012).

spacetime: Spatio-temporal data in r.Journal of Statistical Software, 51, Issue 7.http://www.jstatsoft.org/.

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 21 / 22

Page 22: State of R in Hydrological Modelling

State of R inHydrological

Modelling

Torres &Pebesma

Motivation

Functionalityin R

Datamanagementand R

Spatial-temporalanalysis

Hydrologicalanalysis in R

Contribution

Conclusions

Questions

Bibliography

Bibliography

Bibliography III

Pebesma, E. and Bivand, R. (2005-2012).

Package ”sp”: classes and methods for spatial data.The Comprehensive R Archive Network, CRAN, 0.9-99 edition.

R Core Team, Bivand, R., Carey, V. J., DebRoy, S., Eglen, S., Guha, R., Lewin-Koh, N., Myatt, M.,

Pfaff, B., Warmerdam, F., Weigand, S., and Free Software Foundation, Inc. (1999-2013).Package ”foreign”: Read Data Stored by Minitab, S, SAS, SPSS, Stata, Systat, dBase,...The Comprehensive R Archive Network, CRAN, 0.8-54 edition.

R Development Core Team (2013).

R: A Language and Environment for Statistical Computing.

Urbanek, S. (2006-2013).

Package ”Rserve”: Binary R server.The Comprehensive R Archive Network, CRAN, 0.6-8.1 edition.

Torres & Pebesma (ifgi-WWU) State of R in Hydrological Modelling 16.09.2013 22 / 22