예제 #1
0
  protected GribCollectionProto.Parameter writeParamProto(Parameter param) throws IOException {
    GribCollectionProto.Parameter.Builder b = GribCollectionProto.Parameter.newBuilder();

    b.setName(param.getName());
    if (param.isString()) b.setSdata(param.getStringValue());
    else {
      for (int i = 0; i < param.getLength(); i++) b.addData(param.getNumericValue(i));
    }

    return b.build();
  }
예제 #2
0
  private Parameter readParam(GribCollectionProto.Parameter pp) throws IOException {
    if (pp.hasSdata()) return new Parameter(pp.getName(), pp.getSdata());

    int count = 0;
    double[] vals = new double[pp.getDataCount()];
    for (double val : pp.getDataList()) vals[count++] = val;

    return new Parameter(pp.getName(), vals);
  }