Hello,
I'm trying to learn some basic IDL to create scripts for batch processing of a large number of files with ENVI. Unfortunately, I ran into a problem at the very beginning, which I can't seem to solve. I wanted to do something very basic: open a raster file and calculate the data minimums for each band. This is what I have so far:
PRO hello world
compile_opt strictarr
envi, /restore_base_save_files
envi_batch_init, log_file='batch.log&'
; Open the input file
ENVI_OPEN_FILE, 'C:\test\sp5.tif', R_FID = fid
IF (fid EQ -1) THEN BEGIN
ENVI_BATCH_EXIT
RETURN
ENDIF
PRINT, fid ; output from console: 2
envi_file_query, fid, dims=dims
print, dims ; output from console: -1 0 1267 0 3498
pos=[0]
; Calculate the basic statistics
ENVI_DOIT, 'envi_stats_doit', FID = fid, DIMS = dims, pos = pos, DMIN = dmin
print, dmin
envi_batch_exit
END
After the "print, dmin" line, I receive this error:
% PRINT: Variable is undefined: DMIN.
% Execution halted at: TINYROUTINE 30 C:\test\tinyroutine.pro
$MAIN$
Why didn't envi_stats_doit create the variable "dmin", as expected? The raster file was apparently correctly loaded, because "print, dims" shows the correct dimensions of the image.
What can be done to change this?
Thanks for any suggestions! :)
|