pro read_icesat2_hdf5
infilepath='E:\icesat2\5000001293407\'
outfilepath=''
cd,infilepath
thesefiles = file_search('*',count = numFiles)
print,'number of files found:',numFiles
FOR fidx=0,numFiles-1 DO BEGIN
cd,infilepath+thesefiles[fidx]
filename=file_search('*.h5',count = numFiles,/TEST_REGULAR)
basename=file_basename(filename,'.HDF')
;H5F_OPEN打开hdf5
file_id = H5F_OPEN(filename)
;H5G_OPEN打开group
groupname=['gt1l','gt1l','gt2l','gt2r','gt3l','gt3r']
temp=[0,0,0];
for groupn=0,6-1 do begin
group_id=H5G_OPEN(file_id,groupname[groupn])
;H5D_OPEN打开数据集
dataset_id=H5G_OPEN(group_id,"freeboard_beam_segment")
;H5D_READ读取数据集数据,存入SdsData中
; SdsData=H5D_READ(dataset_id)
weishu=size(data,/N_ELEMENTS)
;读取属性数据
;H5A_OPEN_Name按照属性名字打开属性
Attribute_id= H5D_OPEN(dataset_id,'beam_fb_height')
;读取属性
data=H5D_READ(Attribute_id)
;H5A_OPEN_Name按照属性名字打开属性
Attribute_id= H5D_OPEN(dataset_id,'latitude')
;读取属性
lat=H5D_READ(Attribute_id)
;H5A_OPEN_Name按照属性名字打开属性
Attribute_id= H5D_OPEN(dataset_id,'longitude')
;读取属性
lon=H5D_READ(Attribute_id)
index=where(data le 3.4,count)
if count gt 0 then begin
; data[index]=0.0/0.0
data=data[index]
lat=lat[index]
lon=lon[index]
endif
print,max(data,/NAN)
zz=Transpose([[data],[lat],[lon]])
temp=[[zz],[temp]]
; print,temp[*,0:-1]
endfor
WRITE_CSV,'E:\icesat2\process\'+basename+'.csv',temp[*,0:-2]
ENDFOR
end
IDL 读取ICESAT2 HDF5文件
最新推荐文章于 2022-12-29 20:45:42 发布