Skip to content

Commit

Permalink
Fix a bug with geotiff writing when yaxis is flipped
Browse files Browse the repository at this point in the history
  • Loading branch information
WeatherGod committed May 9, 2024
1 parent 12d0b71 commit 6f5afea
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cdm/misc/src/main/java/ucar/nc2/geotiff/GeotiffWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/*
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ public static List<Object[]> 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;
Expand Down

0 comments on commit 6f5afea

Please sign in to comment.