grib/src/main/java/ucar/nc2/grib/collection/GribPartitionBuilder.java
private GribCollectionProto.Group writeGroupProto(PartitionCollectionMutable pc, GribCollectionMutable.GroupGC g) throws IOException {
    GribCollectionProto.Group.Builder b = GribCollectionProto.Group.newBuilder();

    b.setGds(GribCollectionWriter.writeGdsProto(g.horizCoordSys.getRawGds(), g.horizCoordSys.getPredefinedGridDefinition()));

    for (GribCollectionMutable.VariableIndex vb : g.variList) {
      b.addVariables(writeVariableProto((PartitionCollectionMutable.VariableIndexPartitioned) vb));
    }

    for (Coordinate coord : g.coords) {
      switch (coord.getType()) {
        case runtime:
          b.addCoords(writer.writeCoordProto((CoordinateRuntime) coord));
          break;
        case time:
          b.addCoords(writer.writeCoordProto((CoordinateTime) coord));
          break;
        case timeIntv:
          b.addCoords(writer.writeCoordProto((CoordinateTimeIntv) coord));
          break;
        case time2D:
          b.addCoords(writer.writeCoordProto((CoordinateTime2D) coord));
          break;
        case vert:
          b.addCoords(writer.writeCoordProto((CoordinateVert) coord));
          break;
        case ens:
          b.addCoords(writer.writeCoordProto((CoordinateEns) coord));
          break;
      }
    }

    if (g.filenose != null)
      for (Integer fileno : g.filenose)
        b.addFileno(fileno);

    return b.build();
  }
private GribCollectionProto.Group writeGroupProto(PartitionCollectionMutable pc, GribCollectionMutable.GroupGC g) throws IOException {
    GribCollectionProto.Group.Builder b = GribCollectionProto.Group.newBuilder();

    b.setGds(GribCollectionWriter.writeGdsProto(g.horizCoordSys.getRawGds(), g.horizCoordSys.getPredefinedGridDefinition()));

    for (GribCollectionMutable.VariableIndex vb : g.variList) {
      b.addVariables(writeVariableProto((PartitionCollectionMutable.VariableIndexPartitioned) vb));
    }

    for (Coordinate coord : g.coords) {
      switch (coord.getType()) {
        case runtime:
          b.addCoords(writer.writeCoordProto((CoordinateRuntime) coord));
          break;
        case time:
          b.addCoords(writer.writeCoordProto((CoordinateTime) coord));
          break;
        case timeIntv:
          b.addCoords(writer.writeCoordProto((CoordinateTimeIntv) coord));
          break;
        case time2D:
          b.addCoords(writer.writeCoordProto((CoordinateTime2D) coord));
          break;
        case vert:
          b.addCoords(writer.writeCoordProto((CoordinateVert) coord));
          break;
        case ens:
          b.addCoords(writer.writeCoordProto((CoordinateEns) coord));
          break;
      }
    }

    if (g.filenose != null)
      for (Integer fileno : g.filenose)
        b.addFileno(fileno);

    return b.build();
  }
private GribCollectionProto . Group writeGroupProto ( PartitionCollectionMutable pc , GribCollectionMutable . GroupGC g ) throws IOException { GribCollectionProto . Group . Builder b = GribCollectionProto . Group . newBuilder ( ) ; b . setGds ( GribCollectionWriter . writeGdsProto ( g . horizCoordSys . getRawGds ( ) , g . horizCoordSys . getPredefinedGridDefinition ( ) ) ) ; for ( GribCollectionMutable . VariableIndex vb : g . variList ) { b . addVariables ( writeVariableProto ( ( PartitionCollectionMutable . VariableIndexPartitioned ) vb ) ) ; } for ( Coordinate coord : g . coords ) { switch ( coord . getType ( ) ) { case runtime : b . addCoords ( writer . writeCoordProto ( ( CoordinateRuntime ) coord ) ) ; break ; case time : b . addCoords ( writer . writeCoordProto ( ( CoordinateTime ) coord ) ) ; break ; case timeIntv : b . addCoords ( writer . writeCoordProto ( ( CoordinateTimeIntv ) coord ) ) ; break ; case time2D : b . addCoords ( writer . writeCoordProto ( ( CoordinateTime2D ) coord ) ) ; break ; case vert : b . addCoords ( writer . writeCoordProto ( ( CoordinateVert ) coord ) ) ; break ; case ens : b . addCoords ( writer . writeCoordProto ( ( CoordinateEns ) coord ) ) ; break ; } } if ( g . filenose != null ) for ( Integer fileno : g . filenose ) b . addFileno ( fileno ) ; return b . build ( ) ; }
/*
message Group {
Gds gds = 1;                             // use this to build the HorizCoordSys
repeated Variable variables = 2;         // list of variables
repeated Coord coords = 3;               // list of coordinates
repeated uint32 fileno = 4 [packed=true]; // the component files that are in this group, key into gc.mfiles
}
/ * message Group { Gds gds = 1 ; // use this to build the HorizCoordSys repeated Variable variables = 2 ; // list of variables repeated Coord coords = 3 ; // list of coordinates repeated uint32 fileno = 4 [ packed = true ] ; // the component files that are in this group key into gc . mfiles }