dap4/d4lib/src/main/java/dap4/dap4lib/DMRPrinter.java
void
    printDimrefs(DapVariable var)
            throws DapException
    {
        if(var.getRank() == 0) return;
        List<DapDimension> dimset = this.ce.getConstrainedDimensions(var);
        if(dimset == null)
            throw new DapException("Unknown variable: " + var);
        assert var.getRank() == dimset.size();
        for(int i = 0; i < var.getRank(); i++) {
            DapDimension dim = dimset.get(i);
            printer.marginPrint("<Dim");
            if(dim.isShared()) {
                String fqn = dim.getFQN();
                assert (fqn != null) : "Illegal Dimension reference";
                fqn = fqnXMLEscape(fqn);
                printXMLAttribute("name", fqn, XMLESCAPED);
            } else {
                long size = dim.getSize();// the size for printing purposes
                printXMLAttribute("size", Long.toString(size), NILFLAGS);
            }
            printer.println("/>");
        }
    }
void
    printDimrefs(DapVariable var)
            throws DapException
    {
        if(var.getRank() == 0) return;
        List<DapDimension> dimset = this.ce.getConstrainedDimensions(var);
        if(dimset == null)
            throw new DapException("Unknown variable: " + var);
        assert var.getRank() == dimset.size();
        for(int i = 0; i < var.getRank(); i++) {
            DapDimension dim = dimset.get(i);
            printer.marginPrint("<Dim");
            if(dim.isShared()) {
                String fqn = dim.getFQN();
                assert (fqn != null) : "Illegal Dimension reference";
                fqn = fqnXMLEscape(fqn);
                printXMLAttribute("name", fqn, XMLESCAPED);
            } else {
                long size = dim.getSize();// the size for printing purposes
                printXMLAttribute("size", Long.toString(size), NILFLAGS);
            }
            printer.println("/>");
        }
    }
Print the dimrefs for a variable's dimensions.
If the variable has a non-whole projection, then use size
else use the dimension name.

@param var whole dimensions are to be printed
@throws DapException