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: Naveenta Anand <address@hidden> >Subject: Re: 20020228: Netcdf-C library use (Trouble adding more dimensions to >variables) >Keywords: 200202282208.g1SM8j809246 Naveenta, > Oh, I am trying to add dimensions by basically > 1) Increasing the RANK of the variables > 2) Then add another array subscript to nc_def_var > 3) Increase start position to # of new dimensions at the time of nc_put_var But if you were doing this to an existing variable, the nc_def_var() call would return an error. So either you are not checking the error return from the nc_def_var() call, or you have found a bug where it should return an error status but doesn't. If nc_def_var() is returning NC_NOERR in this case, please send us your code so we can track down the problem. If you are not checking the return status from netCDF calls, please change your code to check them in the future, otherwise you can expect problems will continue. > And what I get from your email is that this approach is totally wrong. I > should either use 1) ncgen approach or create a new netcdf data set and > redefine the variable in the new data set. > > It's making sense to me now. Please tell me if my interpretation as above > is right. It sounds right. I'm still not sure whether you only need to change one file with a small amount of data, or you need to do this for many files or lots of data, which would determine which approach is best. --Russ