private void extremaOp(TiffMeta surface, GridCoverage2D gridCoverage2D) {
    double min = Double.MAX_VALUE;
    double max = Double.MIN_VALUE;

    RenderedImage img = gridCoverage2D.getRenderedImage();

    RenderedOp extremaOp = ExtremaDescriptor.create(img, null, 10, 10, false, 1, null);
    double[] allMins = (double[]) extremaOp.getProperty("minimum");
    min = Doubles.min(allMins);

    double[] allMaxs = (double[]) extremaOp.getProperty("maximum");
    max = Doubles.max(allMaxs);

    surface.setMaxVal(max);
    surface.setMinVal(min);
  }
Exemplo n.º 2
0
  @Override
  public boolean apply(@Nullable Scenario scenario) {
    final List<Double> loads =
        newArrayList(
            relative ? Metrics.measureRelativeLoad(scenario) : Metrics.measureLoad(scenario));
    final int toAdd = desiredLoadList.size() - loads.size();
    for (int j = 0; j < toAdd; j++) {
      loads.add(0d);
    }

    final double[] deviations =
        abs(subtract(Doubles.toArray(desiredLoadList), Doubles.toArray(loads)));
    final double mean = StatUtils.mean(deviations);
    final double max = Doubles.max(deviations);
    return max <= maxMax && mean <= maxMean;
  }