On Tue, Oct 16, 2012 at 1:59 PM, Antonio Falciano <[email protected]> wrote:
>> 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. > 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! Actually you probably don't want that -- .astype() does a type conversion, and what you want is to interpret the data in a different way -- you can use .view for that -- somethign like: arr =... ReadAsArray(...) arr2 = arr.view(dtype=np.int32) # or the appropriate type. that will create a new array that points to the same data buffer, but interpretting the buffer as the new type though I'd think ReadAsArray would get it right.... -Chris > 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 > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev -- Christopher Barker, Ph.D. Oceanographer 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 [email protected] _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
