0

I am calling GDAL warp using the python distribution on a NITF file and it simply outputs all zero values which creates an empty black image. The command I'm calling is

import osgeo.gdal as gdal

gdal.Warp("out.ntf", "inp.ntf")

I've tried using Translate as sort of a test to make sure GDAL as a whole is functioning and it seems to output properly. The image data is all correct and displays as expected. Any thoughts as to what could be going wrong?

Sal Aslam
  • 9
  • 1

1 Answers1

0

One thing that's important is to close the Dataset, depending a little on how you run it (script, repl, notebook etc).

This Python interface to the command-line utilities returns an opened Dataset, so you can explicitly close it with.

import osgeo.gdal as gdal

ds = gdal.Warp("out.ntf", "inp.ntf")
ds = None

That will cause for example anything in the GDAL-cache to be properly flushed to disk.

Rutger Kassies
  • 61,630
  • 17
  • 112
  • 97
  • Hey Rutger! I gave this a go and it look like the output array still only contains zeros and produces an empty black image. – Sal Aslam Nov 16 '22 at 14:38
  • I'm not sure what else it could be, I can't reproduce it without the data. Have you tried other files, or other file formats? – Rutger Kassies Nov 17 '22 at 07:35