| I get the following error 
ENVI Error [Fri Apr 24 15:46:20 2009] : 
An error has occurred during processing 
Error: "STRLOWCASE: Variable is undefined: PROC_NAME." 
The result may be invalid. 
From the following code (errors out on stretch_doit) run from IDL 
PRO DEFAULTSTRETCHSAVE
  ;Striclty enforce new square brackets syntax for dereferencing variables
  COMPILE_OPT STRICTARR
  ; Restore the ENVI core files
ENVI, /RESTORE_BASE_SAVE_FILES
; Initialize ENVI and send all errors to an error file.
ENVI_BATCH_INIT, LOG_FILE = 'c:\Cumb_SPOT5\batch.log'
  
  newdir='C:\Cumb_SPOT5' 
  ;newdir ='E:\Norah\cumberland peninsula 2007\spot5 2p5m pan'
  ;;--- get a string array of all files with html extension
  files=file_search(COUNT=nfiles,newdir,'*.tif')
  j=0
  
  FOR j=0,nfiles-1 DO BEGIN
    ;;--- for each file get the file name, dir name and make new file name  
   
    fullfilename=files[j]
    dirname= file_dirname(fullfilename)
    filename= file_basename(fullfilename)
    newdirname=dirname + '\MikeStretch'
    newfilename='ep_' + filename
    newfullfilename= newdirname + '\' + newfilename
    ;;--- open file
    ENVI_OPEN_DATA_FILE, fullfilename, /TIF, r_fid=fid 
    IF (fid EQ -1) THEN BEGIN
      ENVI_BATCH_EXIT
      RETURN
    ENDIF
    ENVI_FILE_QUERY, fid, DIMS=dims, NB=nb
    pos = LINDGEN(nb)
    ;Stretch Image using ENVI 2% linear stretch default and write output to new file
    ENVI_DOIT,’stretch_doit’, DIMS=dims, FID=fid, I_MAX=98.0, I_MIN=2.0, POS=pos, $METHOD=1, R_FID=r_fid, OUT_MIN=0, OUT_MAX=255, RANGE_BY=0, OUT_DT=1, OUT_NAME="test"
    ;, IN_MEMORY=0, OUT_NAME=newfullfilename
        ;;--- close the files
    ENVI_FILE_MNG, ID=fid, /REMOVE
    ;ENVI_FILE_MNG, ID=r_fid, /REMOVE
    
    ;;---For future, measure the range of values in the histogram and if          
    ;;---max >2* min then save file to a folder to be examined
  ENDFOR
  ;exit envi and batch mode
  ENVI_BATCH_EXIT
END
Any + all comments / suggestions welcome TX! |