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: nickitas georgas <address@hidden> >Subject: Re: 20021105: ncvarid: ncid 12: Variable not found >Organization: Hydroqual, Inc. >Keywords: 200211051415.gA5EFVX11723 Nickitas, > Thank you very much for your response. I did do what you said. I actually > figured out that I was using the wrong option yesterday when I looked at a > more updated version of your Install.html and changed it; and, yes, the > NETCDF library did compile with no errors. However, (and this is an new > question), the reason I was trying to recompile NETCDF on Linux (we already > had an SGI-compatible version installed here at HydroQual), was that the > previous SGI-compatible version did not appear to be working properly. Yet, > after I finished the new compilation of the Library in Linux and ran my > model which calls the library in two subroutines, I got the same error > message as before during the second call. Namely, > ncvarid: ncid 12: Variable not found. > I greped -i ncvarid in my code, and there is no occurence of it, except in > the NETCDF library (libnetcdf.a) and my executable. Do you have a clue of > why I am getting this error message and how I could fix it? I suspect your model is written in Fortran, so you are calling functions in either the Fortran77 or Fortran90 interface to netCDF. These are actually just veneers over the C interface, where all the functionality of netCDF is implemented. So, if you call the Fortran90 function nf90_inq_varid() or the Fortran77 function NF_INQ_VARID(), the function ncvarid() in the C interface ultimately gets invoked, even though it doesn't appear in your source code. However, the Fortran interfaces are supposed to interpret error returns from lower layers and present them in terms of the Fortran functions. If this is not happening, it may be a symptom of a bug in error handling. I would have to see a small example that duplicated the problem to verify this. Or maybe you aren't checking the error status return from an earlier call (such as NF90_DEF_VAR() or NF_DEF_VAR()) and the resulting errors are cascading, resulting in a message from the C layer. Possible causes for this error are: - The specified variable name is not a valid name for a variable in the specified netCDF dataset. - The specified netCDF ID does not refer to an open netCDF dataset. Note that variable IDs are transient identifiers that only refer to a variable in a netCDF dataset while that dataset is open. If you close the dataset, you can no longer use the variable ID in that program or in a later program that does not open the dataset first. The same is true of netCDF IDs: they can only be used to refer to open netCDF datasets. --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu