opendap/src/main/java/ucar/nc2/dods/DODSNetcdfFile.java
Dimension getSharedDimension(Group group, Dimension d) {
    if (d.getShortName() == null) return d;

    if (group == null) group = rootGroup;
    for (Dimension sd : group.getDimensions()) {
      if (sd.getShortName().equals(d.getShortName()) && sd.getLength() == d.getLength())
        return sd;
    }
    d.setShared(true);
    group.addDimension(d);
    return d;
  }
Dimension getSharedDimension(Group group, Dimension d) {
    if (d.getShortName() == null) return d;

    if (group == null) group = rootGroup;
    for (Dimension sd : group.getDimensions()) {
      if (sd.getShortName().equals(d.getShortName()) && sd.getLength() == d.getLength())
        return sd;
    }
    d.setShared(true);
    group.addDimension(d);
    return d;
  }
If an equivilent shared dimension already exists, use it, else add d to shared dimensions.
Equivilent is same name and length.

@param group from this group, if null, use rootGroup
@param d     find equivilent shared dimension to this one.
@return equivilent shared dimension or d.