X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 17 Aug 2009 05:07 PM by  anon
ENVI_OUTPUT_TO_EXTERNAL_FORMAT
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
17 Aug 2009 05:07 PM
    I would like to use ENVI_OUTPUT_TO_EXTERNAL_FORMAT to save some ENVI files into various formats (ESRI GRID and tiff). See below for the code I am using. I keep getting an error on my endfor and end, not sure what I am doing. Thanks pro outputtoexternalfile2 compile_opt strictarr  ENVI, /RESTORE_BASE_SAVE_FILES ;set up path to input and output files input_path = 'E:\test\'     ; search for data files in the specified directory     files = FILE_SEARCH(input_path+'*_NBR', count=count)     IF (count EQ 0) THEN BEGIN   PrintF, 'No files were found to process'  ENDIF ;open file    for i=0, count-1 do begin     ENVI_OPEN_FILE, files[i], r_fid=refl_fid      if (refl_fid eq -1) then begin       envi_batch_exit       return      endif ENVI_FILE_QUERY, refl_fid, ns=ns, nl=nl, nb=nb, data_type=data_type, fname=filename    pos=lindgen(nb)    dims=[-1L,0, ns-1, 0, nl-1] out_name = filename + '_test' ENVI_OUTPUT_TO_EXTERNAL_FORMAT, dims = dims, /TIFF, FID=refl_FID, pos=pos, out_name=out_name $ endfor end

    Deleted User



    New Member


    Posts:
    New Member


    --
    18 Aug 2009 03:57 PM
    The problem is a syntax issue in the following line: out_name=out_name $ If you remove the '$' things should work out. One other suggestion is that you could shorten the following line:     IF (count EQ 0) THEN BEGIN   PrintF, 'No files were found to process'  ENDIF to the following which helps keep the code somewhat cleaner:  IF (count EQ 0) THEN Print, 'No files were found to process' Hope this helps out.  

    Deleted User



    New Member


    Posts:
    New Member


    --
    18 Aug 2009 04:12 PM
    thank you!!
    You are not authorized to post a reply.