OK, more questions...

I was trying to understand the group functionality.  It isn't clear to
me how to create groups and then how to put variables in them.  Here is
some sample code...

        Group root = file.getRootGroup();  // Seems pretty obvious
        Group child = new Group(file, root, "child");
        file.addGroup(root, child);

OK, I'm not sure about this line.  It seems strange that to add a group
you have to already have created the group.

        child.addAttribute(new Attribute("testAttr", "testValue"));
        Group grand = new Group(file, child, "grand");
        //file.addGroup(child, grand);

This line is commented out because it causes a null pointer exception if
it isn't (although it isn't clear why it should cause any problems).
        Variable x = new Variable(file, grand, null, "x");
        file.addVariable(grand, x);

Hmmm...the constructor to Variable requires a group and the
file.addVariable method requires a group?  This seems redundant.

My example actually runs (generates a netCDF file) but if I open it with
the ToolsUI tool, I don't see any groups?!?  Whenever the user's guide
is updated, it would be nice to have an example of the proper method for
creating groups.


fn:Michael Tiller
org:Emmeskay, Inc.
adr;dom:;;47119 Five Mile Road;Plymouth;MI;48170
title:Vice-President Modeling Research and Development
tel;work:(734) 635-3450

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