Band-specific nodata values not correctly updated
Here is an example:
from geoarray import GeoArray
import numpy as np
# create a dummy dataset with nodata=0
gA = GeoArray(np.random.randint(0, 10, (5, 5)), nodata=0)
gA.save('/path/to/tmp.tif', fmt='GTIFF')
# read that dataset and overwrite the nodata value
gA2 = GeoArray('/path/to/tmp.tif', nodata=0).to_mem()
gA2.nodata = -9999
gA2.save('/path/to/out.tif', fmt='GTIFF')
Now the band-specific nodata value should be updated from 0 t0 -9999. However, it remains 0:
$ gdalinfo /path/to/out.tif
Driver: GTiff/GeoTIFF
Files: /path/to/out.tif
Size is 5, 5
Origin = (0.000000000000000,0.000000000000000)
Pixel Size = (1.000000000000000,-1.000000000000000)
Metadata:
data_ignore_value='-9999'
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 0.0000000, 0.0000000)
Lower Left ( 0.0000000, -5.0000000)
Upper Right ( 5.0000000, 0.0000000)
Lower Right ( 5.0000000, -5.0000000)
Center ( 2.5000000, -2.5000000)
Band 1 Block=5x5 Type=Float64, ColorInterp=Gray
NoData Value=0
This causes, e.g., QGIS to not correctly recognize the nodata value.