Example
Here’s an example of a very simple catalog:
<?xml version="1.0" ?> <!-- 1 -->
<catalog xmlns="http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0" > <!-- 2 -->
<service name="odap" serviceType="OpenDAP" base="/thredds/dodsC/" /> <!-- 3 -->
<dataset name="SAGE III Ozone 2006-10-31" serviceName="odap" urlPath="sage/20061031.nc" ID="20061031.nc"/> <!-- 4 -->
</catalog> <!-- 5 -->
with this line-by-line explanation:
- The first line indicates that this is an XML document.
- This is the
rootelement of the XML, thecatalogelement. It must declare the THREDDS catalog namespace with thexmlnsattribute exactly as shown. - This declares a
servicenamedodapthat will serve data via the OpenDAP protocol. Many other data access services come bundled with THREDDS. - This declares a
datasetnamedSAGE III Ozone 2006-10-31. It references theodapserviceon line 3, meaning it will be served via OpenDAP. TheURLPathofsage/20061031.ncwill provided a needed compontent to build the access URL - This closes the
catalogelement.
Using the catalog directly above, here are the steps for client software to construct a dataset access URL:
-
Find the
servicereferenced by the dataset:<service name="odap" serviceType="OpenDAP" base="/thredds/dodsC/" /> <dataset name="SAGE III Ozone 2006-10-31" serviceName="odap" urlPath="sage/20061031.nc" ID="20061031.nc"/> - Append the
service basepath to the server root to construct the service base URL:- serverRoot =
http://hostname:port - serviceBasePath =
/thredds/dodsC/ - serviceBaseUrl =
serverRoot + serviceBasePath =http://hostname:port/thredds/dodsC/`
- serverRoot =
- Find the
urlPathreferenced by thedataset:<dataset name="SAGE III Ozone 2006-10-31" serviceName="odap" urlPath="sage/20061031.nc" ID="20061031.nc"/> - Append the
dataseturlPathto theservice baseURL to get the dataset access URL:- serviceBaseUrl =
http://hostname:port/thredds/dodsC/ - datasetUrlPath =
sage/20061031.nc - datasetAccessUrl = serviceBaseUrl + datasetUrlPath =
http://hostname:port/thredds/dodsC/sage/20061031.nc
- serviceBaseUrl =
In summary, construct a URL from a client catalog with these 3 pieces:
http://hostname:port/thredds/dodsC/sage/20061031.nc
<------------------><------------><--------------->
server service dataset