Пример #1
0
 protected GribCollectionProto.Coord writeCoordProto(EnsCoord ec, int index) throws IOException {
   GribCollectionProto.Coord.Builder b = GribCollectionProto.Coord.newBuilder();
   b.setCode(0);
   b.setUnit("");
   for (EnsCoord.Coord coord : ec.getCoords()) {
     b.addValues((float) coord.getCode());
     b.addValues((float) coord.getEnsMember());
   }
   return b.build();
 }
Пример #2
0
 protected GribCollectionProto.Coord writeCoordProto(VertCoord vc, int index) throws IOException {
   GribCollectionProto.Coord.Builder b = GribCollectionProto.Coord.newBuilder();
   b.setCode(vc.getCode());
   b.setUnit(vc.getUnits());
   for (VertCoord.Level coord : vc.getCoords()) {
     if (vc.isLayer()) {
       b.addValues((float) coord.getValue1());
       b.addBound((float) coord.getValue2());
     } else {
       b.addValues((float) coord.getValue1());
     }
   }
   return b.build();
 }
Пример #3
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();
 }