[gdal-dev] Python Bindings - ReadArray direct to ctypes array?
jzl5325 at psu.edu
Mon Jul 30 09:31:03 PDT 2012
One more, likely, foolish question.
Where is libgdal.dylib living on OSX? I have used the Kyngchaos binary
installer and it looks like it renames libgdal.dylib to simply GDAL.
Should I be soft linking that libgdal.dylib?
Also, evan's test  looks like it is using simply libgdal.dylib. Is that
test failing on OS X then?
On Mon, Jul 30, 2012 at 8:19 AM, Jay L. <jzl5325 at psu.edu> wrote:
> Thanks for the link / info. My issue is not working with the ctypes
> array, but the fact that, I believe, GDAL returns a numpy array using
> gdal.ReadAsArray(). Perhaps it is possible to use the GDAL python bindings
> ReadAsArray() to go directly into a ctypes array (as opposed to the
> wonderful code post earlier in this thread), but I have missed it.
> Is it possible, not using the previously posted code, to do something like:
> empty_ctypes_array = multiprocessing.RawArray(data_type, size)
> I realize that the above will not work, but offer it only as a pseudo code
> example. Using the above we could go direct to the ctypes array without
> using either any C code, or an intermediate numpy array.
> I will definitely check out the SciPy mailing list to see what the current
> trends in multiprocessing are on large arrays.
> Thanks and please do correct all inaccuracies as I am trying to improve my
> fluency in GDAL!
> On Sun, Jul 29, 2012 at 2:20 PM, Chris Barker <chris.barker at noaa.gov>wrote:
>> On Fri, Jul 27, 2012 at 8:40 PM, Jay L. <jzl5325 at psu.edu> wrote:
>> > Currently the workflow is to open the dataset and grab the first band,
>> > usual. I then read in the array, create an empty ctype array, and use
>> > memmove to move the numpy array to my ctypes array.
>> numpy comes with some utilities for working with ctypes and numpy
>> arrays -- you certainly should be able to do that without a copy. Poke
>> around in the numyp source, docs, and mailing list.
>> If I understand the docs right, this makes it really simple:
>> note that there is a lot of great stuff going on with numpy and
>> Cython doing this sort of stuff -- numpy arrays may be a good bet anyway.
>> You might also want to check out geo-Dango -- I think they've got a
>> pretty complete wrapper for GDAL with ctypes
>> Christopher Barker, Ph.D.
>> 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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the gdal-dev