[gdal-dev] python bindings: 2x ds.WriteRaster?

Vincent Schut schut at sarvision.nl
Tue Nov 29 06:03:26 EST 2011


On 11/29/2011 11:57 AM, Even Rouault wrote:
> Selon Vincent Schut<schut at sarvision.nl>:
>
>> Hi list,
>>
>> Remembering a recent message mentioning the existence of both
>> 'ReadArray' and 'WriteArray' on the dataset level of the python swig
>> bindings, I opened up my gdal.py (svn rev. 23438), and found this:
>>
>> There is a ds.ReadAsArray()
> line 730
>
>> There is no ds.WriteArray()
> actually, there's no WriteArray() at dataset level. It exists only at band
> level.

Ah. It was your own replay in the recent thread 'clipping an image via 
python api problems' that made me thinks this. I quote:
"/Le lundi 28 novembre 2011 07:44:26, Chaitanya kumar CH a écrit : /
> /I should have said that you need to copy all bands 'individually'.
> /
/Well, ReadAsArary() and WriteArray() also exist at the dataset level and will
read/write all bands./
"

I suppose you meant something different then, no problem.

>
>> There are *2* defined functions ds.WriteRaster() (line 730, and line 767
>> in gdal.py).
>>
>> Especially the last point is bothering me... What is the intention of
>> that? Afaik one of those will probably never be called? Should one of
>> those have had a different name? Is my gdal.py bad?
> Your gdal.py is fine, but yes, it is a bit confusing to have 2 definitions. The
> last one that overrides the first one will be used. But I agree this could be
> fixed to avoid the confusion.
OK, so the last one is the 'valid' one. Good to know.

Thank for the reply.

Vincent Schut.
>
>> Cheers,
>> Vincent.
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20111129/eaff0389/attachment-0001.html


More information about the gdal-dev mailing list