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

Example pages containing: tips | resources | functions/procedures

Spanning Multiple Files


The addfiles function allows the user to span multiple files. As of version 5.1.0, it copies over meta data.

  ; get list of all files and open as "one big file"
     all_files = systemfunc ("ls /fs/cgd/data0/casguest/CLASS/ann*.nc")
     fall      = addfiles (all_files, "r")   ; note the "s" of addfile
  ; choose how files are combined and read in variable across files
     ListSetType (fall, "cat")             ; concatenate or "merge" (default)
     T    = fall[:]->T                     ; note syntax [:]


The addfiles_GetVar function is deprecated as of V5.1.0. Prior to V5.1.0, you had to use it in conjunction with addfiles to copy metadata:

    load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" 
      fils = systemfunc ("ls /fs/cgd/data0/casguest/CLASS/ann*.nc")
      f    = addfiles (fils, "r")              ; note the "s" of addfile
      T    = addfiles_GetVar (f, fils, "T")