Commit 873aa965 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Fixed unsupported band-specific nodata values in case of ENVI output format.


Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent 6c4ac762
Pipeline #26320 passed with stage
in 1 minute and 44 seconds
......@@ -11,6 +11,8 @@ History
invalidated by later changes
* *Warning 2*: The IFD has been rewritten at the end of the file, which breaks COG layout.
* Fixed unsupported band-specific nodata values in case of ENVI output format.
0.14.0 (2021-07-26)
-------------------
......
......@@ -1051,24 +1051,22 @@ class GeoArray(object):
band.SetDescription(bandname)
assert band.GetDescription() == bandname
# NOTE: band-specific nodata values are not supported by the ENVI header format
if 'nodata' in envi_metadict:
nodataVal = self.metadata.band_meta['nodata'][bidx]
band.SetNoDataValue(nodataVal)
assert band.GetNoDataValue() == nodataVal
del band
# avoid that band names are written to global meta
if 'band_names' in envi_metadict:
del envi_metadict['band_names']
# the expected key name is 'data_ignore_value', see below
if 'nodata' in envi_metadict:
del envi_metadict['nodata']
# set data_ignore_value in case self.metadata.band_meta contains a unique nodata value
if 'nodata' in self.metadata.band_meta and len(set(self.metadata.band_meta['nodata'])) == 1:
envi_metadict['data_ignore_value'] = str(self.metadata.band_meta['nodata'][0])
if 'nodata' in self.metadata.band_meta:
if len(set(self.metadata.band_meta['nodata'])) == 1:
envi_metadict['data_ignore_value'] = str(self.metadata.band_meta['nodata'][0])
else:
warnings.warn("Band-specific nodata values are not supported by the ENVI header format.")
ds_out.SetMetadata(envi_metadict, 'ENVI')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment