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

Re: 19990329: c++ interface bug? NcFile::get_var()



Ionutz,

>Date: Mon, 29 Mar 1999 22:20:23 +0900
>From: Ionutz Borcoman <address@hidden>
>Organization: .
>To: Steve Emmerson <address@hidden>
>Subject: Re: 19990325: c++ interface bug? NcFile::get_var()
>Keywords: 199903251256.FAA21940

In the above message, you wrote:

> 1. Thanks for the reply. Indeed, using silent_nonfatal makes things
> work. The problem was that I have try with verbose_nonfatal, which is
> not working :-(

We don't have a Debian Linux system on which to duplicate your problem;
however, "verbose_nonfatal" works on our SunOS 5.7 system:

    ~/tmp: ./Example 
    ncvarid: ncid 3: Variable not found
    ncvarid: ncid 3: Variable not found
    not existent variable
    Exit normally

I can't imagine that the netCDF library would have a bug that makes
"verbose_nonfatal" work on one system and fail on another.  It seems
more likely that a bug exists in the development or runtime environment
on your system.

> Still, it looks that verbose_nonfatal makes my program exit prematurely:

> variable's name is P
> Illegal instruction

NcFile::get_var(char* varName) return a zero if the named variable
doesn't exist in the netCDF file.  The above indicates that your program
is not interpreting the returned zero as a NULL pointer.  This indicates
a problem with your compiler.

You might try the "gcc" compiler rather than "egcs".

> What is the purpose of verbose_nonfatal ? 

To print an error message but to continue execution.

> The program is now like this:
> 
> ///////////////////////////////////////
> 
> #include <string.h>
> #include <time.h>
> #include <stdlib.h>
> #include "netcdf.hh"
> 
> int main()
> {
>       NcFile *nc = new NcFile("Example.nc", NcFile::ReadOnly);
>       // with silent_nonfatal works OK.
>       NcError err(NcError::verbose_nonfatal);
>       // check if the file was opened
>       if( !nc->is_valid() ){
>         delete nc;
>         exit(1);
>       }
>       NcVar* var = nc->get_var("P");
>       if(var)
>         printf("variable's name is %s\n", var->name());

The body of the above "if" statement should not have been executed
because "nc->get_var()" returned 0.

>       var = nc->get_var("xxx");
>       if(!var)
>         printf("not existent variable\n");
>       printf("Exit normally\n");
>       delete nc;
> }
> 
> ///////////////////////////////////////
> 
> 2. Now I am working to a netCDF browser that I want to include in a LGPL
> library. It will act as a VDK widget (VDK is a GTK wrapper arround GTK+)
> and users will be able to add it to their applications very simple:
> 
> class MyForm: public VDKForm
> {
> ....
> void Setup(){
>       ...
>       ISnetCDFBrowser browser=new ISnetCDFBrowser(this, nc);
>       this->Add(browser);
>       ...
> }
> ...
> };
> 
> and then link with my lib. I want ot know where do I have to put the
> copyright notices:
> - is it enough to put in the distribution tar.gz ?

That should suffice.  Here's what the COPYRIGHT file has to say:

    Copyright 1993-1997 University Corporation for Atmospheric Research/Unidata

    Portions of this software were developed by the Unidata Program at the 
    University Corporation for Atmospheric Research.

    Access and use of this software shall impose the following obligations
    and understandings on the user. The user is granted the right, without
    any fee or cost, to use, copy, modify, alter, enhance and distribute
    this software, and any derivative works thereof, and its supporting
    documentation for any purpose whatsoever, provided that this entire
    notice appears in all copies of the software, derivative works and
    supporting documentation.  Further, UCAR requests that the user credit
    UCAR/Unidata in any publications that result from the use of this
    software or in any product that includes this software. The names UCAR
    and/or Unidata, however, may not be used in any advertising or publicity
    to endorse or promote any products or commercial entity unless specific
    written permission is obtained from UCAR/Unidata. The user also
    understands that UCAR/Unidata is not obligated to provide the user with
    any support, consulting, training or assistance of any kind with regard
    to the use, operation and performance of this software nor to provide
    the user with any updates, revisions, new versions or "bug fixes."

    THIS SOFTWARE IS PROVIDED BY UCAR/UNIDATA "AS IS" AND ANY EXPRESS OR
    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL UCAR/UNIDATA BE LIABLE FOR ANY SPECIAL,
    INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
    FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
    NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
    WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.

> - do I have to add something in the .cc files that include (aka use)
> netCDF headers ?

No.

> 3. My goal in the end is to make some plasma modeling. I like netCDF and
> the above mentioned browser is done in order to view easy my (future)
> data saved in netCDF format. I have understood that, if anything
> published, I need to mention UNICAR.

We request that you mention UCAR.  Strictly speaking, it's not
necessary.

>  How should I mention it ? Can you
> quote some others to give me an idea ? In what articles do I have to
> mention UNICAR and where ? Is the THANKS section a good place for this ?
> (nothing to publish yet, but it is good to keep this for future
> reference :-)

A one sentence mention in your THANKS section should suffice.  Something
like

    This software uses the freely-available netCDF data interchange
    package developed at the UNIDATA Program Center of UCAR.

or

    The author is grateful for the the freely-available netCDF data
    interchange package developed at the UNIDATA Program Center of UCAR.

--------
Steve Emmerson   <http://www.unidata.ucar.edu>