Using Python to Retrieve Data from the CUAHSI HIS Web Services Jon Goodall Hydroinformatics Fall 2014 This work was funded by National Science Foundation.

Slides:



Advertisements
Similar presentations
HydroServer A Platform for Publishing Space- Time Hydrologic Datasets Support EAR CUAHSI HIS Sharing hydrologic data Jeffery.
Advertisements

Linking HIS and GIS How to support the objective, transparent and robust calculation and publication of SWSI? Jeffery S. Horsburgh CUAHSI HIS Sharing hydrologic.
This work is funded by National Science Foundation Grant EAR Accessing and Sharing Data Using the CUAHSI Hydrologic Information System CUAHSI HIS.
CUAHSI HIS Data Services Project David R. Maidment Director, Center for Research in Water Resources University of Texas at Austin (HIS Project Leader)
Components of an Integrated Environmental Observatory Information System Cyberinfrastructure to Support Publication of Water Resources Data Jeffery S.
This work was funded by the U.S. National Science Foundation under grant EAR Any opinions, findings and conclusions or recommendations expressed.
Time Series Analyst An Internet Based Application for Viewing and Analyzing Environmental Time Series Jeffery S. Horsburgh Utah State University David.
Development of a Community Hydrologic Information System Jeffery S. Horsburgh Utah State University David G. Tarboton Utah State University.
Integrating Historical and Realtime Monitoring Data into an Internet Based Watershed Information System for the Bear River Basin Jeff Horsburgh David Stevens,
Introducing the CUAHSI Hydrologic Information System Desktop Application (HydroDesktop) and Open Development Community Jiří Kadlec, Daniel Ames, Teva Velupillai.
Deployment and Evaluation of an Observations Data Model Jeffery S Horsburgh David G Tarboton Ilya Zaslavsky David R. Maidment David Valentine
An End-to-End System for Publishing Environmental Observations Data Jeffery S. Horsburgh David K. Stevens, David G. Tarboton, Nancy O. Mesner, Amber Spackman.
Tools for Publishing Environmental Observations on the Internet Justin Berger, Undergraduate Researcher Jeff Horsburgh, Faculty Mentor David Tarboton,
Using HydroServer Organize, Manage, and Publish Your Data Support EAR CUAHSI HIS Sharing hydrologic data Jeffery S. Horsburgh.
Section 01Resources1 HSQ - DATABASES & SQL 01 Resources And Franchise Colleges Name :MANSHA NAWAZ room :G 0/32
About CUAHSI The Consortium of Universities for the Advancement of Hydrologic Science, Inc. (CUAHSI) is an organization representing 120+ universities.
1 Working with MS SQL Server. 2 Objectives You will be able to Use Visual Studio for GUI based interactive access to a Microsoft SQL Server database.
Ocean Sciences What is CUAHSI? CUAHSI – Consortium of Universities for the Advancement of Hydrologic Science, Inc Formed in 2001 as a legal entity Program.
About CUAHSI The Consortium of Universities for the Advancement of Hydrologic Science, Inc. (CUAHSI) is an organization representing 120+ universities.
Data Interoperability in the Hydrologic Sciences The CUAHSI Hydrologic Information System David Tarboton, David Maidment, Ilya Zaslavsky, Dan Ames, Jon.
James Seppi CE394K Hydrology, Spring 2010 University of Texas.
WRITING REPORTS Introduction Section 0 Lecture 1 Slide 1 Lecture 6 Slide 1 INTRODUCTION TO Modern Physics PHYX 2710 Fall 2004 Intermediate 3870 Fall 2015.
The CUAHSI Hydrologic Information System Presented by Dr. Tim Whiteaker The University of Texas at Austin 22 February, 2011.
OOSSE Week 8 JSP models Format of lecture: Assignment context JSP models JSPs calling other JSPs i.e. breaking up work Parameter passing JSPs with Add.
The CUAHSI Observations Data Model Jeff Horsburgh David Maidment, David Tarboton, Ilya Zaslavsky, Michael Piasecki, Jon Goodall, David Valentine,
Data Model / Database Implementation (continued) Jeffery S. Horsburgh Hydroinformatics Fall 2014 This work was funded by National Science Foundation Grants.
Storing and Publishing Water Observations Data Services Tim Whiteaker The University of Texas at Austin.
Publication Alternatives: Hybrid Data Services Table Views Presented by Tim Whiteaker The University of Texas at Austin 4 June, 2009.
Lecture 11 Introduction to R and Accessing USGS Data from Web Services Jeffery S. Horsburgh Hydroinformatics Fall 2013 This work was funded by National.
Lecture 9 Using Structured Query Language (SQL) Jeffery S. Horsburgh Hydroinformatics Fall 2012 This work was funded by National Science Foundation Grant.
Using Python to Retrieve and Visualize Data (part 1 of 2) Jon Goodall Hydroinformatics Fall 2014 This work was funded by National Science Foundation Grants.
Lecture 5 Data Model Design Jeffery S. Horsburgh Hydroinformatics Fall 2012 This work was funded by National Science Foundation Grant EPS
Hydroinformatics Lecture 15: HydroServer and HydroServer Lite The CUAHSI HIS is Supported by NSF Grant# EAR CUAHSI HIS Sharing hydrologic data.
Using Python to Retrieve Data from the CUAHSI HIS Web Services Jeffery S. Horsburgh Hydroinformatics Fall 2015 This work was funded by National Science.
1 of 42 Lecture 5 Data Model Design Jeffery S. Horsburgh Hydroinformatics Fall 2013 This work was funded by National Science Foundation Grants EPS
Developing a community hydrologic information system David G Tarboton David R. Maidment (PI) Ilya Zaslavsky Michael Piasecki Jon Goodall
Jeffery S. Horsburgh Hydroinformatics Fall 2014
The CUAHSI Hydrologic Information System Spatial Data Publication Platform David Tarboton, Jeff Horsburgh, David Maidment, Dan Ames, Jon Goodall, Richard.
Hydroinformatics Lecture: HydroServer .NET/PHP
Development Environment
Sharing Hydrologic Data with the CUAHSI* Hydrologic Information System
R: Working with Databases
Python Programming Challenge
Project Center Use Cases Revision 2
Project Center Use Cases
The CUAHSI Hydrologic Information System and NHD Plus A Services Oriented Architecture for Water Resources Data David G Tarboton David R. Maidment (PI)
Segments Basic Uses: slides minutes
Lecture 19 Automating Preparing and Entering Model Data in WEAP
R: Packages and Data Retrieval
R: Packages and Data Retrieval
Jeffery S. Horsburgh Utah State University
Using Python to Interact with the EPA WATERS Web Services
Data Virtualization Community Edition
Using Structured Query Language (SQL) (continued)
Project Center Use Cases
Lecture 8 Database Implementation
EBSCO eBooks.
CUAHSI HIS Sharing hydrologic data
Hydroinformatics Lecture 15: HydroServer (and HydroServer Lite)
Project Center Use Cases Revision 3
Project Center Use Cases Revision 3
Data Acquisition, Management and Manipulation
Using Python to Interact with the EPA WATERS Web Services (part 2)
HydroDesktop: A Key Component of the CUAHSI/CZO HIS for Hydrologic Data Discovery, Visualization, and Analysis Daniel P. Ames, Ph.D. P.E. Idaho State University.
Types of SQL Commands Farrokh Alemi, PhD
David Tarboton, Dan Ames, Jeffery S. Horsburgh, Jon Goodall
Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg
Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg
Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg
Web Application Development Using PHP
Presentation transcript:

