grib/src/main/java/ucar/nc2/grib/collection/GribCollectionBuilder.java
private boolean createMultipleRuntimeCollections(Formatter errlog) throws IOException {
    long start = System.currentTimeMillis();

    List<MFile> files = new ArrayList<>();
    List<? extends Group> groups = makeGroups(files, false, errlog);
    List<MFile> allFiles = Collections.unmodifiableList(files);
    if (allFiles.size() == 0) {
      throw new IllegalStateException("No files in this collection =" + name + " topdir=" + dcm.getRoot());
    }
    if (groups.size() == 0) {
      throw new IllegalStateException("No records in this collection =" + name + " topdir=" + dcm.getRoot());
    }

    // Create the master runtimes, classify the result
    CalendarDateRange calendarDateRangeAll = null;
    //boolean allTimesAreOne = true;
    boolean allTimesAreUnique = true;
    Set<Long> allRuntimes = new HashSet<>();
    for (Group g : groups) {
      allRuntimes.addAll(g.getCoordinateRuntimes());
      for (Coordinate coord : g.getCoordinates()) {
        if (coord instanceof CoordinateTime2D) {
          CoordinateTime2D coord2D = (CoordinateTime2D) coord;
          if (allTimesAreUnique) {
            allTimesAreUnique = coord2D.hasUniqueTimes();
          }
        }
        if (coord instanceof CoordinateTimeAbstract) {
          CalendarDateRange calendarDateRange = ((CoordinateTimeAbstract) coord).makeCalendarDateRange(null);
          if (calendarDateRangeAll == null) calendarDateRangeAll = calendarDateRange;
          else calendarDateRangeAll = calendarDateRangeAll.extend(calendarDateRange);
        }
      }
    }
    List<Long> sortedList = new ArrayList<>(allRuntimes);
    Collections.sort(sortedList);
    if (sortedList.size() == 0)
      throw new IllegalArgumentException("No runtimes in this collection ="+name);

    else if (sortedList.size() == 1)
      this.type = GribCollectionImmutable.Type.SRC;
    else if (allTimesAreUnique)
      this.type =  GribCollectionImmutable.Type.MRUTC;
    else
      this.type =  GribCollectionImmutable.Type.MRC;

    CoordinateRuntime masterRuntimes = new CoordinateRuntime(sortedList, null);
    MFile indexFileForRuntime = GribCollectionMutable.makeIndexMFile(this.name, directory);
    boolean ok = writeIndex(this.name, indexFileForRuntime.getPath(), masterRuntimes, groups, allFiles, calendarDateRangeAll);

    /* if (this.type ==  GribCollectionImmutable.Type.MRC) {
      GribBestDatasetBuilder.makeDatasetBest();
    } */

    long took = System.currentTimeMillis() - start;
    logger.debug("That took {} msecs", took);
    return ok;
  }
private boolean createMultipleRuntimeCollections(Formatter errlog) throws IOException {
    long start = System.currentTimeMillis();

    List<MFile> files = new ArrayList<>();
    List<? extends Group> groups = makeGroups(files, false, errlog);
    List<MFile> allFiles = Collections.unmodifiableList(files);
    if (allFiles.size() == 0) {
      throw new IllegalStateException("No files in this collection =" + name + " topdir=" + dcm.getRoot());
    }
    if (groups.size() == 0) {
      throw new IllegalStateException("No records in this collection =" + name + " topdir=" + dcm.getRoot());
    }

    // Create the master runtimes, classify the result
    CalendarDateRange calendarDateRangeAll = null;
    //boolean allTimesAreOne = true;
    boolean allTimesAreUnique = true;
    Set<Long> allRuntimes = new HashSet<>();
    for (Group g : groups) {
      allRuntimes.addAll(g.getCoordinateRuntimes());
      for (Coordinate coord : g.getCoordinates()) {
        if (coord instanceof CoordinateTime2D) {
          CoordinateTime2D coord2D = (CoordinateTime2D) coord;
          if (allTimesAreUnique) {
            allTimesAreUnique = coord2D.hasUniqueTimes();
          }
        }
        if (coord instanceof CoordinateTimeAbstract) {
          CalendarDateRange calendarDateRange = ((CoordinateTimeAbstract) coord).makeCalendarDateRange(null);
          if (calendarDateRangeAll == null) calendarDateRangeAll = calendarDateRange;
          else calendarDateRangeAll = calendarDateRangeAll.extend(calendarDateRange);
        }
      }
    }
    List<Long> sortedList = new ArrayList<>(allRuntimes);
    Collections.sort(sortedList);
    if (sortedList.size() == 0)
      throw new IllegalArgumentException("No runtimes in this collection ="+name);

    else if (sortedList.size() == 1)
      this.type = GribCollectionImmutable.Type.SRC;
    else if (allTimesAreUnique)
      this.type =  GribCollectionImmutable.Type.MRUTC;
    else
      this.type =  GribCollectionImmutable.Type.MRC;

    CoordinateRuntime masterRuntimes = new CoordinateRuntime(sortedList, null);
    MFile indexFileForRuntime = GribCollectionMutable.makeIndexMFile(this.name, directory);
    boolean ok = writeIndex(this.name, indexFileForRuntime.getPath(), masterRuntimes, groups, allFiles, calendarDateRangeAll);

    /* if (this.type ==  GribCollectionImmutable.Type.MRC) {
      GribBestDatasetBuilder.makeDatasetBest();
    } */

    long took = System.currentTimeMillis() - start;
    logger.debug("That took {} msecs", took);
    return ok;
  }
Throw exception if failure