X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 01 Mar 2012 11:07 AM by  anon
Band Math Error
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
01 Mar 2012 11:07 AM
    Hello, I'm new to IDL and I'm trying to run some band math equations on a lot of images. My script works for the first 100 images or so, but doesn't work on the rest. It says that the imagery must be a scalar or 1 element array in this context: . It seems that when I import the images into ENVI they display this ( fid = Long [2] ); while the other images displayed this ( fid = 2 ). Here is the script for an example image that does not work: PRO Test ; Restore the core file and start ENVI in batch ENVI, /RESTORE_BASE_SAVE_FILES ENVI_BATCH_INIT, LOG_FILE = 'batch.txt' envi_open_file, 'H:\Total_2009\QB02_09DEC021431274-M1BS-101001000AB62600.ntf', r_fid=fid if (fid eq -1) then begin envi_batch_exit return endif envi_file_query, fid, dims=dims t_fid = [fid,fid] pos = [1,2] exp = '(b1*0.0143847/0.099)/10' out_name = 'H:\Output_TOA\Green\1' envi_doit, 'math_doit', $ fid=t_fid, pos=pos, dims=dims, $ exp=exp, out_name=out_name, $ r_fid=r_fid END I'm trying to figure out how to get rid of the fid = long(2) and have the value that match the other images that worked, but I'm a beginner to IDL and it taking me a very long time. I would very much appreciate some help with this matter, since I have to process 600 or more images! Thanks

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    07 Mar 2012 08:55 AM
    NITF files can often have multiple band segments and may be returning an array of FIDs. Check the returned FID to see if it is an array or scalar. If it is an array, and you want to process all the FIDs in the array, then you will need to loop through them and pass the FID as a scalar. For example: for i=0, n_elements[FID]-1 do begin in_FID = fid[i]
    You are not authorized to post a reply.