By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,907 Members | 1,963 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,907 IT Pros & Developers. It's quick & easy.

Data Type Error Using Gdal

P: 3
Hi guys,

I'm using a simple gdal script to load topography data from a .DEM file to a grid. However, when I do this gdal converts the data into 16 bit unsigned integers, which is no good for reading negative elevation. I though I told it to read the data as 32 bit floats, but it reads as uint16, then converts to float32. Here is my code:

import gdal
from gdalconst import *
import numpy

data = gdal.Open(topoFile,GA_ReadOnly)

band = data.GetRasterBand(1)

elevation = numpy.empty((band.YSize,band.XSize), dtype = numpy.float32)

for i in xrange(band.YSize):
elevation[i] = band.ReadAsArray(0, i, band.XSize, 1, band.XSize, 1)
Thanks!
Nov 26 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.