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.
"Renaud, William A." <address@hidden> writes: > At first the user was using ncdump to get the variable in question, then > editing it and running ncgen. Upon running ncgen with the new value, all > other variables were set to "_, _, ...". I guess this is because they were > specified in the CDL file variables section but were not in the data > section. As I understand it, ncgen is not 'aware' of a pre-existing file. > Thus, it creates the netCDF file based only on what it is given in the ascii > file. Is that an accurate statement? Yes, that is absolutely correct. > > At any rate, I'm in the process of writing a short code to open the old file > and write the new values to it. I don't know why that didn't occur to me > earlier, but I think this will be much easier for the user. Also it will be a lot faster because if you are dumping and then re-reading the file, you are doing a lot of extra I/O and conversions. You can just open the file, and use nc_put_vara_<type> if you are writing an array of numbers, or nc_put_var1_<type> to change individual data points. Ed -- Ed Hartnett -- address@hidden