NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
> > Is there no way to delete a dimension, a variable or a data element from > a netCDF database? I don't know whether you have the NCAR Command Language (NCL) which is available with NCAR Graphics release 4.1, but the following script would create a new file and not copy the variables you want to delete. BTW, the following script won't work with NCL 4.0 since the '$' syntax was added at release 4.0.1. Also the following script copies all of the variables attributes and coordinate variables too. begin variables_to_delete = (/"var1","var2","var3"/) in_file = addfile("oldfile.nc","r") out_file = addfile("newfile.nc","c") vnames = getfilevarnames(in_file) do i = 0, dimsizes(vnames)-1 if(.not.any(vnames(i).eq.variables_to_delete)) then out_file->$vnames(i)$ = in_file->$vnames(i)$ end if end do end > > > -- > James Tsai > jtsai@xxxxxxxxxxxxxxxxxxxxx > W:(202) 404-4821 > Naval Research Lab, Washington DC > Acoustics Division, Code 7145 >
netcdfgroup
archives: