reading dem [message #21573] |
Tue, 29 August 2000 23:07  |
Sylvain Carette
Messages: 19 Registered: May 2000
|
Junior Member |
|
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<tt>I'm trying to get started with IDL .</tt>
<br><tt>All their examples work fine. But of course, working with my data
didnt work at all...</tt>
<br><tt>Need to read usgs1:250k dem. I'm not sure if I understand the format
but I succeed to</tt>
<br><tt>get the right value using " reads, string(filechunk), var ". Maybe
there is other ways</tt>
<br><tt>with assoc, format, xdr stuff?</tt>
<br><tt>Anyhow, the problem here is that although if I execute each line
of a small procedure</tt>
<br><tt>separately from the console and it work as expected, it doesnt
when i execute the</tt>
<br><tt>procedure. It doesnt even finish the first loop.</tt>
<br><tt>% READS: End of input data encountered: <STRING
(' 366 366 359 ...')></tt>
<br><tt>% Execution halted at: READDEM250
25 C:\RSI\IDL53\project\readdem250.pro</tt>
<br><tt>Why can I execute the first loop cycle from the console and not
from inside the loop?</tt>
<br><tt>What did I miss?</tt>
<br><tt>Below listing - btw, the reason the statements are all written
inline instead of</tt>
<br><tt>inside another loop is that I coulnt get nested loop to work thanks
to wonderful IDL documentation.</tt><tt></tt>
<p><tt>Thanks</tt><tt></tt>
<p><tt>Sylvain Carette</tt>
<br><tt>VRML designer-composer</tt><tt></tt>
<p><tt>pro readdem250</tt>
<br><tt>openr, lun, dialog_pickfile(), /get_lun</tt>
<br><tt>block = assoc( lun, bytarr(1024)) ;the file is divided in 1024
chunk</tt>
<br><tt>im = intarr(1201,1201) ; dem is 1201x1201</tt>
<br><tt>col = intarr(1201) ; one column</tt>
<br><tt>ba = intarr(146) ; to hold one profile stored trough 8*1024 recordB
chunk</tt>
<br><tt>bb = intarr(170) ; first = 146 bytes, last = 35 bytes,</tt>
<br><tt>bc = intarr(170) ; others = 170 bytes, total = 1201 bytes</tt>
<br><tt>bd = intarr(170)</tt>
<br><tt>be = intarr(170)</tt>
<br><tt>bf = intarr(170)</tt>
<br><tt>bg = intarr(170)</tt>
<br><tt>bh = intarr(35)</tt><tt></tt>
<p><tt>for i=1, 1201 do begin ; skip first 1024 chunk, "recordA"</tt>
<br><tt> reads, string(block[146:*,i]), ba ; recordB profile value
begin at byte 146</tt>
<br><tt> reads, string(block[i+1]), bb</tt>
<br><tt> reads, string(block[i+2]), bc</tt>
<br><tt> reads, string(block[i+3]), bd</tt>
<br><tt> reads, string(block[i+4]), be</tt>
<br><tt> reads, string(block[i+5]), bf</tt>
<br><tt> reads, string(block[i+6]), bg</tt>
<br><tt> reads, string(block[0:210,i+7]), bh ; 6 byte/value</tt>
<br><tt> </tt>
<br><tt> col = [ba, bb, bc, bd, be, bf, bg, bh] ; concatenate all
segment in one profile</tt>
<br><tt> im[i,*] = col</tt>
<br><tt>endfor</tt>
<br><tt>imlr = bytscl(im)</tt>
<br><tt>end</tt></html>
|
|
|