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.
>To: address@hidden >From: "James E. Klein" <address@hidden> >Subject: Re: 20010531: on number of continuation lines >Organization: TRW Jim, > Well, your comments and quotations are right on the money. Fixing > the Fort_Max_Lines does not do enough because of the size of the .nc > file used to create the my ascii file with ncdump. > > My problem is that all I have is a .nc file which a large simulation > code reads. My task is to "open" the .nc file, change numerical > values in it and then close it and feed it back to the simulation > again and I don't have access to the code which originally generated > the original .nc file. > > Before I spend much more time on this I'll ask, do you think it is > possible to do what I described? Yes, it shouldn't be too hard. If you're doing this in Fortran, you might find out what you need to know by looking at Chapter 4 of the Fortran-77 Users Guide: http://www.unidata.ucar.edu/packages/netcdf/guidef/guidef-9.html#HEADING9-0 to see some skeleton sample code for opening and reading data from a netCDF file with known names. (Or you could read the same chapter from the Fortran-90 Users Guide, if you're more comfortable with that language and interface, from <http://www.unidata.ucar.edu/packages/netcdf/docs.html>.) You'll be calling NF_OPEN to open the file, NF_INQ_VARID to get the variable ID for a variable with a particular name, NF_GET_VAR_type() to get some values of the variable into an array of a specified numerical type, NF_PUT_VAR_type() to overwrite the changed values back to the file, and NF_CLOSE when you're done, to make sure the file gets closed properly after the last write. There are examples of all of these calls in Chapter 7 of the Users Guide: http://www.unidata.ucar.edu/packages/netcdf/guidef/guidef-12.html#HEADING12-0 Good luck. If you still have questions, it would be best to send them to address@hidden to make sure they get routed to someone who is here to answer them (possibly me) ... --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu