/*
* create the section of multidimensional array indices
* that defines the exact data that need to be read
* for this image index and parameters
*/
final Section section = new Section(ranges);
/*
* Setting SampleModel and ColorModel.
*/
final SampleModel sampleModel = wrapper.getSampleModel().createCompatibleSampleModel(destWidth, destHeight);
final ColorModel colorModel = ImageIOUtilities.createColorModel(sampleModel);
final WritableRaster raster = Raster.createWritableRaster(sampleModel, new Point(0, 0));
final BufferedImage image = new BufferedImage(colorModel, raster, colorModel.isAlphaPremultiplied(), null);
CoordinateAxis axis = wrapper.variableDS.getCoordinateSystems().get(0).getLatAxis();
boolean flipYAxis = false;
try {
Array yAxisStart = axis.read(new Section().appendRange(2));
float y1 = yAxisStart.getFloat(0);
float y2 = yAxisStart.getFloat(1);
if (y2 > y1) {
flipYAxis=true;
}