ENVI_OUTPUT_TO_EXTERNAL_FORMAT [message #48717] |
Tue, 16 May 2006 15:27 |
DMac
Messages: 6 Registered: May 2006
|
Junior Member |
|
|
I wrote a batch script to convert ENVI formatted images to ERDAS
Images. It works fine but it outputs the data as integer instead of
floating point. The ENVI input files are floating point. Below is the
script:
pro BATCH_img_LR
compile_opt idl2
input_path = 'D:\Temp\ENVIHEADER\'
output_path = 'D:\Temp\ENVIHEADER\'
; initiate batch mode with a batch log file
;
ENVI, /restore_base_save_files
ENVI_BATCH_INIT, BATCH_LUN=batch_unit, $
LOG_FILE=output_path+'LR_batch_log.txt'
ENVI_BATCH_STATUS_WINDOW, /off
;
PrintF, batch_unit, 'beginning boulder batch process ' + $
systime()
;use FILE_SEARCH to make a string array with the names
; of the input files
;
files = FILE_SEARCH(input_path+'*.HDR', count=count)
; if no files were found then return
;
IF (count EQ 0) THEN BEGIN
PrintF, batch_unit, 'No Files were found to process!'
PrintF, batch_unit, systime()
ENVI_Batch_EXIT
return
ENDIF
; start a FOR loop to process each ENVI file found
;
FOR i=0, count-1 DO BEGIN
;print a message to the batch log file
;
InFileName = STRMID(files[i], 0, 25)
OutFileName = output_path + STRMID(files[i], 19,5) + ".img"
printF, batch_unit, OutFileName
PrintF, batch_Unit, 'processing file ' + files[i] + $
' ' + systime()
; Convert ENVI files to ERDAS Imagine format
;
PrintF, batch_unit, files[i]
ENVI_OPEN_FILE, InFileName, r_fid = fid
ENVI_FILE_QUERY, fid, ns=ns, nl=nl, nb=nb
dims = [-1, 0, ns-1, 0, nl-1]
pos=lindgen(nb)
ENVI_OUTPUT_TO_EXTERNAL_FORMAT, dims = dims, /ERDAS, FID=FID,
pos=pos, OUT_NAME=OutFileName
ENDFOR
;print a 'finished' message to the batch log
;
PrintF, batch_unit, 'finished batch process '+systime()
ENVI_BATCH_EXIT
end
Any Ideas what I might be doing wrong?
Thanks in advance
|
|
|