hi,i am experimenting problems writing a code to georeference HDF5 DATA.
the r_fid of function ENVI_GLT_DOIT is always wrong with -1 value, which means the GLT build is failed.
hdf5 data[FY3B_MWRID_GBAL_L1_20110201_0124_010KM_MS.zip] can be downloaded from
http://pan.baidu.com/s/1pJyrGU3
Some one experimented this problem? I attach the code in the bottom..
and thanks for your help!
Lillte Jing
pro sample_glt_georef
compile_opt strictarr
; Restore the core file and start ENVI in batch
ENVI,/RESTORE_BASE_SAVE_FILES,/NO_STATUS_WINDOW
ENVI_BATCH_INIT
; create input projection
i_proj=ENVI_PROJ_CREATE(/geographic, datum="WGS-84")
; create output projection
;o_proj=ENVI_PROJ_CREATE(/UTM, zone=24, datum="WGS-84")
fname ='FY3B_MWRID_GBAL_L1_20101201_0053_010KM_MS.HDF'
outname='out.tif'
gltname='glt'
file_id1 = H5F_OPEN(fname)
x_fid = H5D_OPEN(file_id1, 'Longitude')
envi_file_query, x_fid, dims=dims
; Open up the dataspace associated with the Eskimo image.
dataspace_id= H5D_GET_SPACE(x_fid)
; Retrieve the dimensions so we can set the window size.
dimension= H5S_GET_SIMPLE_EXTENT_DIMS(dataspace_id)
ENVI_FILE_QUERY, x_fid, ns=ns, nl=nl, nb=nb
file_id2 = H5F_OPEN(fname)
y_fid = H5D_OPEN(file_id2, 'Latitude')
file_id3 = H5F_OPEN(fname)
tb_fid = H5D_OPEN(file_id3, 'EARTH_OBSERVE_BT_10_to_89GHz')
dim=[-1L,0,dimension[0]-1,0,dimension[1]-1]
bandsnum=10
pos=lindgen(bandsnum)
;ENVI_GLT_DOIT
ENVI_DOIT, 'ENVI_GLT_DOIT', DIMS=dim,I_PROJ= i_proj, O_PROJ=i_proj, out_name = gltname, $
R_FID=glt_fid, rotation=0, X_FID=x_fid, X_POS=0, Y_FID=y_fid, Y_POS=0
ENVI_FILE_QUERY, glt_fid, dims=glt_dims
; ENVI_GEOREF_FROM_GLT_DOIT
ENVI_DOIT, 'ENVI_GEOREF_FROM_GLT_DOIT', BACKGROUND=0, FID=tb_fid,GLT_DIMS=glt_dims, pos=pos, GLT_FID=glt_fid,$
out_name=outname, r_fid=out_fid
;
; print a 'finished' message to the command log
; Exit ENVI
ENVI_BATCH_EXIT
end