473,396 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Data Type Error Using Gdal

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)
Nov 26 '07 #1
0 1271

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

Similar topics

by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is...
by: Jack | last post by:
Hi, I am trying to test a sql statement in Access which gives me the error as stated in the heading. The sql statement is built as a part of asp login verification, where the userid and password...
by: J. Campbell | last post by:
I have a feeling that I'm doing things all ass-backwards (again ;-), and would like some advice. What I want to do is: put some data to memory and then access that memory space as an array of...
by: Dan | last post by:
I'm trying to creat a data structure, that can be either a integer, double, string, or linked list. So I created the following, but don't know if it is the data structure itself causing problems,...
by: rogsonl | last post by:
My computer was moved last week, and the company changed the network groups we work on. As a result, one of the main benefits from Whidbey (database connectivity) no longer works. Situation: 1....
by: Julien Fiore | last post by:
Hi, I wrote a function to compute openness (a digital elevation model attribute). The function opens the gdal-compatible input raster and reads the values in a square window around each cell. The...
by: Joel Hedlund | last post by:
Hi! The question of type checking/enforcing has bothered me for a while, and since this newsgroup has a wealth of competence subscribed to it, I figured this would be a great way of learning...
by: ghjk | last post by:
I wan to add some data using php page to mysql db. But I got the error saying "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right...
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.