[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 20010516: ncopts, NC_FATAL and NC_VERBOSE



>From: Stephen Marshall <address@hidden>
>Subject: ncopts, NC_FATAL and NC_VERBOSE
>Organization: WSI Corporation
>Keywords: 200105161832.f4GIWtp16601 netCDF NC_FATAL NC_VERBOSE

Steve,

> I am actually using the 3.4 version of the library, but I am calling
> it through the C++ interface, and therein lies my problem.

Oops, right, sorry I just assumed you were using the netCDF-2
interface.  I forgot that the C++ interface is still just a thin layer
over the netCDF-2 C interface.

> In the method NcFile::get_var(NcToken name), the function ncvarid is
> called directly.  ncvarid in turn calls nc_advise, which causes my
> program to exit.
> 
> It appears that ncvarid and nc_advise are only found in the source
> file v2i.c.

Yes.  The C++ interface has a class NcError that is intended to
provide control for error handling, as documented at

  http://www.unidata.ucar.edu/packages/netcdf/cxxdoc_toc.html

This is not obvious, especially since the example provided for the C++
interface doesn't use it.  But all you should have to do is something
like the following declaration:

    NcError* xerror = new NcError(NcError::silent_nonfatal);

to get the error-handling behavior you want.

> Am I correct in assuming that all the source in the file v2i.c is
> specific to NetCDF version 2, and hence has been overcome by events?
> If so, the C++ API is out-of-date, because it is still calling some
> v2-specific functions.
> 
> Is anyone maintaining the C++ API, or is it "use at your own risk"
> software?

The v2i.c file is provided to support the netCDF-2 interface on top of
the netCDF-3 interface.  It's there for backward compatibility, since
lots of programs still use the version 2 interface and a few users
prefer it.  It will never be out-of-date, in the sense that we intend
to continue to support old interfaces when we provide improved
interfaces for backward compatibility, since the netCDF library is
fairly widely used.

The current C++ interface was written (by me) before the netCDF-3
interface was created, though it pioneered some of the same ideas that
were incorporated later into the netCDF-3 interface, such as automatic
type conversions that eliminated the undesirable coupling between the
language-independent external netCDF types and language-dependent
internal data types.

We still fix bugs reported in the C++ interface and will continue to
support it as long as possible.  Unfortunately, it's beginning to show
its age, since it was released before C++ exceptions and templates
were widely supported, so it didn't use them.

We had planned to rewrite the C++ interface independently of the C
interface using some of what we learned in the independent Java
implementation, but the loss of Glenn Davis (the author of the C
interface and the Java version 1 interface) has delayed those plans
indefinitely.  And we are using Java rather than C++ for most of our
new development, so the cost/benefit ratio for us is currently too
high.

We still get a fair number of support questions about the C++
interface, so we know it's being used, but I can't promise it will be
updated in the near future.

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu