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.
As someone else already suggested, a scripting approach would take care of this straightforwardly although it's probably not what you were envisioning. For example, the popular data analysis program R has a package "ncdf" that could be used to make a script along these lines: contents of fixvals.R: ---------------------- # Get command line args: input file name, varname, old val, new val infile <- commandArgs()[3] varname <- commandArgs()[4] oldval <- commandArgs()[5] newval <- commandArgs()[6] # open file, get data ncid <- open.ncdf( infile, write=TRUE ) data <- get.var.ncdf( ncid, varname ) data[ data==oldval ] <- newval # write out data put.var.ncdf( ncid, varname, data ) close.ncdf( ncid ) ------------------------ And then it could be run from the command line like this: R --no-save filename.nc varname 32 45 < fixvals.R Regards, --Dave Waylon.Collins wrote: > Dear group members, > > After reviewed the Unidata list of software that manipulates netCDF files, I have yet to find one that can perform the following task -- I need command-line software (that can run in a Redhat Enterprise Linux environment) that will allow me to replace data values, associated with a particular variable, with values that I can specify. It needs to allow for a logical operation. For example, the software needs to be able to perform the following -- "Any datum of variable X, within netCDF file with filename F.nc, that equals 32, change it to the value 45. Thus, the original file F.nc is now altered, or the altered file is now named G.nc". Any help will be greatly appreciated. > > Sincerely, > > Waylon > > -- > ********************************************************************** * Waylon G. Collins Voice: (361)289-0959 * * NOAA/National Weather Service E-Mail: Waylon.Collins@xxxxxxxx * * 300 Pinson Drive * * Corpus Christi, TX 78406 * * USA * ********************************************************************** > > --------------------------------------------------------------- David W. Pierce / Climate Research Division Scripps Inst. Oceanog. / (858) 534-8276 (voice) dpierce@xxxxxxxx / (858) 534-8561 (fax) ---------------------------------------------------------------
netcdfgroup
archives: