I would like to create a file image from panchromatic image with the new image = the panchromatic *0.05678345 in IDL. However, the result has error: % Unable to allocate memory: to make array. Not enough space % Execution halted at: Q_RAD_SIXSIN_GEN_P_221936 35 This is my code:
PRO q_rad_sixsin_gen_p_221936
ENVI, /RESTORE_BASE_SAVE_FILES
ENVI_BATCH_INIT, LOG_FILE='batch.txt'
input_dir = 'D:\BA34\Panchromatic\BA34_pan_221936_10oct25'
input_dir_name_lenght=STRLEN(input_dir)
imagelist=FILE_SEARCH('D:\BA34\Panchromatic\BA34_pan_221936_10oct25\*.tif',COUNT=count)
;imagelistt=FILE_SEARCH('D:\quickbird\test.tif', COUNT=count)
;envi_open_file, imagelistt, r_fid=tfid,NO_REALIZE=1
;map_info=envi_get_map_info(fid=tfid)
COMPILE_OPT IDL2
FORWARD_FUNCTION ENVI_GET_DATA, ENVI_GET_MAP_INFO
FOR h=0, count-1 Do Begin
path_filename=imagelist[h]
K_pan= 0.05678345
Pan_Width= 0.2846000
envi_open_file, imagelist[h], r_fid=fid,NO_REALIZE=1
ENVI_FILE_QUERY,fid,DIMS=dims,NS=ns,NL=nl,sname=sname
map_info=envi_get_map_info(fid=fid)
filenamelength=STRLEN(sname)
outname=STRMID(sname,0,filenamelength-4)
dims=[-1L, 0, ns-1, 0, nl-1]
pan = ENVI_GET_DATA(FID=fid,dims=dims,pos=0)
br=fltarr(ns,1,nl)
br = (pan *(K_pan)/(Pan_Width))*0.1
envi_write_envi_file, br, map_info=map_info, out_name=outname+'_rad.dat', r_fid=fid, interleave=1
envi_file_mng, id=fid, /remove
ENDFOR
END
Thanks so much for your help to correct the code.
Lien