grib/src/main/java/ucar/nc2/grib/collection/GribPartitionBuilder.java
boolean createPartitionedIndex(CollectionUpdateType forcePartition, Formatter errlog) throws IOException {
    if (errlog == null) errlog = new Formatter(); // info will be discarded

    // create partitions from the partitionManager
    for (MCollection dcmp : partitionManager.makePartitions(forcePartition)) {
      dcmp.putAuxInfo(FeatureCollectionConfig.AUX_CONFIG, partitionManager.getAuxInfo(FeatureCollectionConfig.AUX_CONFIG));
      result.addPartition(dcmp);
    }
    result.sortPartitions(); // after this the partition list is immutable

    // choose the "canonical" partition, aka prototype
    // only used in copyInfo
    int n = result.getPartitionSize();
    if (n == 0) {
      errlog.format("ERR Nothing in this partition = %s%n", result.showLocation());
      throw new IllegalStateException("Nothing in this partition =" + result.showLocation());
    }
    int idx = partitionManager.getProtoIndex(n);
    PartitionCollectionMutable.Partition canon = result.getPartition(idx);
    logger.debug("     Using canonical partition {}", canon.getDcm().getCollectionName());

    try (GribCollectionMutable gc = canon.makeGribCollection()) {  // LOOK open/close canonical partition
      if (gc == null)
        throw new IllegalStateException("canon.makeGribCollection failed on =" + result.showLocation() + " " + canon.getName() + "; errs=" + errlog);

      // copy info from canon gribCollection to result partitionCollection
      result.copyInfo(gc);
      result.isPartitionOfPartitions = (gc instanceof PartitionCollectionMutable);

      result.dateRange = gc.dateRange;
    }

    // check consistency across vert and ens coords
    // create partitioned variables
    // partition index is used - do not resort partitions
    GribCollectionMutable.Dataset ds2D = makeDataset2D(errlog);
    if (ds2D == null) {
      errlog.format(" ERR makeDataset2D failed, index not written on %s%n", result.showLocation());
      throw new IllegalStateException("makeDataset2D failed, index not written on =" + result.showLocation() + "; errs=" + errlog);
    }

    // Make Best for a TwoD
    if (ds2D.gctype == GribCollectionImmutable.Type.TwoD)
      makeDatasetBest(ds2D, false);
    //else if (ds2D.gctype == GribCollectionImmutable.Type.MRUTC)
    //  makeTime2runtime(ds2D, false);

    // ready to write the index file
    return writeIndex(result, errlog);
  }
boolean createPartitionedIndex(CollectionUpdateType forcePartition, Formatter errlog) throws IOException {
    if (errlog == null) errlog = new Formatter(); // info will be discarded

    // create partitions from the partitionManager
    for (MCollection dcmp : partitionManager.makePartitions(forcePartition)) {
      dcmp.putAuxInfo(FeatureCollectionConfig.AUX_CONFIG, partitionManager.getAuxInfo(FeatureCollectionConfig.AUX_CONFIG));
      result.addPartition(dcmp);
    }
    result.sortPartitions(); // after this the partition list is immutable

    // choose the "canonical" partition, aka prototype
    // only used in copyInfo
    int n = result.getPartitionSize();
    if (n == 0) {
      errlog.format("ERR Nothing in this partition = %s%n", result.showLocation());
      throw new IllegalStateException("Nothing in this partition =" + result.showLocation());
    }
    int idx = partitionManager.getProtoIndex(n);
    PartitionCollectionMutable.Partition canon = result.getPartition(idx);
    logger.debug("     Using canonical partition {}", canon.getDcm().getCollectionName());

    try (GribCollectionMutable gc = canon.makeGribCollection()) {  // LOOK open/close canonical partition
      if (gc == null)
        throw new IllegalStateException("canon.makeGribCollection failed on =" + result.showLocation() + " " + canon.getName() + "; errs=" + errlog);

      // copy info from canon gribCollection to result partitionCollection
      result.copyInfo(gc);
      result.isPartitionOfPartitions = (gc instanceof PartitionCollectionMutable);

      result.dateRange = gc.dateRange;
    }

    // check consistency across vert and ens coords
    // create partitioned variables
    // partition index is used - do not resort partitions
    GribCollectionMutable.Dataset ds2D = makeDataset2D(errlog);
    if (ds2D == null) {
      errlog.format(" ERR makeDataset2D failed, index not written on %s%n", result.showLocation());
      throw new IllegalStateException("makeDataset2D failed, index not written on =" + result.showLocation() + "; errs=" + errlog);
    }

    // Make Best for a TwoD
    if (ds2D.gctype == GribCollectionImmutable.Type.TwoD)
      makeDatasetBest(ds2D, false);
    //else if (ds2D.gctype == GribCollectionImmutable.Type.MRUTC)
    //  makeTime2runtime(ds2D, false);

    // ready to write the index file
    return writeIndex(result, errlog);
  }
boolean createPartitionedIndex ( CollectionUpdateType forcePartition , Formatter errlog ) throws IOException { if ( errlog == null ) errlog = new Formatter ( ) ; // info will be discarded // create partitions from the partitionManager for ( MCollection dcmp : partitionManager . makePartitions ( forcePartition ) ) { dcmp . putAuxInfo ( FeatureCollectionConfig . AUX_CONFIG , partitionManager . getAuxInfo ( FeatureCollectionConfig . AUX_CONFIG ) ) ; result . addPartition ( dcmp ) ; } result . sortPartitions ( ) ; // after this the partition list is immutable // choose the "canonical" partition, aka prototype // only used in copyInfo int n = result . getPartitionSize ( ) ; if ( n == 0 ) { errlog . format ( "ERR Nothing in this partition = %s%n" , result . showLocation ( ) ) ; throw new IllegalStateException ( "Nothing in this partition =" + result . showLocation ( ) ) ; } int idx = partitionManager . getProtoIndex ( n ) ; PartitionCollectionMutable . Partition canon = result . getPartition ( idx ) ; logger . debug ( "     Using canonical partition {}" , canon . getDcm ( ) . getCollectionName ( ) ) ; try ( GribCollectionMutable gc = canon . makeGribCollection ( ) ) { // LOOK open/close canonical partition if ( gc == null ) throw new IllegalStateException ( "canon.makeGribCollection failed on =" + result . showLocation ( ) + " " + canon . getName ( ) + "; errs=" + errlog ) ; // copy info from canon gribCollection to result partitionCollection result . copyInfo ( gc ) ; result . isPartitionOfPartitions = ( gc instanceof PartitionCollectionMutable ) ; result . dateRange = gc . dateRange ; } // check consistency across vert and ens coords // create partitioned variables // partition index is used - do not resort partitions GribCollectionMutable . Dataset ds2D = makeDataset2D ( errlog ) ; if ( ds2D == null ) { errlog . format ( " ERR makeDataset2D failed, index not written on %s%n" , result . showLocation ( ) ) ; throw new IllegalStateException ( "makeDataset2D failed, index not written on =" + result . showLocation ( ) + "; errs=" + errlog ) ; } // Make Best for a TwoD if ( ds2D . gctype == GribCollectionImmutable . Type . TwoD ) makeDatasetBest ( ds2D , false ) ; //else if (ds2D.gctype == GribCollectionImmutable.Type.MRUTC) //  makeTime2runtime(ds2D, false); // ready to write the index file return writeIndex ( result , errlog ) ; }
return true if changed, exception on failure
return true if changed exception on failure