1.数据下载
(1) 数据下载网址:https://nsidc.org/data/data-access-tool/ATL08/versions/5
(2) 需要注册账号下载。
(3) 可以导入shp范围。
2.MATLAB程序
(1) 代码根据官方代码改写
%%%%%%%%%%%%%%%%%
% ICELat2激光测高数据批量提取
%%%%%%%%%%%%%%%%%
%输入文件目录,目录里存放着*.H5文件。
input_path = 'I:\\originalFile\\国土遥感应用中心\\数据\\GLAS1-2激光测高数据-肇东地区\\GLAS2';
out_name='123_1.txt';
h5_path=[input_path '\\*.h5'];
List =dir(h5_path);
datacount=length(List);
%%%输出头信息
fid = fopen(out_name,'wt');
fprintf(fid,'%s,%s,%s,%s\n','name','B','L','H');
index=0;
Allpoints=0;
for i=1:datacount
FILE_NAME =[ List(i).folder '\\' List(i).name];
file_id = H5F.open (FILE_NAME, 'H5F_ACC_RDONLY', 'H5P_DEFAULT');
% Open the datasets.
LATFIELD_NAME='gt1l/land_segments/latitude';
lat_id=H5D.open(file_id, LATFIELD_NAME);
LONFIELD_NAME='gt1l/land_segments/longitude';
lon_id=H5D.open(file_id, LONFIELD_NAME);
DATAFIELD_NAME='gt1l/land_segments/dem_h';
data_id=H5D.open(file_id, DATAFIELD_NAME);
% Read the datasets.
lat=H5D.read(lat_id,'H5T_NATIVE_DOUBLE', 'H5S_ALL', 'H5S_ALL',...
'H5P_DEFAULT');
lon=H5D.read(lon_id,'H5T_NATIVE_DOUBLE', 'H5S_ALL', 'H5S_ALL', ...
'H5P_DEFAULT');
data=H5D.read(data_id,'H5T_NATIVE_DOUBLE', 'H5S_ALL', 'H5S_ALL', ...
'H5P_DEFAULT');
jiguang_count=length(data);
for j=1:jiguang_count
fprintf(fid,'%d,%.6f,%.6f,%.6f\n',index,lat(j),lon(j),data(j));
index=index+1;
end
Allpoints=Allpoints+ jiguang_count;
H5D.close (data_id);
H5D.close (lon_id);
H5D.close (lat_id);
H5F.close (file_id);
str=['提取进度:' num2str(i) '/' num2str(datacount) ' 激光点数:' num2str(jiguang_count) ]
end
str=['总激光点数:' num2str(Allpoints)]
fclose(fid);
(2)结果: