Exemplo n.º 1
0
 protected GribCollectionProto.Coord writeCoordProto(TimeCoord tc, int index) throws IOException {
   GribCollectionProto.Coord.Builder b = GribCollectionProto.Coord.newBuilder();
   b.setCode(index);
   b.setUnit(tc.getUnits());
   float scale =
       (float) tc.getTimeUnitScale(); // deal with, eg, "6 hours" by multiplying values by 6
   if (tc.isInterval()) {
     for (TimeCoord.Tinv tinv : tc.getIntervals()) {
       b.addValues(tinv.getBounds1() * scale);
       b.addBound(tinv.getBounds2() * scale);
     }
   } else {
     for (int value : tc.getCoords()) b.addValues(value * scale);
   }
   return b.build();
 }