- 积分
- 0
- 注册时间
- 2013-10-16
- 仿真币
-
- 最后登录
- 1970-1-1
|
本帖最后由 lhm901112 于 2014-2-27 19:28 编辑
在把计算数据贴到地图上时遇到的奇怪问题,循环显示多幅图像,但奇怪的是第一幅数据不能显示,后面的都可以正常显示,求大神指点迷津,程序附后(小菜鸟写的请多了解哈
- listing = dir('I:\new_data\Insar\Ascending\*.dat');
- path = cd;
- for p = 1:2
- filename = listing(p).name;
- U_x = dlmread(filename);
- file = strcat(filename(1:end-3),'N1');
- file = strcat(path,'\',file);
- fid = fopen(file,'r','b');
-
- fseek(fid,5314,'bof');
- a = fscanf(fid,'%c',10);
- number = str2num(a);
- %length
- fseek(fid,5335,'bof');
- a=fscanf(fid,'%c',10);
- length=str2num(a);
- length=(length-17)/4;
- fseek(fid,4546+133,'bof');
- a=fscanf(fid,'%c',21);
- offset=str2num(a);
-
- sample_num=zeros(12,11);
- lats=zeros(12,11);
- lons=zeros(12,11);
- line_num=zeros(12,1);
-
- for j=1:11
- fseek(fid,offset+(j-1)*521+13,'bof');
- line_num(j)=fread(fid,1,'uint32');
- fseek(fid,8,'cof');
- sample_num(j,:)=fread(fid,11,'uint32');
- fseek(fid,88,'cof');
- lats(j,:)=fread(fid,11,'int32')/1e6;
- lons(j,:)=fread(fid,11,'int32')/1e6;
- end
-
- fseek(fid,521+34,'cof');
- line_num(12)=number;
- sample_num(12,:)=fread(fid,11,'uint32');
- fseek(fid,88,'cof');
- lats(12,:)=fread(fid,11,'int32')/1e6;
- lons(12,:)=fread(fid,11,'int32')/1e6;
-
- x=sample_num;y=repmat(line_num,1,11);
- xi=repmat(1:length,number,1);
- yi=repmat((1:number)',1,length);
- lat=interp2(x,y,lats,xi,yi);
- lon=interp2(x,y,lons,xi,yi);
- clear xi & yi;
-
- lat=downsample(lat,floor(number/length)^2);lat=downsample(lat',floor(number/length));lat=lat';
- lon=downsample(lon,floor(number/length)^2);lon=downsample(lon',floor(number/length));lon=lon';
-
-
- % pass title
- fseek(fid,1946,'bof');
- a=fscanf(fid,'%c',10);
- ind=strcmp(a,'DESCENDING');
- if ind
- lat=fliplr(lat);
- lon=fliplr(lon);
- %U_x=fliplr(U_x);
- else
- lat=flipud(lat);
- lon=flipud(lon);
- %U_x=flipud(U_x);
- end
-
- figure;
- clf;
- hold on
- m_proj('UTM','lon',[min(min(lon))-0.2 max(max(lon))+0.2],'lat',[min(min(lat))-0.2 max(max(lat))+0.2]);
- m_grid('xlabeldir','middle','fontsize',10,'tickdir','in','box','fancy','ylabeldir','middle');
- h=m_pcolor(lon,lat,U_x);
- m_gshhs_f('patch',[.7 .7 .7]);
- set(h,'edgecolor','none')
- caxis([-1.0 1.0])
-
- h=colorbar('v');
- set(get(h,'title'),'string','m/s','fontsize',10);
- set(h,'pos',[0.8570 0.1560 0.02 0.7440])
-
- % clearvars -except p listing
-
- end
复制代码 |
|