Skip to content

Commit

Permalink
Cap the inferred dtype at float for geotiff writing
Browse files Browse the repository at this point in the history
  • Loading branch information
WeatherGod committed Feb 14, 2024
1 parent 882a5fa commit 98056eb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cdm/misc/src/main/java/ucar/nc2/geotiff/GeotiffWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ void writeGrid(GridDatatype grid, Array data, boolean greyScale, double xStart,

if (dtype == null) {
dtype = data.getDataType();
// Need to cap at single precision floats because that's what gets written for floating points
if (dtype == DataType.DOUBLE) {
dtype = DataType.FLOAT;
}
}

// get rid of this when all projections are implemented
Expand Down Expand Up @@ -817,6 +821,10 @@ public void writeGrid(GeoReferencedArray array, boolean greyScale, DataType dtyp

if (dtype == null) {
dtype = data.getDataType();
// Need to cap at single precision floats because that's what gets written for floating points
if (dtype == DataType.DOUBLE) {
dtype = DataType.FLOAT;
}
}

/*
Expand Down

0 comments on commit 98056eb

Please sign in to comment.