NCL Home> Application examples> File IO || Data files for some examples

Example pages containing: tips | resources | functions/procedures

OPeNDAP (formerly DODS)

OPeNDAP is a means by which a user can access a remote file over the internet. There are certain caveats to using this functionality in NCL:

  • The file must be located on a OPeNDAP server
  • Only certain operating systems are currently OPeNDAP enabled. NCL can only perform OPeNDAP operations on these supported systems.
  • OPeNDAP works with addfile, addfiles, and isfilepresent.

Here's a test script you can use to see if your version of NCL has OPeNDAP capabilities:

Actual Script

  url      = "http://test.opendap.org/opendap/data/nc/"
  filename = url + "123.nc"
 
  exists = isfilepresent(filename)
  if(.not.exists) then 
    print("OPeNDAP isfilepresent test unsuccessful.")
    print("Either file doesn't exist, or NCL does not have OPeNDAP capabilities on this system")
  else
    print("OPeNDAP isfilepresent test successful.")
    f = addfile(filename,"r")
    vars = getfilevarnames(f)
    print(vars)   ; should be (in any order): "l","j","i","cross","aloan",
                  ; "shot","order","bears"
  end if

It should echo something like:

Variable: vars
Type: string
Total Size: 24 bytes
            6 values
Number of Dimensions: 1
Dimensions and sizes:   [6]
Coordinates: 
(0)     cross
(1)     aloan
(2)     shot
(3)     order
(4)     bears
(5)     l