(int) gridEnvelope.getHeight());
GridGeometry2D localGridGeometry = new GridGeometry2D(readingGridRange, gridToCRS2D,
mapExtent.getCoordinateReferenceSystem());
double[][] resolutionLevels = reader.getResolutionLevels();
ReadResolutionCalculator calculator = new ReadResolutionCalculator(localGridGeometry,
readerCRS, resolutionLevels != null ? resolutionLevels[0] : null);
calculator.setAccurateResolution(true);
double[] readResolution = calculator.computeRequestedResolution(reducedEnvelope);
int width = (int) Math.max(1,
Math.round(readEnvelope.getWidth() / Math.abs(readResolution[0])));
int height = (int) Math.max(1,
Math.round(readEnvelope.getHeight() / Math.abs(readResolution[1])));
GridEnvelope2D gridRange = new GridEnvelope2D(0, 0, width, height);