X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 04 Sep 2013 09:20 AM by  anon
Problems with "envi_stats_doit"
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
04 Sep 2013 09:20 AM
    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! :)

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    04 Sep 2013 11:21 AM
    Hello The Hound! It looks like you are missing the COMP_FLAG keyword which tells ENVI_STATS_DOIT which stats to calculate. You can set it equal to 1 for basic stats. There is an example in the help using COMP_FLAG=3 to get histograms along with the basic stats.

    Deleted User



    New Member


    Posts:
    New Member


    --
    05 Sep 2013 01:16 AM
    After adding this keyword, everything works as expected. Thanks! :)
    You are not authorized to post a reply.