Skip to content

Commit e8ec124

Browse files
authored
Merge pull request #558 from USACE/dss-py
nodata value fix
2 parents db7cc3a + b3481a7 commit e8ec124

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

  • async_packager/src/cumulus_packager/writers

async_packager/src/cumulus_packager/writers/dss7.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,11 @@ def writer(
122122
data = raster.ReadAsArray(resample_alg=gdal.gdalconst.GRIORA_Bilinear)
123123
# Flip the dataset up/down because tif and dss have different origins
124124
data = numpy.flipud(data)
125-
125+
DSS_UNDEFINED_VALUE = -3.4028234663852886e+38
126+
data = numpy.array(data, dtype=numpy.float64)
127+
numpy.putmask(
128+
data, data == nodata, numpy.nan
129+
) # Replace nodata with NaN for processing
126130
# GeoTransforma and lower X Y
127131
xsize = warp_ds.RasterXSize
128132
ysize = warp_ds.RasterYSize
@@ -153,7 +157,7 @@ def writer(
153157
cellSize=cellsize,
154158
xCoordOfGridCellZero=0.0,
155159
yCoordOfGridCellZero=0.0,
156-
nullValue=nodata if nodata is not None else 0.0,
160+
nullValue=DSS_UNDEFINED_VALUE,
157161
data=data,
158162
)
159163

0 commit comments

Comments
 (0)