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.
Alex, > Full Name: THEPAUT Alex > Email Address: address@hidden > Organization: Capgemini > Package Version: > Operating System: Solaris/Linux > Hardware: > Description of problem: > > Hello, > > I use the function NetCDF::attget to retrieve informations about an attribute > : > > my $l_var = ""; > NetCDF::attget($p_file, NetCDF::GLOBAL, $p_variable , \$l_var); > > But the attribute doesn't exist and I get the following error: > > ncattinq: ncid 5; varid -1; attname "id": NetCDF: Attribute not found > > I've tried to catch the exception with an eval block, but the result is > the same. My question is: how can I catch the error ? To prevent error-messages from being written to the standard error stream, call "NetCDF::opts(0)". This will also prevent process termination by the netCDF library. To determine what attributes exist for a variable, call "NetCDF::attinq()". To determine if an attribute exists, call "NetCDF::attget()" after an initial call to "NetCDF::opts(0). The guide to the netCDF-2 API can be found at <http://www.unidata.ucar.edu/netcdf/old_docs/really_old/guide_toc.html>. The netCDF-2 API is the basis of the NetCDF-Perl module. > Best regards > > Alex THEPAUT Regards, Steve Emmerson Ticket Details =================== Ticket ID: NGH-715937 Department: Support netCDF Perl Priority: Normal Status: Closed