cdm/src/main/java/ucar/nc2/iosp/hdf4/HdfEos.java
private void amendFromODL(NetcdfFile ncfile, String structMetadata) throws IOException {
        Group rootg = ncfile.getRootGroup();

        ODLparser parser = new ODLparser();
        Element root = parser.parseFromString(structMetadata); // now we have the ODL in JDOM elements
        FeatureType featureType = null;

        // SWATH
        Element swathStructure = root.getChild("SwathStructure");
        if (swathStructure != null) {
            List<Element> swaths = swathStructure.getChildren();
            for (Element elemSwath : swaths) {
                Element swathNameElem = elemSwath.getChild("SwathName");
                if (swathNameElem == null) {
                    log.warn("No SwathName element in {} {} ", elemSwath.getName(), ncfile.getLocation());
                    continue;
                }
                String swathName = NetcdfFile.makeValidCdmObjectName(swathNameElem.getText().trim());
                Group swathGroup = findGroupNested(rootg, swathName);
                //if (swathGroup == null)
                //  swathGroup = findGroupNested(rootg, H4header.createValidObjectName(swathName));

                if (swathGroup != null) {
                    featureType = amendSwath(ncfile, elemSwath, swathGroup);
                } else {
                    log.warn("Cant find swath group {} {}", swathName, ncfile.getLocation());
                }
            }
        }

        // GRID
        Element gridStructure = root.getChild("GridStructure");
        if (gridStructure != null) {
            List<Element> grids = gridStructure.getChildren();
            for (Element elemGrid : grids) {
                Element gridNameElem = elemGrid.getChild("GridName");
                if (gridNameElem == null) {
                    log.warn("No GridName element in {} {} ", elemGrid.getName(), ncfile.getLocation());
                    continue;
                }
                String gridName = NetcdfFile.makeValidCdmObjectName(gridNameElem.getText().trim());
                Group gridGroup = findGroupNested(rootg, gridName);
                //if (gridGroup == null)
                //  gridGroup = findGroupNested(rootg, H4header.createValidObjectName(gridName));
                if (gridGroup != null) {
                    featureType = amendGrid(elemGrid, ncfile, gridGroup, ncfile.getLocation());
                } else {
                    log.warn("Cant find Grid group {} {}", gridName, ncfile.getLocation());
                }
            }
        }

        // POINT - NOT DONE YET
        Element pointStructure = root.getChild("PointStructure");
        if (pointStructure != null) {
            List<Element> pts = pointStructure.getChildren();
            for (Element elem : pts) {
                Element nameElem = elem.getChild("PointName");
                if (nameElem == null) {
                    log.warn("No PointName element in {} {}", elem.getName(), ncfile.getLocation());
                    continue;
                }
                String name = nameElem.getText().trim();
                Group ptGroup = findGroupNested(rootg, name);
                //if (ptGroup == null)
                //  ptGroup = findGroupNested(rootg, H4header.createValidObjectName(name));
                if (ptGroup != null) {
                    featureType = FeatureType.POINT;
                } else {
                    log.warn("Cant find Point group {} {}", name, ncfile.getLocation());
                }
            }
        }

    if (featureType != null) {
      if (showWork) { log.debug("***EOS featureType= {}",featureType.toString());}
      rootg.addAttribute(new Attribute(CF.FEATURE_TYPE, featureType.toString()));
      // rootg.addAttribute(new Attribute(CDM.CONVENTIONS, "HDFEOS"));
    }

  }
private void amendFromODL(NetcdfFile ncfile, String structMetadata) throws IOException {
        Group rootg = ncfile.getRootGroup();

        ODLparser parser = new ODLparser();
        Element root = parser.parseFromString(structMetadata); // now we have the ODL in JDOM elements
        FeatureType featureType = null;

        // SWATH
        Element swathStructure = root.getChild("SwathStructure");
        if (swathStructure != null) {
            List<Element> swaths = swathStructure.getChildren();
            for (Element elemSwath : swaths) {
                Element swathNameElem = elemSwath.getChild("SwathName");
                if (swathNameElem == null) {
                    log.warn("No SwathName element in {} {} ", elemSwath.getName(), ncfile.getLocation());
                    continue;
                }
                String swathName = NetcdfFile.makeValidCdmObjectName(swathNameElem.getText().trim());
                Group swathGroup = findGroupNested(rootg, swathName);
                //if (swathGroup == null)
                //  swathGroup = findGroupNested(rootg, H4header.createValidObjectName(swathName));

                if (swathGroup != null) {
                    featureType = amendSwath(ncfile, elemSwath, swathGroup);
                } else {
                    log.warn("Cant find swath group {} {}", swathName, ncfile.getLocation());
                }
            }
        }

        // GRID
        Element gridStructure = root.getChild("GridStructure");
        if (gridStructure != null) {
            List<Element> grids = gridStructure.getChildren();
            for (Element elemGrid : grids) {
                Element gridNameElem = elemGrid.getChild("GridName");
                if (gridNameElem == null) {
                    log.warn("No GridName element in {} {} ", elemGrid.getName(), ncfile.getLocation());
                    continue;
                }
                String gridName = NetcdfFile.makeValidCdmObjectName(gridNameElem.getText().trim());
                Group gridGroup = findGroupNested(rootg, gridName);
                //if (gridGroup == null)
                //  gridGroup = findGroupNested(rootg, H4header.createValidObjectName(gridName));
                if (gridGroup != null) {
                    featureType = amendGrid(elemGrid, ncfile, gridGroup, ncfile.getLocation());
                } else {
                    log.warn("Cant find Grid group {} {}", gridName, ncfile.getLocation());
                }
            }
        }

        // POINT - NOT DONE YET
        Element pointStructure = root.getChild("PointStructure");
        if (pointStructure != null) {
            List<Element> pts = pointStructure.getChildren();
            for (Element elem : pts) {
                Element nameElem = elem.getChild("PointName");
                if (nameElem == null) {
                    log.warn("No PointName element in {} {}", elem.getName(), ncfile.getLocation());
                    continue;
                }
                String name = nameElem.getText().trim();
                Group ptGroup = findGroupNested(rootg, name);
                //if (ptGroup == null)
                //  ptGroup = findGroupNested(rootg, H4header.createValidObjectName(name));
                if (ptGroup != null) {
                    featureType = FeatureType.POINT;
                } else {
                    log.warn("Cant find Point group {} {}", name, ncfile.getLocation());
                }
            }
        }

    if (featureType != null) {
      if (showWork) { log.debug("***EOS featureType= {}",featureType.toString());}
      rootg.addAttribute(new Attribute(CF.FEATURE_TYPE, featureType.toString()));
      // rootg.addAttribute(new Attribute(CDM.CONVENTIONS, "HDFEOS"));
    }

  }
