[Gdal-dev] GDAL and Python

Christopher Barker Chris.Barker at noaa.gov
Thu Nov 2 16:45:08 EST 2006


Howard Butler wrote:
> At 02:08 PM 11/2/2006, Christopher Barker wrote:
> Is the "array interface" something that's hoped to be in Python proper 
> in the near to distant future?  I'm not aware of what this is...

The array interface is an interface for describing arrays in memory that 
you might want to efficiently pass around between different libraries. 
It was developed and implemented in numpy, and back-ported to Numeric 
and numarray:

http://numpy.scipy.org/array_interface.shtml

There is discussion right now on python-dev about including something 
like it in a future python standard library.

Until then, the most recent version of PIL supports it, and I hope to 
write some code for wxPython soon.

Is the plan for GDAL to depend on numpy? If so, then methods that return 
  batches of data can return numpy arrays, which conform to the array 
interface, and could be used by other libs that understand that, so it's 
no big deal.

On the other hand, if numpy is optional, it would be nice if those same 
methods would return an object that conforms to the array interface. 
They could conform to the standard lib buffer interface at the same 
time, I think.

Similar thinking for methods that take data as input.

> Arranging things into a "package" is something I've wished for GDAL for 
> quite a while.

It really needs to be done!

> The problem is that there are an unknown number of 
> legacy things out there dependent on gdal.py and ogr.py and the way they 
> import. Re-arranging the deck chairs at this point could cause a lot of
> misery. 

Aren't there going to be API changes anyway? editing import statements 
is a very minor task.

> I don't know how we approach this other than to write and RFC, 
> pass it, and just do it.

Nor do I. I say if you're writing the code, you have a lot of freedom to 
  structure it the way you want.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer
                                     		
NOAA/OR&R/HAZMAT         (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