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

Example pages containing: tips | resources | functions/procedures

NCL: Opening and editing an existing netCDF file

The NCL function addfile can be used to read, create or overwrite a NetCDF file. To overwrite an existing file, use a "w" as the second argument. Note that you can not change the dimensionality of any existing variables, but you can change the values. If adding to a netCDF file the type and size of the variable must already exist.
    begin
      in = addfile("./esvc.nc","w")
      (ncdump of original file)
      z_t = (/30,40,89,78,45,234,98,23,456,294,12,17,40,56,17,32,85,93,72,\
      20,46,24,90,89,25/)

      in->z_t=(/z_t/)

      (ncdump of modified file)
    end