1 / 54

CUAHSI WaterOneFlow Web Services

CUAHSI WaterOneFlow Web Services. By Tim Whiteaker CE 394K.2 Hydrology 1 February 2007. Outline. What are Web Services What is WaterOneFlow What is WaterML How do we use HIS Analyst to access WaterOneFlow. 16. 4. Math library. Program. Programs Use Functions.

bijan
Download Presentation

CUAHSI WaterOneFlow Web Services

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CUAHSI WaterOneFlowWeb Services By Tim Whiteaker CE 394K.2 Hydrology 1 February 2007

  2. Outline • What are Web Services • What is WaterOneFlow • What is WaterML • How do we use HIS Analyst to access WaterOneFlow

  3. 16 4 Math library Program Programs Use Functions • Functions are pieces of code that perform a specific task What’s the square root of 16? result = Math.SquareRoot(16) Functions: Add Multiply SquareRoot

  4. Functions: What’s the square root of 16 Add Multiply SquareRoot The answer is 4 Math library Service Program Web Services Let Computers Share Functions • Localprograms take advantage of remote resources • Works just like local function result = Service.SquareRoot(16) Client

  5. How Do Web Services Work • SOAP (Simple Object Access Protocol) is a protocol for exchanging messages over a network • WSDL (Web Services Description Language) is a language for describing what a web service can do

  6. How Do Web Services Work Server SOAP WSDL (This is what I can do) Client SOAP is like speaking the same languageWSDL is like a contract

  7. CUAHSI Web Services (WaterOneFLow) • Standard mechanism for flow of hydrologic data between hydrologic data servers (databases) and users. • Provides data access to • USGS NWIS • EPA STORET • NCEP North American Model (NAM) • NASA MODIS • Daymet • NWS ASOS http://water.sdsc.edu/waterOneFlow/

  8. Water Data Web Sites

  9. NWISWeb site output # agency_cd Agency Code # site_no USGS station number # dv_dt date of daily mean streamflow # dv_va daily mean streamflow value, in cubic-feet per-second # dv_cd daily mean streamflow value qualification code # # Sites in this file include: # USGS 02087500 NEUSE RIVER NEAR CLAYTON, NC # agency_cd site_no dv_dt dv_va dv_cd USGS 02087500 2003-09-01 1190 USGS 02087500 2003-09-02 649 USGS 02087500 2003-09-03 525 USGS 02087500 2003-09-04 486 USGS 02087500 2003-09-05 733 USGS 02087500 2003-09-06 585 USGS 02087500 2003-09-07 485 USGS 02087500 2003-09-08 463 USGS 02087500 2003-09-09 673 USGS 02087500 2003-09-10 517 USGS 02087500 2003-09-11 454 Time series of streamflow at a gaging station

  10. Observation Stations Map for the US Ameriflux Towers (NASA & DOE) NOAA Automated Surface Observing System USGS National Water Information System NOAA Climate Reference Network

  11. Consistent Query Format Consistent Data Format WaterOneFlow

  12. WaterOneFlow Methods • (Almost) the same for all networks • Methods • GetSiteInfo – Give me info about a site • GetVariableInfo – Give me info about a variable • GetValues – Give me a time series for a variable at a site

  13. Input Network name and site code Authorization token Output Site name Site location Variables measured at the site Variable code Period of record GetSiteInfo where response = service.GetSiteInfo("NWIS:08158000", "")

  14. Input Network name and variable code Authorization token Output Variable name Variable description Variable units what GetVariableInfo response = service.GetVariableInfo("NWIS:00060", "")

  15. Input Network name and location (e.g., site code) Network name and variable code Start datetime End datetime Authorization token Output Site info Variable info Time series what GetValues where response = service.GetValues("NWIS:08158000", "NWIS:00060", _ "2006-12-31T01:00:00", "2006-12-31T08:00:00", "") when

  16. The “Where” in GetValues • Works for sites, or geographic locations • NetworkName:SiteCode • NWIS:08158000 • GEOM:POINT(LongitudeLatitude) • GEOM:POINT(-113 35) • GEOM:BOX(WLon SLat,ELon NLat) • GEOM:BOX(-108 45,-107 46)

  17. Locations Variable Codes Date Ranges Extract – Transform – Load STORET Data GetSiteInfo GetVariableInfo GetValues Data NAM NWIS WaterML Data WaterOneFlow Web Service Data Repositories Client EXTRACT TRANSFORM LOAD

  18. WaterML – The Output of WaterOneFlow • Standardized for all data sources • Formats • Object • XML (for programs that can’t handle objects) • Defined in XML

  19. XML – A Primer • The Extensible Markup Language (XML) is a W3C-recommended general-purpose markup language that supports a wide variety of applications. – Wikipedia • XML represents data • XML is both human and machine readable <site> <name>Mansfield Dam</name> </site>

  20. element start tag end tag XML Structure • Example – Let’s describe a streamflow site element name = “site” <site></site> OR <site> </site> OR <site />

  21. child element element element text Elements can have Children <site> <name>Mansfield Dam</name> </site>

  22. Elements can have Attributes <site> <name>Mansfield Dam</name> <siteCodenetwork=“NWIS”>08154510</siteCode> </site> attribute name attribute value

  23. XML Nesting <site> <name>Mansfield Dam</name> <siteCodenetwork=“NWIS”>08154510</siteCode> <location> <latitude>30.39</latitude> <longitude>97.91</longitude> </location> </site>

  24. WaterML • XML for describing water data • Defined at • WaterOneFlow returns data in WaterML format http://water.sdsc.edu/waterOneFlow/documentation/schema/

  25. USGS Data Source WaterML Response Streamflow gages Network SiteInfoResponseType Neuse River near Clayton, NC Sites VariablesResponseType Discharge, stage (Daily or instantaneous) Variables TimeSeriesResponseType Values 206 cfs, 13 August 2006 {Value, Time, Qualifier} • A data source operates an observation network • A network is a set of observation sites • A site is a point location where one or more variables are measured • A variable is a property describing the flow or quality of water • A value is an observation of a variable at a particular time • A qualifier is a symbol that provides additional information about the value Point Observations Information Model http://www.cuahsi.org/his/webservices.html

  26. Response Types SiteInfo Variables TimeSeries Key Elements site sourceInfo seriesCatalog variable timeSeries values queryInfo WaterML Key Elements GetSiteInfo GetVariableInfo GetValues

  27. SiteInfoResponseType • Namespaces • queryInfo • site Network Sites Variables

  28. queryInfo • Parameters sent to service • URLs called (if external resource)

  29. userparameters query URL queryInfo – Another Example

  30. site • siteInfo – info about the site • seriesCatalog – catalogs of variables measured

  31. siteInfo • Name • Site Code • Location

  32. geoLocation • geogLocation – geographic coordinates • LatLon point • LatLon box • localSiteXY – projected coorindates European Petroleum Survey Groupi.e., NAD 83, etc.

  33. name web service location series (variables) original data source seriesCatalog

  34. series • variable – what is measured • valueCount – how many measurements • variableTimeInterval – when is it measured

  35. variable • variableCode – global identifier • variableName • units Sites Variables Values

  36. variableTimeInterval • TimeIntervalType – date range • TimeSingleType – single measurement • TimePeriodRealTimeType – last n days

  37. ISO Time • International Organization for Standardization • 1998-03-01T14:30:00 = March 1, 1998, at 2:30 in the afternoon

  38. queryInfo name code location site seriesCatalog what how many variables when SiteInfo Response, Recap

  39. VariablesResponseType • variable – same as in series element • Code, name, units Sites Variables Values

  40. Additional variable Children • variableDescription • valueType (enumeration) • Field Observation • Sample • Model Simulation Result • Derived Value • generalCategory – e.g., “water quality” • sampleMedium – e.g., “water column” -- Many are optional

  41. TimeSeriesResponseType • queryInfo • timeSeries • sourceInfo – “where” • variable – “what” • values Sites Variables Values

  42. sourceInfo • SiteInfoType • Same as siteInfo element • code, name, location • DataSetInfoType • For data continuous in space • LatLonPointType • LatLonBoxType

  43. variable • Same as previous variable element • code, name, units, etc.

  44. values • Each time series value recorded in value element • Timestamp, plus metadata for the value, recorded in element’s attributes qualifier ISO Time value

  45. value Metadata Examples • qualifiers • censorCode (lt, gt, nc) • qualityControlLevel (Raw, QC’d, etc.) • methodID • offset • offsetValue • offsetUnitsAbbreviation • offsetDescription • offsetUnitsCode

  46. TimeSeries Response, Recap queryInfo location variable values

  47. Conclusions about WaterML • Consistent Format • Includes lots of information • How do I use it? HIS Analyst

  48. HIS Analyst • Desktop apps that use WaterOneFlow • Examples for various application environments • HydroObjects – for apps that aren’t web service enabled • Workbook available at: http://www.cuahsi.org/his/docs/HIS-workbook-20061130.pdf

  49. HIS Workbook • Ingesting NWIS Data into Excel • Ingesting STORET Data into Excel • Ingesting Weather and Streamflow Data into ArcGIS • Plotting MODIS Data with Matlab • Ingesting NWIS Data using VB.Net • Ingesting NWIS Data Using Java

  50. Excel Demo

More Related