[gdal-dev] Setting DataType in ReadAsArray

Antonio Falciano afalciano at yahoo.it
Tue Oct 16 13:59:45 PDT 2012


Il 16/10/2012 22.05, elliott at cpi.com ha scritto:
> Hello,
>
> Does anybody know of a way to set the data type in the call ReadAsArray.
> It is currently reading a field as an unsigned int and it needs to be read
> as a signed int.

Hi,
ReadAsArray returns substantially a numpy array, so you can use np
functions and methods of conversions between data types [1]. Finally,
the simplest way consists into using the .astype() method. Hope this helps!

Cheers,
Antonio

[1] http://docs.scipy.org/doc/numpy/user/basics.types.html

-- 
Antonio Falciano
http://www.linkedin.com/in/antoniofalciano


More information about the gdal-dev mailing list