Re: Addfiles and DODS

From: Rick Grubin (grubin AT ucar.edu)
Date: Tue Aug 30 2005 - 10:34:13 MDT

  • Next message: liping deng: "hello! about coordinate variables reverse"

    Hello Maurice,

    > Can anyone give me some examples of how to read a variable across
    > several files accessed via DODS?
    >
    > Traditionally I read a variable off multiple locally stored files like this:
    >
    > files = systemfunc ("ls *.nc")
    > fall = addfiles (files, "r")
    >
    > I am wondering how I can recreate this list (the "files" variable) to
    > store my filenames in. Can I just create an array of strings, with each
    > string containing the filenames? I have just being trying this and it does
    > not seem to work.

    When using OPeNDAP (formerly DODS) functionality within NCL, techniques
    typically used with addfiles(), such as "systemfunc()" clearly won't work,
    because you're reaching across a network to retrieve files, and systemfunc()
    does not support that.

    Thus, the "create an array of strings" approach is best. Using the
    example from the NCL documentation for OPeNDAP:
         http://www.ncl.ucar.edu/Applications/opendap.shtml

    I was able to create three strings (incrementing the year section of the
    filename, from 1948 to 1949 to 1950) and make them an array, as:

         url = "http://www.cdc.noaa.gov/cgi-bin/nph-nc/Datasets/"
         f1 = "ncep.reanalysis.dailyavgs/pressure/air.1948.nc"
         f2 = "ncep.reanalysis.dailyavgs/pressure/air.1949.nc"
         f3 = "ncep.reanalysis.dailyavgs/pressure/air.1950.nc"

         fn1 = url + f1
         fn2 = url + f2
         fn3 = url + f3

         files = (/fn1, fn2, fn3/)
         fall = addfiles(files, "r")

    What sort of error(s) were you seeing when this approach didn't work?

    -Rick.

    --
    Rick Grubin         NCAR/CISL/SCD/VETS
    Visualization + Enabling Technologies
    grubin@ucar.edu           303.497.1832
    _______________________________________________
    ncl-talk mailing list
    ncl-talk@ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncl-talk
    



    This archive was generated by hypermail 2b29 : Tue Aug 30 2005 - 14:12:02 MDT