[ncl-talk] nc file creation

Dennis Shea shea at ucar.edu
Mon Nov 2 07:19:28 MST 2015


   fin = addfile("...","r")

   system("/bin/rm -f "+...)    ; remove pre-existing file
   fout = addfile("...","c")

===
'fin' has a dual nature. It is both a reference (pointer) to the input
file *and* a variable. The file attributes  are associated with the
variable 'fin'.

I think the following will work.

fileattdef( fout, fin ) ; copy 'fin' attributes tp 'fout'

Good luck


On Mon, Nov 2, 2015 at 6:45 AM, Aditya Nalam <aditya.nalam at gmail.com> wrote:
> I have copied all the variables in the available nc file obtained from CESM
> and then created another nc file with some modifications.
>
> When i apply ncdump -h command over the original and modified nc files, i
> made sure all the variables were copied. But the global attributes of the
> original nc file were not copied to the modified nc file. May i know how to
> transfer them?
>
>
> The following is the global attribute section of the original nc file upon
> ncdump -h command (NetCDF)
>
> // global attributes:
>         :Conventions = "CF-1.0" ;
>         :source = "CAM" ;
>         :case = "ar5_cam_1850-2000_03" ;
>         :title = "" ;
>         :logname = "lamar" ;
>         :host = "be0207en.ucar.ed" ;
>         :Version = "$Name$" ;
>         :revision_Id = "$Id$" ;
>         :initial_file =
> "/ptmp/lamar/cam-inputs/ar5_cam_1850_06.cam2.i.1860-01-01-00000.nc" ;
>         :topography_file =
> "/fs/cgd/csm/inputdata/atm/cam/topo/USGS-gtopo30_1.9x2.5_remap_c050602.nc" ;
>         :history = "Tue Nov 17 10:49:34 2009: ncks --append -v date,time
> date_time_1850clim.nc aero_1.9x2.5_L26_1850clim_c091112.nc\n",
>             "\n",
>             "11/17/09 10:28:32 eaton:be1105en.ucar.ed:interpic -e T -p 4 -t
> /fis/cgd/cseg/csm/inputdata/atm/cam/inic/fv/camchemi_0012-01-01_1.9x2.5_L26_c081104.nc
> /ptmp/lamar/IPCC_AR5/Climatologies_20091110/aero_1.9x2.5_L26_1850-1859.nc
> aero_1.9x2.5_L26_1850-1859.r4.nc" ;
> }
>
>
>
>
> Thank you very much
>
> --
> Regards
> Adithya Nalam
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>


More information about the ncl-talk mailing list