NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

NcFile class

Fei's post inspired me to advocate for a solution to a minor gripe I've had 
with the NcFile interface. How about a new method in NcFile:

const char * NcFile::path() const;

which would return the path passed into the constructor.

Sure there are work arounds (e.g. deriving a class that adds just this method, 
or carrying the path around along with the NcFile, or hacking the NcFile 
source), but its so sensible to have it in the distribution version of NcFile.

Why is it useful? I find it helps to provide a meaningful log message:

void foo(NcFile * ncFile)
{
    const char * var_name = "T";
    if (!ncFile->get_var(varName))
    {
        std::cerr << "Error: variable '" << varName << "' not found in NcFile 
'" <<
            ncFile->path() << "'" << std::endl;
    }
}

Thoughts?

Kurt Hanson
WSI Corporation


  • 2006 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: