Skip Navigation Link www.nws.noaa.gov  
NOAA logo - Click to go to the NOAA homepage National Weather Service   NWS logo - Click to go to the NWS homepage
Hydrometeorological Design Studies Center
   
Local forecast by
"City, St"

 
 
Table of Contents<<<

Appendix A -- Example Code Use of Procedural Data Access APIs

A partial definition of a data object class timeSeries for use by the example code fragments. The definition is not presented in a formal definition syntax. It is meant only to demonstrate the type of information needed in sufficient detail for the reader to understand the code fragments. data class timeSeries has attributes objectId string required read-only owner string required read-only run string required read-only isRunCommited boolean required read-only modifiedTime timestructure required read-only createdTime timestructure required read-only type string requires read-only timeSeriesID string required read-only increment integer required read-only datastartTime timestructure required read-only dataStopTime timestructure required read-only numIntervals integer required read-only referenceSite objectId read-only lattitude real read-only : : : has data repeating group timeSeriesData has attributes units string has items dataPoint real has attributes quality integer timestamp timestructure has interfaces positionDataGroup getCurrGroupAttr getCurrGroupItem getCurrItemAttr : has interfaces LocateDataObject openDataObject getObjectAttribute closeDataObject : Using the given data class timeSeries logical definition, the following code fragments demonstrate the use of data access APIs. integer starttime,stopTime,increment integer status,numberDataObjects character*16 objectId character*8 timeSeriesId character*32 selectionCriteria(20) Dimension selectionCriteria(4),starttime(3),stoptime(3) Dimension objectId(100) c selectionCriteria(1)= 'timeSeriesId =' selectionCriteria(2)= 'increment = ' selectionAtrributes(3)= 'END' c c get objectId for desired data status = LocateDataObject( 1NumberDataObjects, 2objectId 1'MAP', 2'timeSeries', 3selectionCriteria, 4timeSeriesID, 5increment) c Check return status IF (status .NE. 0 .OR. numberDataObects .NE. 1) GOTO 900 c c instantiate (open) data set status = openDataObject(objectId(1),'read',true) IF (status .NE. 0 ) goto 900 c c process data do 100 i=1,numIntervals status=positionDataGroup(objectID, 'timeSeriesData', I) IF (status .NE. 0 ) goto 900 status=getCurrGroupAttr(objectId,'units',dataunit IF (status .NE. 0 ) goto 900 status=getCurrGroupItem(objectID, 'dataPoint',datavalue) IF (status .NE. 0 ) goto 900 status=getCurrItemAttr(objectId,'quality',dataQuality) IF (status .NE. 0 ) goto 900 status=getCurrGroupItem(objectID, 'timeStamp',timevalue) IF (status .NE. 0 ) goto 900 c do some stuff c 100 continue c status=closeDataObject(objectId) c and so on

Return to IHFS Table of Contents


Main Link Categories:
Home | NWS

US Department of Commerce
National Oceanic and Atmospheric Administration
National Weather Service
Office of Hydrologic Development
1325 East West Highway
Silver Spring, MD 20910

Page Author: OHD webmaster
Page last modified: October 28, 2011
Disclaimer
Credits
Glossary
Privacy Policy
About Us
Career Opportunities