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 >cc: address@hidden >From: Glenn Carver <address@hidden> >Subject: Bug in F90 nf90_get_var >Organization: Centre for Atmospheric Science, Chemistry Dept., Cambridge >University, UK >Keywords: 200004031612.KAA13956 Hi Glenn, > I believe I have found a bug in the f90 API for netcdf. > > There is a bug in netcdf_text_variables.f90 where the function > nf90_get_var_text() mistakenly calls nf_PUT_vars_text() instead of > nf_GET_vars_text(). > > I append the context diff below. > > I say, I *believe* this is a bug because at the moment, even with this > correction I am still unable to use the nf90_get_var() call to read a > character string, the program is still hanging. I'll keep investigating but > any feedback would be useful. Yes, it looks like a bug to me too. Thanks for reporting this. [Robert, I can fix this and make a new tar file available, if you agree on the fix (changing "nf_put_vars_text" to "nf_get_vars_text" in line 38 of netcdf_text_variables.f90).] > Thanks for making the f90 API available. I was going to do one myself and > it saved me a lot of work!! > > One other quick point. On the install instructions for the f90 interface > there is one final step missing. The netcdf.o produced can either be added > to the libnetcdf.a file or added explicitly to the users compilation. > Either way, this step is not mentioned, although the use of the .mod file > is. I've added a final step to the install instructions. We're finally starting the work needed to integrate the f90 interface into the netCDF 3.5 distribution, which will fix this by making the install work just as it does for f77, via configure and Makefiles, so the user won't have to do anything extra to get the f90 interface if a Fortran 90 compiler is available. > Cheers, > Glenn > -- > % diff -c netcdf_text_variables.f90 netcdf_text_variables.f90.old > *** netcdf_text_variables.f90 Mon Apr 3 15:52:40 2000 > --- netcdf_text_variables.f90.old Mon Apr 3 15:51:18 2000 > *************** > *** 35,41 **** > if(nf90_get_var_text /= nf90_noerr) exit > ! How many characters to ask for? The smaller of the space provided > by > the caller > ! or the line length in the netCDF file. > ! nf90_get_var_text = nf_get_vars_text(ncid, varid, 1, > min(stringLength, > len(values)), 1, values) > end do > end function nf90_get_var_text > --- 35,41 ---- > if(nf90_get_var_text /= nf90_noerr) exit > ! How many characters to ask for? The smaller of the space provided > by > the caller > ! or the line length in the netCDF file. > ! nf90_get_var_text = nf_put_vars_text(ncid, varid, 1, > min(stringLength, > len(values)), 1, values) > end do > end function nf90_get_var_text