X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 18 Aug 2015 05:17 PM by  anon
Batch processing script error
 6 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
18 Aug 2015 05:17 PM
    I am trying to do exactly what is outline below, but to no avail. http://www.exelisvis.com/...ing-an-ENVITask.aspx Here is my code, updated from the example above for use with 5.2: pro batch_radiometric_calib compile_opt idl2 e = envi(/headless) task = ENVITask('RadiometricCalibration') task.CALIBRATION_TYPE = 'top-of-atmosphere reflectance' search_dir = '/users/ben/desktop/image' filelist = file_search(search_dir + '*_mtl.txt') outbase = '/users/ben/desktop/Rad' foreach file, filelist, index do begin raster = e.OpenRaster(file) task.input_raster = raster task.output_raster_uri = outbase + strtrim(index, 2) task.Execute endforeach end It fails at the 'raster = e.OpenRaster(file)' line with an 'unknown dataset' error. Any suggestions would be most appreciated.

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    19 Aug 2015 09:48 AM
    It is not finding the dataset in the directory. If the file resides in this location: search_dir = '/users/ben/desktop/image' Use a forward slash at the end of the path: search_dir = '/users/ben/desktop/image/' Does it find your '_mtl.txt' files if you do this?

    Deleted User



    New Member


    Posts:
    New Member


    --
    19 Aug 2015 10:01 AM
    No, it still gives me the 'unknown dataset' error.

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    19 Aug 2015 11:32 AM
    Does your 'filelist' return a list of files if you do a print on it? Also, be sure to use the appropriate index on your raster since for Landsat, multiple datasets are opened (VNIR, TIR, Pan). task.input_raster = raster[0] I was able to run your code with updated paths and the indexed raster.

    Deleted User



    New Member


    Posts:
    New Member


    --
    19 Aug 2015 08:33 PM
    That was it. Thanks! Though I'm not sure I fully understand why. 0 indicates the multispectral bands? Would I use another number if I wanted to load TIR or pan?

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    20 Aug 2015 06:53 AM
    Great! Yes, I believe ENVI opens the MS dataset first, then TIR, then Pan. So it would be 0 for MS, 1 for TIR and 2 for Pan.

    Deleted User



    New Member


    Posts:
    New Member


    --
    20 Aug 2015 02:46 PM
    Thanks again!
    You are not authorized to post a reply.