NCL Home > Documentation > Language

NCL's supported file formats

The file handling capabilities of NCL represent one of its greatest strengths. In addition to being able to read and write the usual binary and ASCII files, NCL can import and export the self-describing and network-transparent data formats netCDF and HDF. NCL can also import the proprietary data formats GRIB1, GRIB2 and CCM History Tape.

There are five supported formats in NCL:

  • netCDF
  • HDF4
  • HDF4-EOS
  • HDF5
  • GRIB1 and GRIB2
  • CCM History tape (COS blocked only)
  • OGR geospatial formats (Shapefile, MapInfo, GMT, TIGER)
The NCL functions addfile and addfiles can be used to import any of these supported data formats. The addfile function can also be used to create HDF and netCDF files. NCL does not create GRIB files, since GRIB files require identifiers for the meteorological center where they were written and for the model used to generate the data. Nor does NCL create CCM History Tape files, since this format will be replaced by netCDF in the future.

File types are identified by appropriate file name suffixes. The legal suffixes are ".nc" (with ".cdf" allowed as an alternate), ".hdf", ".hdfeos", ".grb", ".grib", ".grb2", ".grib2", ".ccm", ".shp", ".mif", ".gmt" and ".rt1".

Details on NCL's supported file formats can be found in the NCL Reference Manual.

Example of reading a variable off a netCDF file

    in = addfile("/fs/cgd/data0/argo/data/","r")
; To read variable with all metadata:
    t = in->T
; To read variable values only (faster), enclose with '(/' and '/)':
    t = (/in->T/)