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

Re: changing type of a variable

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.


  • Subject: Re: changing type of a variable
  • Date: Sun, 04 Dec 1994 21:38:17 -0700

> Organization: NOAA / CDC
> Keywords: 199412021800.AA00704

Cathy,

> Russ- I don't mind if the file gets rewritten,as long as I don't have
> to copy each and every variable and attribute to the new file myself.
> It's fairly easy to add variables, add attribute values (even ones with
> increased lengths)because all you have to do is write a few lines of code.
> But- it seems to change a variable type, you have to have very,very long code
> that essentailly creates a new file. this is what I want to avoid.
> 
> Is there any kludge to get around this?

One possibility, if you don't have lots of files to change and the file is
not too huge, would be to use ncdump to convert the file to an ASCII CDL
file, edit the resulting file to change the type of the variable, and then
use "ncgen -b" to convert the result back to a netCDF file.

--
Russ Rew                                                UCAR Unidata Program
address@hidden                                          P.O. Box 3000
http://www.unidata.ucar.edu/                          Boulder, CO 80307-3000