I found why this error message happened, but the problem was not yet solved.
I changed the arrays in the pos, .
pos=[[0,1],[0,1],[0,1],[0,1]] ; before
pos=[[0,-1],[0,-1],[0,-1],[0,-1]] ; after.
However, the output image bands were still all black. I may have problems in arrays in the pos...
In envi help, pos was explained...
-----
Use this keyword to specify an array of long integers representing band positions to include in the mosaic. The dimensions of the array must be [#output bands, #files]. A value of -1 indicates that no input band for the associated file is included in the corresponding mosaicked output band. The valid values for POS are 0 to num_bands (for the corresponding file), or -1.
-----
However, this description is not straightforward to me.
In my case, I have four files with a band in each of them. The size of these files are identical.
In the description, "pos must be [#output bands, #files]"
Then... why not "pos [1.4]" ? When I tried these numbers, I got this error message.
-----
ENVI Retrieve Data: An error has occurred during processing.
Error: "Attempt to subscript
with is out of range." The result may be invaild.
-----
Please give me any suggestions for appropriate values in pos array.
[QUOTE]kim4ecohydro wrote
Hello, All!
I am trying to mosaicking 4 MODIS tiles into one. I tried to use 'mosaic_doit' function.
I followed the guidelines, but I got stuck in this error message.
-----
ENVI Retrieve Data: An error has occurred during processing.
Error: "Attempt to subscript
with is out of range." The result may be invaild.
I have no idea what this means. Is there anyone to help me? Please give me any comments or suggestions.
This is what I have done so far. Basic idea of this souce code was from...
----------------------
pro Mosaic_062511
; Path designation
input_path = 'I:\MODIS\HDF\2008\MOD13\Mosaic\MOD13A2\'
output_path = 'I:\MODIS\HDF\2008\MOD13\Mosaic\MOD13Mosaic\'
for h = 0, 0 do begin
date = 16 * h + 1
print,'Processing MODIS images of DOY', date
dir=input_path
cd,dir
files=FILE_SEARCH('MOD13A2.A2008'+strtrim(string(date, format='(I03)'), 2)+'.h*.hdf', count=num_inputfiles)
print, ' files = ' , files
;MODIS grid file
;format='MOD13A2.A2008001.h27v04.005.2008019050117.hdf'
;START IMPORTING MODISTILES
for i=0,num_inputfiles-1 do begin
grid_file=files[i]
print, 'grid_file = ', grid_file
;output_rootname = 'Landinputs_'+strtrim((strmid(grid_file,9,7)+'_'+strmid(grid_file,17,6)),2)+'_'
output_rootname = 'MOD13A2_'+strtrim((strmid(grid_file,9,7)+'_'+strmid(grid_file,17,6)),2)
year=strmid(grid_file,9,4)
grid_name = 'MODIS_Grid_16DAY_1km_VI'
sd_names = ['1 km 16 days NDVI']
out_method = 0
convert_modis_data, in_file=grid_file, out_path=output_path, out_root=output_rootname, $
/higher_product, /grid, gd_name=grid_name, sd_names=sd_names, out_method=out_method,background=255;, fill_replace_value=255
print, 'output_rootname = ', output_rootname
endfor
cd,output_path
inputs = file_search('MOD13A2_2008'+strtrim(string(date,format='(I03)'), 2)+'*.img', count=inputfiles)
print,'inputfiles', inputfiles
fids=lindgen(inputfiles)
for i=0, inputfiles-1 do begin
envi_open_file,inputs[i],r_fid=afile
fids[i]=afile
endfor
numfiles=n_elements(fids)
if numfiles eq 4 then begin
;*******START MOSAIC
pos=[[0,1],[0,1],[0,1],[0,1]]
out_ps = [926.6254331, 926.6254331]
use_see_through = [[1L],[1],[1],[1]]
see_through_val = [[0L],[0],[0],[0]]
;bandnames=['1 km 16 days NDVI']
out_name='Mosaic_MOD13_'+strtrim(string(date,format='(I03)'), 2)+'.img'
print, 'output_name = ' , out_name
georef_mosaic_setup, fid=fids, out_ps=out_ps, dims=dims, xsize=xsize, ysize=ysize, x0=x0, y0=y0, map_info=map_info
envi_doit,'mosaic_doit',fid=fids,pos=pos,dims=dims,x0=x0,y0=y0,background=0,out_dt=2,map_info=map_info,/georef, $
xsize=xsize, ysize=ysize, pixel_size=out_ps, see_through_val=see_through_val, use_see_through=use_see_through, out_name=out_name, r_fid=mosaic
;******REMOVE FIDS AND DELETE INPUTS
for i=0,numfiles-1 do begin
envi_file_mng, id=fids[i],/remove; ,/delete
endfor
endif
print, "C'est fini!! It's done!!!"
endfor
end
------
Reference for source code:
http://www.rhinocerus.net...unning-abruptly.html
[/QUOTE]