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.
John, >Date: Thu, 11 Jul 1996 08:50:47 -0400 (EDT) >From: John Evans <address@hidden> >Organization: USGS >To: address@hidden (NetCDF-Perl) >Subject: newbie question >Keywords: 199607111248.AA28436 In the above message you wrote: > I've just started using Perl 5 and the netcdf perl module, so these > are probably stupid questions, but here goes anyway... > > I'm having a problem with the macro constants that are supposed to > be available. For example, a line from one of my scripts that > should read > > NetCDF::attput ( $ncid, > $varid, > "long_name", > NetCDF::CHAR, > $long_name ); > > produces the error "ncattput: Unknown type 0". I have to resort to > replacing the NetCDF::CHAR parameter with its value from "netcdf.h", > > NetCDF::attput ( $ncid, > $varid, > "long_name", > 2, > $long_name ); > > which works ok. This happens in other situations. For example, > it seems to choke on "NetCDF::GLOBAL" as well. > > One more thing, the "NetCDF::open" command doesn't want to accept > either "NetCDF::WRITE" or "NetCDF::RDWR". Substituting the constant > 1 instead seems to do it. > > I've been able to get around all these little difficulties so far > by substituting the actual constant values, but I'm just curious > someone else has had trouble with this and what they did to fix it. > Thanks. I've never seen this problem and I use constants of the form NetCDF:xxxxx to test the NetCDF-Perl implementation. Take a look at the file perl/test.pl in the distribution. It uses, for example, the constant NetCDF::GLOBAL. Do you have the statement `use NetCDF;' at the top of your scripts? If you can't get your scripts to work with these constants, would you please send me a minimal script that illustrates the problem and I'll see what I can do. -------- Steve Emmerson <address@hidden>