cdm/src/main/java/ucar/nc2/dataset/DatasetConstructor.java
static public Group findGroup(NetcdfFile newFile, Group oldGroup) {
    List<Group> chain = new ArrayList<>(5);
    Group g = oldGroup;
    while ( g.getParentGroup() != null) { // skip the root
      chain.add(0, g); // put in front
      g = g.getParentGroup();
    }

    Group newg = newFile.getRootGroup();
    for (Group oldg : chain) {
      newg = newg.findGroup( oldg.getShortName());
      if (newg == null) return null;
    }
    return newg;
  }
static public Group findGroup(NetcdfFile newFile, Group oldGroup) {
    List<Group> chain = new ArrayList<>(5);
    Group g = oldGroup;
    while ( g.getParentGroup() != null) { // skip the root
      chain.add(0, g); // put in front
      g = g.getParentGroup();
    }

    Group newg = newFile.getRootGroup();
    for (Group oldg : chain) {
      newg = newg.findGroup( oldg.getShortName());
      if (newg == null) return null;
    }
    return newg;
  }
static public Group findGroup ( NetcdfFile newFile , Group oldGroup ) { List < Group > chain = new ArrayList <> ( 5 ) ; Group g = oldGroup ; while ( g . getParentGroup ( ) != null ) { // skip the root chain . add ( 0 , g ) ; // put in front g = g . getParentGroup ( ) ; } Group newg = newFile . getRootGroup ( ) ; for ( Group oldg : chain ) { newg = newg . findGroup ( oldg . getShortName ( ) ) ; if ( newg == null ) return null ; } return newg ; }
Find the Group in newFile that corresponds (by name) with oldGroup

@param newFile look in this NetcdfFile
@param oldGroup corresponding (by name) with oldGroup
@return corresponding Group, or null if no match.
Find the Group in newFile that corresponds ( by name ) with oldGroup