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

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:

Actual Script

    begin
    ; The URL is so long, break it into two pieces.
      url      = "http://www.cdc.noaa.gov/cgi-bin/nph-nc/Datasets/"
      filename = "ncep.reanalysis.dailyavgs/pressure/air.1948.nc"

      exists = isfilepresent(url+filename)
      if(.not.exists) then
        print("OPeNDAP test unsuccessful.")
	print("Either file doesn't exist, or NCL does not have OPeNDAP /
	capabilities on this system")
      else
        f = addfile(url + filename,"r")
        variables = getfilevarnames(f)
                     
        print(variables)     ; will print a list of variable names on the file
      end if
    end