I have an array "array" with numbers range from -5 to 1 (with decimal) and I tried to write it as a geotiff. However, the output geotiff turns out to be all zeros. Can someone tell me why? Here the code.
from osgeo import gdal ds = gdal.Open('test.tif', gdal.GA_ReadOnly) driver = gdal.GetDriverByName("GTiff") outdata = driver.Create('output.tif', array.RasterXSize, array.RasterYSize, 1, gdal.GDT_Float32) outdata.SetGeoTransform(ds.GetGeoTransform()) outdata.SetProjection(ds.GetProjection()) outband = outdata.GetRasterBand(1) outband.WriteArray(array) outband.FlushCache()