January 15, 200422 yr Hi, when import H3 in Python, appears:Traceback (mos recent call last):File "",line 1, in -toplevel-impor H3IdentationError: expected an idented block (H3.py, line 8)Can anybody help me?My H3.py:# Manipulate SRTM-Data# Attention: HGT-Files are big Endian !!!!!!!!def HGT2RAW (inp,op) :# Convert 16bit Raw 1Channel --> 8Bit Raw 3-Channel# Start with H3.HGT2RAW ('C:/Temp/N38W001.hgt','C:/Temp/N38W001.raw')infile = open(inp,'rb') # open hgt-file as inputoutfile = open(op, 'wb') # open raw-file as outputa=0b=0while a != '': # while not EOFa = infile.read(1) # read left Byte of Elevationb = infile.read(1) # read right Byte of Elevationif a == '': # break if nullstring (EOF or empty file)breakelif a == 'x01': # create red channel from left Byteoutfile.write('x10')elif a == 'x02':outfile.write('x20')elif a == 'x03':outfile.write('x30')elif a == 'x04':outfile.write('x40')elif a == 'x05':outfile.write('x50')elif a == 'x06':outfile.write('x60')elif a == 'x07':outfile.write('x70')elif a == 'x08':outfile.write('x80')elif a == 'x09':outfile.write('x90')elif a == 'x0A':outfile.write('xA0')elif a == 'x0B':outfile.write('xB0')elif a == 'x0C':outfile.write('xC0')elif a == 'x0D':outfile.write('xD0')elif a == 'x0E':outfile.write('xE0')elif a == 'x0F':outfile.write('xF0')elif a == 'x1F':outfile.write('xFF')else:outfile.write('x00') # write(red), 0 when missing SRTMoutfile.write(a) # write(green)outfile.write(:( # write(blue)infile.close()outfile.close()print 'Conversion HGT2RAW sucessfull finished'def RAW2RAS (inp,op) :# Convert 8Bit Raw 3-Channel to 16bit Raw 1Channel (Fly2 RAS)# Start with H3.RAW2RAS ('c:/Temp/N38W001.raw','c:/Temp/N38W001.ras')infile = open(inp,'rb') # open raw-file as inputoutfile = open(op, 'wb') # open ras-file as outputa=0while a != '':infile.read(1) # remove red Channela = infile.read(2)outfile.write(a)infile.close()outfile.close()print 'Conversion RAW2RAS sucessfull finished' I have finished Photoscenry LEAL, only I just need to correct holes in LEAL elevation
January 16, 200422 yr HiI recomand to use SRTMFILL from 3dnature to fill the holes, its done in seconds.Yor problem is, that all code starts left.xxxxxxxxxxxxit should look likexxxx xxxx xxxxlook at my post with the sript to find out which lines need leading blanks (indented blocks)Harald
Create an account or sign in to comment