dap4/d4cdm/src/main/java/dap4/cdm/dsp/CDMDSP.java
public void
    buildDMR()
            throws DapException
    {
        if (getDMR() != null)
            return;
        try {
            if (DUMPCDL) {
                System.out.println("writecdl:");
                this.ncdfile.writeCDL(System.out, false);
                System.out.flush();
            }
            // Use the file path to define the dataset name
            String name = this.ncdfile.getLocation();
            // Normalize the name
            name = DapUtil.canonicalpath(name);
            // Remove any path prefix
            int index = name.lastIndexOf('/');
            if (index >= 0)
                name = name.substring(index + 1, name.length());
            // Initialize the root dataset node
            setDMR((DapDataset) dmrfactory.newDataset(name).annotate(NetcdfDataset.class, this.ncdfile));
            // Map the CDM root group to this group
            recordNode(this.ncdfile.getRootGroup(), getDMR());
            getDMR().setBase(DapUtil.canonicalpath(this.ncdfile.getLocation()));

            // Now recursively build the tree. Start by
            // Filling the dataset with the contents of the ncfile
            // root group.
            fillgroup(getDMR(), this.ncdfile.getRootGroup());

            // Add an order index to the tree
            getDMR().sort();

            // Now locate the coordinate variables for maps

            /* Walk looking for VariableDS instances */
            processmappedvariables(this.ncdfile.getRootGroup());

            // Now set the view
            getDMR().finish();

        } catch (DapException e) {
            setDMR(null);
            throw new DapException(e);
        }
    }
public void
    buildDMR()
            throws DapException
    {
        if (getDMR() != null)
            return;
        try {
            if (DUMPCDL) {
                System.out.println("writecdl:");
                this.ncdfile.writeCDL(System.out, false);
                System.out.flush();
            }
            // Use the file path to define the dataset name
            String name = this.ncdfile.getLocation();
            // Normalize the name
            name = DapUtil.canonicalpath(name);
            // Remove any path prefix
            int index = name.lastIndexOf('/');
            if (index >= 0)
                name = name.substring(index + 1, name.length());
            // Initialize the root dataset node
            setDMR((DapDataset) dmrfactory.newDataset(name).annotate(NetcdfDataset.class, this.ncdfile));
            // Map the CDM root group to this group
            recordNode(this.ncdfile.getRootGroup(), getDMR());
            getDMR().setBase(DapUtil.canonicalpath(this.ncdfile.getLocation()));

            // Now recursively build the tree. Start by
            // Filling the dataset with the contents of the ncfile
            // root group.
            fillgroup(getDMR(), this.ncdfile.getRootGroup());

            // Add an order index to the tree
            getDMR().sort();

            // Now locate the coordinate variables for maps

            /* Walk looking for VariableDS instances */
            processmappedvariables(this.ncdfile.getRootGroup());

            // Now set the view
            getDMR().finish();

        } catch (DapException e) {
            setDMR(null);
            throw new DapException(e);
        }
    }
Extract the metadata from the NetcdfDataset
and build the DMR.