Using Python to Retrieve Data from the CUAHSI HIS Web Services Jon Goodall Hydroinformatics Fall 2014 This work was funded by National Science Foundation Grants EPS and EPS

Class Plan Introduction (setting this material within context) Set up – Software requirements In class demos – Example 1: Getting the site name for a USGS NWIS station using the CUAHSI HIS Web Services – Example 2: Getting the minimum streamflow over the past five days for a USGS NWIS station using the CUAHSI HIS Web Services Challenge problems Wrap up – Further reading – Thursday’s class

Big Picture Context Data life cycle -> data modeling -> database design -> database implementation -> ODM -> SQL Querying of an ODM -> Python programming against an ODM -> sharing data from an ODM using CUAHSI HIS Web services (WaterOneFlow) and WaterML -> Accessing CUAHSI HIS Web services using HydroDesktop -> This week: Accessing CUAHSI HIS Web services using Python

Set up …

Install the suds package Start Canopy Open the Package Manager Search for the ‘suds 0.4-1’ package Install this package Requires you to sign in with an account that has an academic license. Close the package manager

Test the installation of the suds package Within Canopy – Open the Editor – At the command line, type ‘import suds’ as shown below – In [1]: import suds – If you don’t get an error, then suds is installed correctly. – If you do get an error, repeat the instructions to install the suds package.

