%用于从ISC给出的地震目录中读取时间的经纬度、深度和震级
c='mrwan_earthquake_catalogue_140228.txt';
cmap=jet(64); %产生调色板
mindep=0; %所显示的最小深度
maxdep=720; %所显示的最大深度
Max_Min=maxdep-mindep; %最小深度与最大深度的差
fp=fopen(c,'r'); %打开目录文件
worldmap([-90,90],[0,360]); %绘制世界范围地图
load coast; %加载海岸线的数据
plotm(lat,long,'k') %将海岸线的数据用黑线画出
%将目录文件中的解释语句略过
for ii=1:2
sr=fgets(fp);
end
NumEQ=0;
while 1
sr=fgets(fp); %读取文件一行数据
file_state=feof(fp);
if (file_state==1)|(sr(1:4)=='STOP'),break,end
NumEQ=NumEQ+1;
Elat=str2num(sr(1:2));Elon=str2num(sr(4:5));Edep=str2num(sr(9:10));Emag=str2num(sr(6:9));
Ind=fix((Edep-mindep)/Max_Min*64);%找到此深度对应的调色板序号
%fixs()是取整函数
if(Ind<1) Ind=1; end
plotm(Elat,Elon,'.','MarkerSize',5,'Color',cmap(Ind,:)) %用调色板序号用点绘制地震
end
fclose(fp); %关闭文件
colorbar('location','southoutside','XTick',linspace(0,1,10),'Xticklabel',num2str([linspace(mindep,maxdep,10)]')); %加上色标
s=sprintf('所用地震数目:%f',NumEQ)
??? Error using ==> set
Color value must be a 3 element numeric vector.
Error in ==> linem at 148
if ~isempty(varargin); set(hndl0,varargin{:}); end
Error in ==> plotm at 64
[hndl0,msg] = linem(lat,lon,varargin{:});
(外行请不要水经验,谢谢合作)
EVENTID,AUTHOR ,DATE ,TIME ,LAT ,LON ,DEPTH,DEPFIX,AUTHOR ,TYPE ,MAG
14540499,EHB ,2007-12-01,02:41:14.07,36.5450, 70.9520,190.0,TRUE ,ISC ,mb , 4.1,
STOP
Please consider the ISC mirror server hosted atIRIS DMC as it may be faster.
International Seismological Centre
Pipers Lane, Thatcham, Berkshire
United Kingdom RG19 4NS
+44 (0)1635 861022, voice; +44 (0)1635 872351,fax
adminisc.ac.uk, e-mail
白板的微信
茅侃侃