It's definitely do-able, but what it really depends on is how
rigorously formatted the text files are. What you probably want to do
is create a separate routine that will read each file into a well-
defined structure, which can be read later. Actually, I'm not so sure
about the structure part, I don't use those terribly often. The
tricky part will really be reading in the data properly. You'll have
to parse the input files properly, and how easily that happens will
depend (as I said) on how rigorous the file's format is. For
instance:
Is the first line of a "group" of always a description, followed by a
single space, followed by the type?
Is the second line always the phrase: 'MODIS_Band_' followed by a
number, followed by useless stuff?
Is the third line always a description, followed by the values
separated by spaces?
If so, then you would try something like this (in psuedo-code, with no
attempts at bug-finding):
gettype = 'Continental'
getband = '1'
getdepth = '0.04'
getangle = '2'
openr, unit, filename, /get_lun
readf, unit, line1
readf, unit, line2
readf, unit, line3
line1dat = strsplit( line1, ' ', /extract )
line2dat = strsplit( line2, '_', /extract )
line3dat = strsplit( line3, ' ', /extract )
type = line1dat[1]
band = line2dat[2]
while( not eof(unit) ) do begin
readf, unit, line
thisline = strsplit( line, ' ', /extract )
thiszenith = thisline[0]
if ( type eq gettype and band eq getband and thiszenith eq
getangle ) then return, thiszenith[ where( getdepth eq line3dat ) ]
endwhile
That's one way to go. Obviously, you'd have to change a fair amount
still, since I'm assuming there is only one group in each file. Also,
as I said, this will only work under the above conditions. If the
exact layout of the group changes you'll have to extract your data
differently
On May 17, 5:13 am, DirtyHarry <kim20...@gmail.com> wrote:
> I posted a message few days ago and have been waiting any suggestions,
> but no one reply. (I am really sad and feel left out.. T.T) I think my
> question was too broad and vague. Therefore, I narrowed down the
> question.
>
> What I really would like to do now is just to read values of the table
> shown below.
>
> Skyl_lut.dat00.dat
>
> Aerosol_type: Continental
> MODIS_Band_1: (0.620,0.670)
> S&O 0.00 0.02 0.04
> ------------------
> 0 0.027 0.040 0.053
> 1 0.028 0.041 0.054
> 2 0.029 0.042 0.055
>
> There are 9 target values in this table. Others are just kind of input
> variables to get those values.
>
> For example, in order to read 0.055 in the table, required input
> variables are...
>
> aerosol_type = continental
> MODIS band = 1
> Optical depth = 0.04
> solar zenith angle = 2
>
> If it is possible, I want to do make a function with 4 input
> variables, and then the output of this function should be a value in
> this table.
>
> Sorry for bothering you, but please give me any suggestions. Thanks in
> advance.
>
> Harry
|