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.
Ron, >Date: Mon, 14 Aug 2000 14:43:21 -0600 >From: Ron Kahn <address@hidden> >Organization: System Development Division >To: Steve Emmerson <address@hidden> >Subject: Re: 20000814: NetCDF::put_att_text not found >Keywords: 200008141705.e7EH5NN04980 The above message contained the following: > Thanks for your quick response, however I've run into an additional > inconsistency. I retrieved the netcdf-2 manual from the link you > provided in your e-mail and looked at the interface to ncattput as it > is described in version 2.4 of the NetCDF Users's Guide. It indicates > for the c interface, 6 parameters as the interface to the call the > 5th being the length of the character string and the 6th being a > pointer to said character string. When I ran it as the documentation > seemed to indicate I got a usage error message from the netCDF perl > module. Upon experimentation I got the call to work by eliminating > the length parameter and not making the variable holding the value > a pointer. My question is in regards to whether or not I have the > correct documentation for netcdf-2 or whether I have missed something > obvious. You haven't missed anything obvious. The correspondence between the netCDFPerl API and the netCDF version 2 API isn't exact -- and you've found one of the inexact spots. Since Perl strings know their length, it's not necessary to supply a string-length argument to NetCDF::attput(). Unfortunately, this is inconsistent with the way the netCDFPerl API handles character variables -- where each character is interpreted as a element in an array and the length must explicitly specified. In practice, however, users tend to have string-valued attributes and byte-valued variables (for the most part) so things are as inconvenient as they might, otherwise, be. Regards, Steve Emmerson <http://www.unidata.ucar.edu>