[gdal-dev] Correct way to create a new GTiff, with numpy.zeros() and python bindings (resolved)

Christopher Barker Chris.Barker at noaa.gov
Mon Jun 9 12:38:58 EDT 2008


Frank and/or Howard,

Dane Springmeyer wrote:
> However, with a little more digging I think I found the simple problem: 

> my axis needed to be reversed when calling the numpy function:

> dst_ds = driver.Create( "test.tif", 7850, 3500, 4, gdal.GDT_Byte)
...
> zeros = numpy.zeros( (3500, 7850), numpy.uint8 )
...
 > dst_ds.GetRasterBand(1).WriteArray( zeros )

This seems to highlight a unfortunate mis-match in the GDAL/numpy api. 
As numpy arrays can be internally stored in either Fortran or C order 
(or other options, actually), it would be nice if there could be a match 
of index order.

Of course, it may be too late now, as we'd want to preserve backward 
compatibility.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov


More information about the gdal-dev mailing list