function [eventid,jday,moment,hour,min,sec,lat,lon] = readCMT(tmpname)

% function reading earthquake information from Harvard CMT catalog.
% the format of catalog is 
% EventID JDAY MOMENT HOUR MIN SEC LAT LON

fid = fopen(tmpname);
nevent = fscanf(fid,'%d',1);
eventid = zeros(nevent,8);
jday = zeros(nevent,1);
moment = zeros(nevent,1);
hour = zeros(nevent,1);
min = zeros(nevent,1);
sec = zeros(nevent,1);
lat = zeros(nevent,1);
lon = zeros(nevent,1);

for i=1:nevent
    eventid(i,:) = fscanf(fid,'%s',1);
    jday(i) = fscanf(fid,'%d',1);
    moment(i) = fscanf(fid,'%f',1);
    hour(i) = fscanf(fid,'%d',1);
    min(i) = fscanf(fid,'%d',1);
    sec(i) = fscanf(fid,'%f',1);
    lat(i) = fscanf(fid,'%f',1);
    lon(i) = fscanf(fid,'%f',1);
end
