// read in the index, create if it doesnt exist or is out of date
 public static Grib1TimePartition factory(
     TimePartitionCollection tpc, CollectionManager.Force force, Formatter f) throws IOException {
   Grib1TimePartitionBuilder builder =
       new Grib1TimePartitionBuilder(tpc.getCollectionName(), new File(tpc.getRoot()), tpc);
   builder.readOrCreateIndex(force, f);
   return builder.tp;
 }
 // called by tdm
 public static boolean update(TimePartitionCollection tpc, Formatter f) throws IOException {
   Grib1TimePartitionBuilder builder =
       new Grib1TimePartitionBuilder(tpc.getCollectionName(), new File(tpc.getRoot()), tpc);
   if (!builder.needsUpdate()) return false;
   builder.readOrCreateIndex(CollectionManager.Force.always, f);
   builder.gc.close();
   return true;
 }
  /**
   * write new index if needed
   *
   * @param tpc use this collection
   * @param force force index
   * @param f put status messagess here
   * @return true if index was written
   * @throws IOException on error
   */
  public static boolean writeIndexFile(
      TimePartitionCollection tpc, CollectionManager.Force force, Formatter f) throws IOException {
    Grib1TimePartitionBuilder builder = null;
    try {
      builder =
          new Grib1TimePartitionBuilder(tpc.getCollectionName(), new File(tpc.getRoot()), tpc);
      return builder.readOrCreateIndex(force, f);

    } finally {
      if ((builder != null) && (builder.tp != null)) builder.tp.close();
    }
  }