“*.h5文件”,用matlab自带函数h5read处理,demo:
clear all;clc;
Source_path = 'F:\Code12\DPR\TC\';
file_path = dir([Source_path,'*.h5']);
for kk =1 %:length(file_path)
fileName = [Source_path,file_path(kk).name];
struct_info = h5info(fileName);
Mode = 'NS';
LAT = h5read(fileName,['/',Mode,'/Latitude']);
LON = h5read(fileName,['/',Mode,'/Longitude']);
Year = num2str(h5read(fileName,['/',Mode,'/ScanTime/Year']));
Mon = num2str(h5read(fileName,['/',Mode,'/ScanTime/Month']),'%02d');
Day = num2str(h5read(fileName,['/',Mode,'/ScanTime/DayOfMonth']),'%02d');
Hour = num2str(h5read(fileName,['/',Mode,'/ScanTime/Hour']),'%02d');
Min = num2str(h5read(fileName,['/',Mode,'/ScanTime/Minute']),'%02d');
Sec = num2str(h5read(fileName,['/',Mode,'/ScanTime/Second']),'%02d');
TimeObs = [Year,Mon,Day,Hour,Min,Sec];
TimeObsNum = datenum(TimeObs(:,:),'yyyymmddHHMMSS');
STH = h5read(fileName,['/',Mode,'/PRE/heightStormTop']);
ZFactorCorrected = h5read(fileName,['/',Mode,'/SLV/zFactorCorrected']);
clear Year Mon Day Hour Min Sec Mode
end
对各仰角扫描结果画图,demo:
s=load('D:\VOL.dat');
r=zeros(1,1933);
t=zeros(1,362);
theta=[0.5,1.5,2.4,3.4,4.3,5.3,6.2,7.5,8.7,10,12,14];
for i=1:12
z=s((i-1)*362+1:362*i,3:1935);
for j=1:1933
r(j)=75*j;
end
clear j;
t=s((i-1)*362+1:362*i,2);
for j=1:362
if (t(j)>180)
t(j)=t(j)-180;
else
t(j)=t(j)+180;
end
t(j)=t(j)*pi/180;
for k=1:1933
if (z(j,k)==-999)
z(j,k)=NaN;
end
end
end
[tt,rr]=meshgrid(t,r);
[x,y]=pol2cart(tt,rr);
figure;
z=z';
colormap(jet);
contour(x,y,z);
colorbar
str=['仰角' num2str(theta(i))];
title(str);
end
具体还要看文件写数据的格式,只提取UVW,demo:
ts_path = filename;
fid = fopen(ts_path);
if fid==-1
error(['Can''t Open File:' ts_path]);
end
ts_data = fgetl(fid);
i = 1;
while ischar(ts_data)
if length(ts_data)>30
if length(ts_data(strfind(ts_data,'"2018')+1:strfind(ts_data,'",')-1))<21
bwp{i,1} = ts_data(strfind(ts_data,'"2018')+1:strfind(ts_data,'",')-1); %time
ts_data(1:strfind(ts_data,'",')+1)=[];
a = ts_data(1:strfind(ts_data,',')-1); %time
ts_data(1:strfind(ts_data,','))=[];
bwp{i,2} = ts_data(1:strfind(ts_data,',')-1); %u
ts_data(1:strfind(ts_data,','))=[];
bwp{i,3} = ts_data(1:strfind(ts_data,',')-1); %v
ts_data(1:strfind(ts_data,','))=[];
bwp{i,2} = ts_data(1:strfind(ts_data,',')-1); %w
ts_data(1:strfind(ts_data,','))=[];
i = i+1;
end
end
ts_data = fgetl(fid);
end
fclose(fid);