I am trying to use gdal.FillNodata in python on a ".tif" raster. The nodata value is set to -3.402823e+38. Here is my code :
import gdal
from gdalconst import *
ET = gdal.Open("ET_sample_reclass.tif", GA_Update)
ETband = ET.GetRasterBand(1)
result = gdal.FillNodata(targetBand = ETband, maskBand = None,
maxSearchDist = 5, smoothingIterations = 0)
print result # return 0
This code seems to do actually nothing and I don't know how to define an output raster in python. I haven't found any example yet to enlighten me.
ET = None
at the end of your script this should work. You can see the same behaviour in the source code of thegdal_fillnodata.py
script.CreateCopy()
method to copy a dataset and then write new data into it or create a new dataset from scratch with theCreate()
method. This is documented in the GDAL API. Not all drivers support theCreate()
method though, but GeoTiff definitely does.