ui/src/main/java/ucar/nc2/ui/grib/Grib2ReportPanel.java
private void doUniqueTemplates(Formatter f, MCollection dcm, boolean useIndex) throws IOException {
    f.format("Show Unique GDS and PDS templates%n");

    Map<Integer, FileList> gdsSet = new HashMap<>();
    Map<Integer, FileList> pdsSet = new HashMap<>();
    Map<Integer, FileList> drsSet = new HashMap<>();
    for (MFile mfile : dcm.getFilesSorted()) {
      f.format(" %s%n", mfile.getPath());
      doUniqueTemplates(mfile, gdsSet, pdsSet, drsSet, f);
    }

    List<FileList> sorted = new ArrayList<>(gdsSet.values());
    Collections.sort(sorted);
    for (FileList gdsl : sorted) {
      f.format("%nGDS %s template= %d %n", gdsl.name, gdsl.template);
      for (FileCount fc : gdsl.fileList) {
        f.format("  %5d %s %n", fc.countRecords, fc.f.getPath());
      }
    }

    List<FileList> sortedPds = new ArrayList<>(pdsSet.values());
    Collections.sort(sortedPds);
    for (FileList pdsl : sortedPds) {
      f.format("%n===================================================%n");
      f.format("%nPDS %s template= %d %n", pdsl.name, pdsl.template);
      for (FileCount fc : pdsl.fileList) {
        f.format("  %5d %s %n", fc.countRecords, fc.f.getPath());
      }
    }

    List<FileList> sortedDrs = new ArrayList<>(drsSet.values());
    Collections.sort(sortedDrs);
    for (FileList pdsl : sortedDrs) {
      f.format("%n===================================================%n");
      f.format("%nDRS %s template= %d %n", pdsl.name, pdsl.template);
      for (FileCount fc : pdsl.fileList) {
        f.format("  %5d %s %n", fc.countRecords, fc.f.getPath());
      }
    }
  }
private void doUniqueTemplates(Formatter f, MCollection dcm, boolean useIndex) throws IOException {
    f.format("Show Unique GDS and PDS templates%n");

    Map<Integer, FileList> gdsSet = new HashMap<>();
    Map<Integer, FileList> pdsSet = new HashMap<>();
    Map<Integer, FileList> drsSet = new HashMap<>();
    for (MFile mfile : dcm.getFilesSorted()) {
      f.format(" %s%n", mfile.getPath());
      doUniqueTemplates(mfile, gdsSet, pdsSet, drsSet, f);
    }

    List<FileList> sorted = new ArrayList<>(gdsSet.values());
    Collections.sort(sorted);
    for (FileList gdsl : sorted) {
      f.format("%nGDS %s template= %d %n", gdsl.name, gdsl.template);
      for (FileCount fc : gdsl.fileList) {
        f.format("  %5d %s %n", fc.countRecords, fc.f.getPath());
      }
    }

    List<FileList> sortedPds = new ArrayList<>(pdsSet.values());
    Collections.sort(sortedPds);
    for (FileList pdsl : sortedPds) {
      f.format("%n===================================================%n");
      f.format("%nPDS %s template= %d %n", pdsl.name, pdsl.template);
      for (FileCount fc : pdsl.fileList) {
        f.format("  %5d %s %n", fc.countRecords, fc.f.getPath());
      }
    }

    List<FileList> sortedDrs = new ArrayList<>(drsSet.values());
    Collections.sort(sortedDrs);
    for (FileList pdsl : sortedDrs) {
      f.format("%n===================================================%n");
      f.format("%nDRS %s template= %d %n", pdsl.name, pdsl.template);
      for (FileCount fc : pdsl.fileList) {
        f.format("  %5d %s %n", fc.countRecords, fc.f.getPath());
      }
    }
  }
Look through the collection and find what GDS and PDS templates are used.