diff --git a/cdm/misc/src/main/java/ucar/nc2/geotiff/GeotiffWriter.java b/cdm/misc/src/main/java/ucar/nc2/geotiff/GeotiffWriter.java index f0d9e4e1c8..4c59a1d5eb 100644 --- a/cdm/misc/src/main/java/ucar/nc2/geotiff/GeotiffWriter.java +++ b/cdm/misc/src/main/java/ucar/nc2/geotiff/GeotiffWriter.java @@ -558,7 +558,7 @@ public void writeGrid(GeoReferencedArray array, boolean greyScale) throws IOExce Array data = array.getData().reduce(); if (yaxis.getCoordMidpoint(0) < yaxis.getCoordMidpoint(1)) { data = data.flip(0); - yStart = yaxis.getCoordEdgeLast(); + yStart = yaxis.getCoordEdgeLast() * scaler; } /* diff --git a/cdm/misc/src/test/data/ucar/nc2/geotiff/categorical.nc b/cdm/misc/src/test/data/ucar/nc2/geotiff/categorical.nc new file mode 100644 index 0000000000..e388dc1a0a Binary files /dev/null and b/cdm/misc/src/test/data/ucar/nc2/geotiff/categorical.nc differ diff --git a/cdm/misc/src/test/java/ucar/nc2/geotiff/TestGeoTiffWriter.java b/cdm/misc/src/test/java/ucar/nc2/geotiff/TestGeoTiffWriter.java index aa1d5e66cc..8372ed37a6 100644 --- a/cdm/misc/src/test/java/ucar/nc2/geotiff/TestGeoTiffWriter.java +++ b/cdm/misc/src/test/java/ucar/nc2/geotiff/TestGeoTiffWriter.java @@ -64,6 +64,11 @@ public static List getTestParameters() { result.add(new Object[] {TestDir.cdmUnitTestDir + "ft/coverage/testCFwriter.nc", FeatureType.GRID, "Temperature", greyscale == 1}); + + // This file is unique in that it is lambert conformal with yaxis flipped. + result.add( + new Object[] {"src/test/data/ucar/nc2/geotiff/categorical.nc", FeatureType.GRID, "drought", greyscale == 1}); + } return result;