X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 11 Jan 2012 05:05 PM by  anon
ENVI_LAYER_STACKING_DOIT_MULTI_FILE.pro
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
11 Jan 2012 05:05 PM
    I am trying to run the IDL script from the ENVI help file: http://www.exelisvis.com/...s-in-batch-mode.aspx I get the following syntax errors. Any suggestions for resolving these are appreciated. for i=1, count-1 do out_fid = out_fid, replicate(in_fid[i], in_nb[i]) % Syntax error. At: D:\time_since_disturbance\data\avhrr_fpar\test\envi_layer_stacking_doit_multi_file.pro, Line 35 for i = 1, count-1 do out_pos = out_pos, lindgen(in_nb[i]) % Syntax error. At: D:\time_since_disturbance\data\avhrr_fpar\test\envi_layer_stacking_doit_multi_file.pro, Line 38 rep_dims = rep_dims, (intarr(in_nb[i]) + 1) # in_dims[*,i] % Syntax error. At: D:\time_since_disturbance\data\avhrr_fpar\test\envi_layer_stacking_doit_multi_file.pro, Line 42 % 3 Compilation error(s) in module ENVI_LAYER_STACKING_DOIT_MULTI_FILE.

    Deleted User



    New Member


    Posts:
    New Member


    --
    12 Jan 2012 10:44 AM
    Hi Joanne, I am afraid that as we've been updating our Help Article system, the process of transferring articles from the old to the new system seems to remove certain square brackets from example code. That seems to be what happened in this case. There should be square brackets around the statement after the DO in each of the lines that caused the compilation errors. The author of that articles is updating it right now, so the code should be correct in the article in about an hour. We're very sorry about that. If you run into any other code in Help Articles that doesn't work, let us know. We're trying to find everything that was broken, but it is not always obvious. Peg

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    12 Jan 2012 11:59 AM
    Give this a try. I need to still work on the Help Article: pro envi_layer_stacking_doit_multi_file compile_opt idl2 ;first restore all the base save files and initialize batch. envi, /restore_base_save_files envi_batch_init, log_file='batch.txt' ;go to directory with several files ;this example stacks a set of .TIF files cd, 'mydir' files = file_search('*.tif', count=count, /fold_case) ;open and gather file information in arrays in_fid=lonarr(count) in_nb=lonarr(count) in_dims=lonarr(5, count) in_dt=lonarr(count) for i=0L, count-1 do begin envi_open_file, files[i], r_fid=r_fid if (r_fid eq -1) then begin envi_batch_exit return endif envi_file_query, r_fid, ns=ns, nl=nl, nb=nb, dims=dims, data_type=dt in_fid[i]=r_fid in_nb[i]=nb in_dims[*,i]=dims in_dt[i]=dt endfor ;set up output fid, pos, and dims arrays out_fid = replicate(in_fid[0], in_nb[0]) for i=1, count-1 do out_fid = [out_fid, replicate(in_fid[i], in_nb[i])] out_pos = lindgen(in_nb[0]) for i = 1, count-1 do out_pos = [out_pos, lindgen(in_nb[i])] rep_dims = (intarr(in_nb[0])+1) # in_dims[*,0] for i = 1, count-1 do $ rep_dims = [rep_dims, (intarr(in_nb[i]) + 1) # in_dims[*,i]] out_dims = transpose(rep_dims) ;set the output projection and pixel size from the first file. ;save the result to disk and use max data type out_proj = envi_get_projection(fid=in_fid[0], pixel_size=out_ps) out_dt = max(in_dt) out_name = 'stacked_layers.dat' ;call the layer stacking routine. Do not set the exclusive keyword allow for an ;inclusive result. Use nearest neighbor for the interpolation method. envi_doit, 'envi_layer_stacking_doit', fid=out_fid, pos=out_pos, dims=out_dims, $ out_dt=out_dt, out_name=out_name, interp=0, out_ps=out_ps, $ out_proj=out_proj, r_fid=r_fid ;exit ENVI envi_batch_exit end
    You are not authorized to post a reply.