private void amendFromODL ( NetcdfFile ncfile , String structMetadata ) throws IOException { Group rootg = ncfile . getRootGroup ( ) ; ODLparser parser = new ODLparser ( ) ; Element root = parser . parseFromString ( structMetadata ) ; // now we have the ODL in JDOM elements
 FeatureType featureType = null ; // SWATH
 Element swathStructure = root . getChild ( "SwathStructure" ) ; if ( swathStructure != null ) { List < Element > swaths = swathStructure . getChildren ( ) ; for ( Element elemSwath : swaths ) { Element swathNameElem = elemSwath . getChild ( "SwathName" ) ; if ( swathNameElem == null ) { log . warn ( "No SwathName element in {} {} " , elemSwath . getName ( ) , ncfile . getLocation ( ) ) ; continue ; } String swathName = NetcdfFile . makeValidCdmObjectName ( swathNameElem . getText ( ) . trim ( ) ) ; Group swathGroup = findGroupNested ( rootg , swathName ) ; //if (swathGroup == null)
 //  swathGroup = findGroupNested(rootg, H4header.createValidObjectName(swathName));
 if ( swathGroup != null ) { featureType = amendSwath ( ncfile , elemSwath , swathGroup ) ; } else { log . warn ( "Cant find swath group {} {}" , swathName , ncfile . getLocation ( ) ) ; } } } // GRID
 Element gridStructure = root . getChild ( "GridStructure" ) ; if ( gridStructure != null ) { List < Element > grids = gridStructure . getChildren ( ) ; for ( Element elemGrid : grids ) { Element gridNameElem = elemGrid . getChild ( "GridName" ) ; if ( gridNameElem == null ) { log . warn ( "No GridName element in {} {} " , elemGrid . getName ( ) , ncfile . getLocation ( ) ) ; continue ; } String gridName = NetcdfFile . makeValidCdmObjectName ( gridNameElem . getText ( ) . trim ( ) ) ; Group gridGroup = findGroupNested ( rootg , gridName ) ; //if (gridGroup == null)
 //  gridGroup = findGroupNested(rootg, H4header.createValidObjectName(gridName));
 if ( gridGroup != null ) { featureType = amendGrid ( elemGrid , ncfile , gridGroup , ncfile . getLocation ( ) ) ; } else { log . warn ( "Cant find Grid group {} {}" , gridName , ncfile . getLocation ( ) ) ; } } } // POINT - NOT DONE YET
 Element pointStructure = root . getChild ( "PointStructure" ) ; if ( pointStructure != null ) { List < Element > pts = pointStructure . getChildren ( ) ; for ( Element elem : pts ) { Element nameElem = elem . getChild ( "PointName" ) ; if ( nameElem == null ) { log . warn ( "No PointName element in {} {}" , elem . getName ( ) , ncfile . getLocation ( ) ) ; continue ; } String name = nameElem . getText ( ) . trim ( ) ; Group ptGroup = findGroupNested ( rootg , name ) ; //if (ptGroup == null)
 //  ptGroup = findGroupNested(rootg, H4header.createValidObjectName(name));
 if ( ptGroup != null ) { featureType = FeatureType . POINT ; } else { log . warn ( "Cant find Point group {} {}" , name , ncfile . getLocation ( ) ) ; } } } if ( featureType != null ) { if ( showWork ) { log . debug ( "***EOS featureType= {}" , featureType . toString ( ) ) ; } rootg . addAttribute ( new Attribute ( CF . FEATURE_TYPE , featureType . toString ( ) ) ) ; // rootg.addAttribute(new Attribute(CDM.CONVENTIONS, "HDFEOS"));
 } }
Amend the given NetcdfFile with metadata from HDF-EOS structMetadata

@param ncfile         Amend this file
@param structMetadata structMetadata as String
@throws IOException on read error
Amend the given NetcdfFile with metadata from HDF - EOS structMetadata