X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 20 Jun 2012 12:34 PM by  anon
How do I assign bands for batch processing in ENVI band math?
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
20 Jun 2012 12:34 PM
    I am trying to perform batch processing in ENVI using band math. The input is a 7-band file of MODIS reflectance data which have been converted from hdf to bsq. The data type is integer. I want to compute a normalized difference ratio using MODIS bands 2 and 6. I know that, in order to get bands 2 and 6, the POS syntax should refer to [1,5]. I've modified some code from another program (which works fine). The problem is that the values I get are negative and incorrect when computed using the code below. When I compute in ENVI by hand they are positive and correct. Here's what I'm doing: ;envi_open_data_file, filename, r_fid=r_fid, /ENVI envi_open_file, filename, r_fid=r_fid ; open the file in ENVI envi_file_query, r_fid, fname=filename, dims=dims, nl=nl, ns=ns, nb=nb exp = '(float(b2)-float(b6))/(float(b2)+float(b6))' pos=[1,5]-1 fid=[r_fid,r_fid] ; if the input file is valid, then compute LSWI if (file_test(out_name(n)) ne 1) then envi_doit, 'math_doit', dims=dims, exp=exp, fid=fid, pos=pos, r_fid=math_fid, out_name=out_name(n) Thanks for any insights you can provide.

    Deleted User



    New Member


    Posts:
    New Member


    --
    20 Jun 2012 01:56 PM
    Your logic seems sound, but when you set up your bands, you use this line of code: pos=[1,5]-1 Which makes pos be a 2 element array containing the values 0 and 4. So, I think it's the -1 in your definition of the pos variable that is messing things up. I think if you leave out the -1, you'll have what you want. - Peg

    Deleted User



    New Member


    Posts:
    New Member


    --
    20 Jun 2012 03:55 PM
    We have tried without the -1 and still get the same incorrect values. It seems like the bands in the code aren't associated with the correct bands in the MODIS file.
    You are not authorized to post a reply.