[gdal-dev] Setting DataType in ReadAsArray

elliott at cpi.com elliott at cpi.com
Tue Oct 16 14:53:01 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
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>

Thanks, perfect!  Exactly what I was looking for.


More information about the gdal-dev mailing list