X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 04 Aug 2016 05:33 AM by  anon
ERROR: Insufficient keyword directives in BATCH MODE
 3 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
04 Aug 2016 05:33 AM
    Hello, I have a problem, when I try to run a batch proccess I have this error in ENVI ERROR: Insufficient keyword directives I am new programming in IDL, please help me. I am trying to make a batch proccess to Landsat 8 Corrections also I need to now if somebody has FLAASH IDL Code. I use the code that is in the Example, I have IDL 8.5 with ENVI 5.3. I attach my code, TKS ; Add the extension to the toolbox. Called automatically on ENVI startup. pro test2_extensions_init ; Set compile options compile_opt IDL2 ; Get ENVI session e = ENVI(/CURRENT) ; Add the extension to a subfolder e.AddExtension, 'test2', 'test2', PATH='' end ; ENVI Extension code. Called when the toolbox item is chosen. pro test2 ; Set compile options compile_opt IDL2 ; General error handler CATCH, err if (err ne 0) then begin CATCH, /CANCEL if OBJ_VALID(e) then $ e.ReportError, 'ERROR: ' + !error_state.msg MESSAGE, /RESET return endif ;Get ENVI session e = ENVI(/CURRENT) ;****************************************** ; Insert your ENVI Extension code here... ;****************************************** ;Start ENVI in headless mode e = envi(/headless) ;Instantiate the ENVITask, set constant parameters. task = ENVITask('RadiometricCalibration') task.CALIBRATION_TYPE = 'Radiance' ;Find all the files with .dat extensions in a directory. CD = 'C:' search_dir = '../test' filelist = file_search(search_dir + '*.txt') ;Set a base for your output files that will be appended to. outbase = 'C:\Scratch\Reflectance_Cal_' ;Loop over every file. ;Open the raster, set parameters, and execute the task. foreach file, filelist, index do begin raster = e.OpenRaster(file) OLIBands = raster[0] task.input_raster = OLIBands task.output_raster_uri = outbase + strtrim(index, 2) task.Execute endforeach end

    Deleted User



    Basic Member


    Posts:143
    Basic Member


    --
    04 Aug 2016 05:58 PM
    Are you running this program from the IDL workbench? If you are running it from the workbench, could put you put a breakpoint near the top of code then step through it using the "Over" button until you run into this error. From there, could you please let me know which line of code is causing this error?

    Deleted User



    New Member


    Posts:
    New Member


    --
    05 Aug 2016 08:41 AM
    Yes, I am running and put breakpoints, the problem is when beggin foreach foreach file, filelist, index do begin raster = e.OpenRaster(file) OLIBands = raster[0] task.input_raster = OLIBands task.output_raster_uri = outbase + strtrim(index, 2) task.Execute endforeach Then of this appears ERROR. On the other hand I need to know if I can programe and script with FLAASH, I was finding in IDL documentation and dont find any about programming in FLAASH. Please help me. Tks

    Deleted User



    New Member


    Posts:
    New Member


    --
    05 Aug 2016 12:46 PM
    I find the solution, when you define the input variable should consider the folder filelist = file_search('c:\test','*.txt') Please help me answering if ENVI has FLAASH to introduce like an API in IDL Tks ; Add the extension to the toolbox. Called automatically on ENVI startup. pro PRUEBA_extensions_init ; Set compile options compile_opt IDL2 ; Get ENVI session e = ENVI(/CURRENT) ; Add the extension to a subfolder e.AddExtension, 'PRUEBA', 'PRUEBA', PATH='' end ; ENVI Extension code. Called when the toolbox item is chosen. pro PRUEBA ; Set compile options compile_opt IDL2 ; General error handler CATCH, err if (err ne 0) then begin CATCH, /CANCEL if OBJ_VALID(e) then $ e.ReportError, 'ERROR: ' + !error_state.msg MESSAGE, /RESET return endif ;Get ENVI session ;e = ENVI(/CURRENT) ;****************************************** ; Insert your ENVI Extension code here... ;****************************************** e = envi(/headless) ;Instantiate the ENVITask, set constant parameters. task = ENVITask('RadiometricCalibration') task.CALIBRATION_TYPE = 'Radiance' ;Find all the files with .txt extensions in a directory. CD = 'C:' ;search_dir = '../test' filelist = file_search('c:\test','*.txt') PRINT, '# IMAGENES ENCONTRADAS:',N_ELEMENTS(file_search('c:\test','*.txt')) ;Set a base for your output files that will be appended to. outbase = 'C:\test\T' ;Open the raster, set parameters, and execute the task. foreach element, filelist, index do begin raster = e.OpenRaster(element) OLIBands = raster[0] task.input_raster = OLIBands task.output_raster_uri = outbase + strtrim(index, 2) task.Execute endforeach end
    You are not authorized to post a reply.