What is the suds package? “Suds is a lightweight SOAP Python client for consuming Web Services." SOAP and WSDL are standards for creating web services. You don’t need to know the details behind these standards, but if you are interested, Wikipedia has a good summary of both: – SOAP: – WSDL: tion_Languagehttp://en.wikipedia.org/wiki/Web_Services_Descrip tion_Language

In class examples …

Example 1: Get the site name for a USGS NWIS station using the CUAHSI HIS Web Services Use the GetSiteInfo method on the CUAHSI HIS WaterOneFlow web services – eInfo eInfo Use the suds Client object to call the web service method – We will use siteCode = USGS: Suds will automatically parse the WaterML response from the web service call. We will need to find the siteName property in the response and print it to the console. The answer for USGS: is: LOGAN RIVER ABOVE STATE DAM, NEAR LOGAN, UT I will walk you through building the code in class, but you can download an up-to-date version of the code here.here

Pros and Cons of using Web Services vs a local ODM database Pros: – Access to the entire NWIS database without the need to store the data locally – No need to keep local local in sync with USGS version Cons: – Requires Internet connection – Speed: Getting data via web services will almost certainly be slower than getting data from your own database – Data is outside your control: breaking changes, unavailable services, etc. – (Some of these could be improved with a data caching strategy)

Example 2: Getting the minimum streamflow over the past five days for a USGS NWIS station using the CUAHSI HIS Web Services Use the GetValuesObject method on the CUAHSI HIS WaterOneFlow web services – Like example 1, Use the suds Client object to call the web service method We will use siteCode = USGS: and ParameterCode = USGS= DateTimes should be in the format YYYY-MM-DD. We will extract the values and dateTimes and create a Pandas Series object to store the time series. We will use the min and idxmin methods on the Series object to get the minimum streamflow and datetime when the minimum streamflow occurred. – – I will walk through this in class, but you can download an up-to-date version of this code here.here Note: This works with Pandas version and with version , but may cause errors with earlier versions of Pandas. If you get an error, check your version of Pandas in the Canopy Package Manager and upgrade the version of Pandas if needed.

Using these principles for other WaterOneFlow Web services CUAHSI HIS Central lists other available web services that can be accessed in a similar way – – There are over 400 billion observations available through HIS Central! The HydroServers you created last week with Dr. Ames can also be accessed using this same approach. – If you would like to do this for your class project, get in touch with Dr. Ames.

Challenge problems …

Coding Challenges For the same station (USGS: ), modify the example 2 script so that it prints the daily min, max, and average streamflow for the past 5 days. (time permitting) Modify your script so that it prints out the min, max, and average streamflow for EACH DAY during the past 5 days  this is part of what you will need to do for Assignment 8.

Wrap up …

Further reading Details on the CUAHSI HIS web services are available here: – Read about WaterOneFlow (the WSDL) to learn more about the methods – Read about WaterML version 1.0 to learn more about the structure of the responses The WaterML example response are particularly helpful to seeing the structure of the response – Note that some services will return WaterML in version 1.1 format. The code shown in this lecture may require slight modification to work with these services.

Thursday’s Class Dr. Horsburgh will be leading class. Introduce Assignment 8. Work on the assignment in class.