cdm/src/main/java/ucar/nc2/Group.java
public Group makeRelativeGroup(NetcdfFile ncf, String path, boolean ignorelast) {
    path = path.trim();
    path = path.replace("//", "/");
    boolean isabsolute = (path.charAt(0) == '/');
    if (isabsolute)
      path = path.substring(1);

    // iteratively create path
    String pieces[] = path.split("/");
    if (ignorelast) pieces[pieces.length - 1] = null;

    Group current = (isabsolute ? ncfile.getRootGroup() : this);
    for (String name : pieces) {
      if (name == null) continue;
      String clearname = NetcdfFile.makeNameUnescaped(name);  //??
      Group next = current.findGroup(clearname);
      if (next == null) {
        next = new Group(ncf, current, clearname);
        current.addGroup(next);
      }
      current = next;
    }
    return current;
  }
public Group makeRelativeGroup(NetcdfFile ncf, String path, boolean ignorelast) {
    path = path.trim();
    path = path.replace("//", "/");
    boolean isabsolute = (path.charAt(0) == '/');
    if (isabsolute)
      path = path.substring(1);

    // iteratively create path
    String pieces[] = path.split("/");
    if (ignorelast) pieces[pieces.length - 1] = null;

    Group current = (isabsolute ? ncfile.getRootGroup() : this);
    for (String name : pieces) {
      if (name == null) continue;
      String clearname = NetcdfFile.makeNameUnescaped(name);  //??
      Group next = current.findGroup(clearname);
      if (next == null) {
        next = new Group(ncf, current, clearname);
        current.addGroup(next);
      }
      current = next;
    }
    return current;
  }
public Group makeRelativeGroup ( NetcdfFile ncf , String path , boolean ignorelast ) { path = path . trim ( ) ; path = path . replace ( "//" , "/" ) ; boolean isabsolute = ( path . charAt ( 0 ) == ' ' ) ; if ( isabsolute ) path = path . substring ( 1 ) ; // iteratively create path String pieces [ ] = path . split ( "/" ) ; if ( ignorelast ) pieces [ pieces . length - 1 ] = null ; Group current = ( isabsolute ? ncfile . getRootGroup ( ) : this ) ; for ( String name : pieces ) { if ( name == null ) continue ; String clearname = NetcdfFile . makeNameUnescaped ( name ) ; //?? Group next = current . findGroup ( clearname ) ; if ( next == null ) { next = new Group ( ncf , current , clearname ) ; current . addGroup ( next ) ; } current = next ; } return current ; }
Create groups to ensure path is defined

@param ncf        the containing netcdf file object
@param path       the path to the desired group
@param ignorelast true => ignore last element in the path
@return the Group, or null if not found
Create groups to ensure path is defined