I have a raster dataset in ASCII format. Using Python, I need to determine the min
and max
values inside the dataset. I've been told that the header information is key, which contains things like number of rows/columns, cell size, and etc.
Can't you simply skip the header information and read the entire dataset to determine the min
and max
values?
This is what I'm trying to do. I'm skipping the first couple of lines which contain the header information, and trying to determine the values from there on. The following is sort of what I have, but need some guidance as I am new to Python.
raster_file = open('data.asc', 'r') # Open the file
data = raster_file.readlines()[4:] # Read the lines in the file, and skip the first six lines
for lines in data:
print max(data) # Find the max value in data
print min(data) # Find hte min value in data
Any suggestions?