[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 970107: how to change data in a variable



>To: address@hidden
>From: "R. Bauer" <address@hidden>
>Subject: how to change data in a variable 
>Organization: Forschungszentrum Juelich Gmbh (KFA)
>Keywords: 199701071348.GAA20327

Hi,

> I like to learn how I can change data belonging to the parameter for
> e.g. identifier name Quality in netCDF.
> 
> I know that I can rename Quality for e.g. to old but that's not the way
> which I want to go. 
> 
> Quality is a fixed array from [0..100] and sometimes some values of it
> should be changed.

You can change the values of a netCDF variable by opening the netCDF
file for writing and calling the appropriate "put" function to write
new values.  If the new values depend on the old values (e.g. adding 1
to each of them), you may have to call the appropriate "get" function
first.

After writing the new values, you should call the appropriate "close"
function to make sure the file is properly closed.

Without knowing whether you are using the C, Fortran, C++, perl, or new
netcdf-3 C interface, I can't tell you exactly what functions to call.

Another way to change a few values in a relatively small netCDF file
that does not require writing a program is to use the "ncdump" utility
to get a text version of the file, edit the text version in a text
editor, then generate a new netcdf file from the altered text version
using the "ncgen" utility with the "-b" and "-o" flags.

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu