Prev Up Next Index
Go backward to 4.1.2 Operators, Special Functions, and Data Types
Go up to 4.1 Selecting Data: Using Constraint Expressions
Go forward to 4.1.4 Using URLs in a Constraint Expression

4.1.3 Using Functions in a Constraint Expression

An OPeNDAP data server may define its own set of functions that may be used in a constraint expression. For example, the data server containing the example data from figure 4.1.1 might define a sigma1() function to return the density of the water at the given temperature, salinity and pressure. A query like the following would return all the stations containing water samples whose density exceeded 1.0275g/cm3.

?station.cast&sigma1(station.cast.temp,
                     station.cast.salt,
                     station.cast.press)>27.5

Functions like this one are not a standard part of the OPeNDAP architecture, and may vary from one server to another. A user may query a server for a list of such functions by sending a URL ending with ".info". For example, you can query the data server installed on the OPeNDAP home site with the following URL:

  http://dods.gso.uri.edu/cgi-bin/nph-nc/fnoc1.nc.info
 

The data returned will be an HTML message, readable with a standard web browser, containing documentation of the server running on the given site, and the data named in the URL. In this case, you will learn that the specified server defines two functions that can be used in a constraint expression:

geolocate(variable, lat1, lat2, lon1, lon2)
Returns the elements of variable that fall within the box created by (lat1,lon1) and (lat2,lon2).
time(variable, start_time, stop_time)
Returns the elements of variable that fall within the time interval start_time and stop_time.

Tom Sgouros, August 25, 2004

Prev Up Next