initial upload
This commit is contained in:
BIN
utils/.DS_Store
vendored
Normal file
BIN
utils/.DS_Store
vendored
Normal file
Binary file not shown.
70
utils/checkerboard/GenerateTrueGam.m
Normal file
70
utils/checkerboard/GenerateTrueGam.m
Normal file
@@ -0,0 +1,70 @@
|
||||
% generate true and initial models for checkerboard test
|
||||
|
||||
depth=[0.0 5.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 55.0 60.0 70.0 80.0 90.0 100.0 120.0];
|
||||
nLat=12;
|
||||
nLon=19;
|
||||
grid=2;
|
||||
anorm=0.06;
|
||||
gam=1.0;
|
||||
|
||||
anormP=(2+anorm)/(2-anorm);
|
||||
anormN=(2-anorm)/(2+anorm);
|
||||
|
||||
% second horizontal interpolation
|
||||
gamTrue= zeros(nLat,nLon,length(depth));
|
||||
for idepth=1:length(depth)
|
||||
gamTrue(:,:,idepth)=gam;
|
||||
end
|
||||
|
||||
perb=zeros(nLat,nLon);
|
||||
[iy,ix]=meshgrid(round([1:nLat]/grid),round([1:nLon]/grid));
|
||||
perb=(-1).^round((ix+iy));
|
||||
|
||||
for i=1:nLon
|
||||
for j=1:nLat
|
||||
if perb(i,j)>0
|
||||
perb(i,j)=anormP;
|
||||
else
|
||||
perb(i,j)=anormN;
|
||||
end
|
||||
end
|
||||
end
|
||||
for idepth=1:length(depth)
|
||||
gamTrue(:,:,idepth)=perb';
|
||||
end
|
||||
|
||||
% output MOD.true.gam
|
||||
MODtrue=fopen('MOD.true.gam','w');
|
||||
|
||||
for iz=1:length(depth)
|
||||
for iy=1:nLon
|
||||
for ix=1:nLat
|
||||
fprintf(MODtrue,'%8.4f',gamTrue(ix,iy,iz));
|
||||
end
|
||||
fprintf(MODtrue,'\n');
|
||||
end
|
||||
end
|
||||
fclose(MODtrue);
|
||||
|
||||
% output MOD.gam
|
||||
MODinit=fopen('MOD.gam','w');
|
||||
|
||||
for i=1:length(depth)
|
||||
fprintf(MODinit,'%6.1f',depth(i));
|
||||
end
|
||||
fprintf(MODinit,'\n');
|
||||
|
||||
for iz=1:length(depth)
|
||||
for iy=1:nLon
|
||||
for ix=1:nLat
|
||||
fprintf(MODinit,'%8.3f',gam);
|
||||
end
|
||||
fprintf(MODinit,'\n');
|
||||
end
|
||||
end
|
||||
fclose(MODinit);
|
||||
|
||||
|
||||
|
||||
|
||||
|
60
utils/checkerboard/GenerateTrueVsv.m
Normal file
60
utils/checkerboard/GenerateTrueVsv.m
Normal file
@@ -0,0 +1,60 @@
|
||||
% generate true Vsv model and initial model for checkerboard test
|
||||
|
||||
depth=[0.0 5.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 55.0 60.0 70.0 80.0 90.0 100.0 120.0];
|
||||
nLat=12;
|
||||
nLon=19;
|
||||
grid=2;
|
||||
anorm=-0.04;
|
||||
|
||||
%vel=4.0;
|
||||
|
||||
% second horizontal interpolation
|
||||
mod1d=load('mod.1d');
|
||||
velTrue= zeros(nLat,nLon,length(depth));
|
||||
for idepth=1:length(depth)
|
||||
velTrue(:,:,idepth)=mod1d(idepth);
|
||||
end
|
||||
|
||||
perb=zeros(nLat,nLon);
|
||||
[iy,ix]=meshgrid(round([1:nLat]/grid),round([1:nLon]/grid));
|
||||
perb=(-1).^round((ix+iy));
|
||||
|
||||
for idepth=1:length(depth)
|
||||
VelTrue(:,:,idepth)=velTrue(:,:,idepth)+perb'*anorm*mod1d(idepth);
|
||||
end
|
||||
|
||||
% output MOD.true.Vsv
|
||||
MODtrue=fopen('MOD.true.Vsv','w');
|
||||
|
||||
for iz=1:length(depth)
|
||||
for iy=1:nLon
|
||||
for ix=1:nLat
|
||||
fprintf(MODtrue,'%8.3f',VelTrue(ix,iy,iz));
|
||||
end
|
||||
fprintf(MODtrue,'\n');
|
||||
end
|
||||
end
|
||||
fclose(MODtrue);
|
||||
|
||||
% output MOD.Vsv
|
||||
MODinit=fopen('MOD.Vsv','w');
|
||||
|
||||
for i=1:length(depth)
|
||||
fprintf(MODinit,'%6.1f',depth(i));
|
||||
end
|
||||
fprintf(MODinit,'\n');
|
||||
|
||||
for iz=1:length(depth)
|
||||
for iy=1:nLon
|
||||
for ix=1:nLat
|
||||
fprintf(MODinit,'%8.3f',mod1d(iz));
|
||||
end
|
||||
fprintf(MODinit,'\n');
|
||||
end
|
||||
end
|
||||
fclose(MODinit);
|
||||
|
||||
|
||||
|
||||
|
||||
|
18
utils/checkerboard/mod.1d
Normal file
18
utils/checkerboard/mod.1d
Normal file
@@ -0,0 +1,18 @@
|
||||
2.393
|
||||
3.367
|
||||
3.412
|
||||
3.411
|
||||
3.398
|
||||
3.397
|
||||
3.416
|
||||
3.452
|
||||
3.505
|
||||
3.581
|
||||
3.689
|
||||
3.827
|
||||
4.019
|
||||
4.389
|
||||
4.456
|
||||
4.470
|
||||
4.475
|
||||
4.482
|
40
utils/init/GenerateIniGam.m
Normal file
40
utils/init/GenerateIniGam.m
Normal file
@@ -0,0 +1,40 @@
|
||||
% generate intial model MOD.gam for DRadiSurfTomo
|
||||
|
||||
depth=[0.0 5.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 55.0 60.0 70.0 80.0 90.0 100.0 120.0];
|
||||
nLat=12;
|
||||
nLon=19;
|
||||
|
||||
% load 1D model
|
||||
xxx=load('mod.1d');
|
||||
mod1d=zeros(1,length(xxx));
|
||||
|
||||
% second horizontal interpolation
|
||||
gam= zeros(nLat,nLon,length(depth));
|
||||
for idepth=1:length(depth)
|
||||
gam(:,:,idepth)=1;
|
||||
end
|
||||
|
||||
% write to MOD.true file
|
||||
MOD=fopen('MOD.gam','w');
|
||||
for i=1:length(depth)
|
||||
fprintf(MOD,'%6.1f',depth(i));
|
||||
end
|
||||
fprintf(MOD,'\n');
|
||||
|
||||
|
||||
for iz=1:length(depth)
|
||||
for iy=1:nLon
|
||||
for ix=1:nLat
|
||||
fprintf(MOD,'%8.4f',gam(ix,iy,iz));
|
||||
end
|
||||
fprintf(MOD,'\n');
|
||||
end
|
||||
end
|
||||
fclose(MOD);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
40
utils/init/GenerateIniVsv.m
Normal file
40
utils/init/GenerateIniVsv.m
Normal file
@@ -0,0 +1,40 @@
|
||||
% generate intial model MOD.gam for DRadiSurfTomo
|
||||
|
||||
depth=[0.0 5.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 55.0 60.0 70.0 80.0 90.0 100.0 120.0];
|
||||
nLat=12;
|
||||
nLon=19;
|
||||
|
||||
% load 1D model
|
||||
xxx=load('mod.1d');
|
||||
mod1d=xxx;
|
||||
|
||||
% second horizontal interpolation
|
||||
vsv= zeros(nLat,nLon,length(depth));
|
||||
for idepth=1:length(depth)
|
||||
vsv(:,:,idepth)=mod1d(idepth);
|
||||
end
|
||||
|
||||
% write to MOD.true file
|
||||
MOD=fopen('MOD.Vsv','w');
|
||||
for i=1:length(depth)
|
||||
fprintf(MOD,'%6.1f',depth(i));
|
||||
end
|
||||
fprintf(MOD,'\n');
|
||||
|
||||
|
||||
for iz=1:length(depth)
|
||||
for iy=1:nLon
|
||||
for ix=1:nLat
|
||||
fprintf(MOD,'%8.4f',vsv(ix,iy,iz));
|
||||
end
|
||||
fprintf(MOD,'\n');
|
||||
end
|
||||
end
|
||||
fclose(MOD);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
18
utils/init/mod.1d
Normal file
18
utils/init/mod.1d
Normal file
@@ -0,0 +1,18 @@
|
||||
2.393
|
||||
3.367
|
||||
3.412
|
||||
3.411
|
||||
3.398
|
||||
3.397
|
||||
3.416
|
||||
3.452
|
||||
3.505
|
||||
3.581
|
||||
3.689
|
||||
3.827
|
||||
4.019
|
||||
4.389
|
||||
4.456
|
||||
4.470
|
||||
4.475
|
||||
4.482
|
2890
utils/plot/DRadiSurfTomo.inMeasure.dat
Normal file
2890
utils/plot/DRadiSurfTomo.inMeasure.dat
Normal file
File diff suppressed because it is too large
Load Diff
2890
utils/plot/DRadiSurfTomo.inMeasure.dat.iter008
Normal file
2890
utils/plot/DRadiSurfTomo.inMeasure.dat.iter008
Normal file
File diff suppressed because it is too large
Load Diff
53
utils/plot/plotgam.m
Normal file
53
utils/plot/plotgam.m
Normal file
@@ -0,0 +1,53 @@
|
||||
%mdlFile='DRadiSurfTomo.inMeasure.dat';
|
||||
mdlFile='DRadiSurfTomo.inMeasure.dat.iter009';
|
||||
plotDep=30; % plot horizantal slice at plotDep (30) km
|
||||
|
||||
dep=[0,5,10,15,20,25,30,35,40,45,50,55,60,70,80,90,100];
|
||||
plotDepIndex=find(dep==plotDep);
|
||||
ndep=length(dep);
|
||||
|
||||
minlat=28.0;
|
||||
maxlat=32.50;
|
||||
dlat=0.5;
|
||||
lat=maxlat:-dlat:minlat;
|
||||
nlat=length(lat);
|
||||
minlon=90.5;
|
||||
maxlon=98.5;
|
||||
dlon=0.5;
|
||||
lon=minlon:dlon:maxlon;
|
||||
nlon=length(lon);
|
||||
|
||||
aa=load(mdlFile);
|
||||
mdl=zeros(nlat,nlon,ndep);
|
||||
|
||||
% read the velocity model
|
||||
i=1;
|
||||
for idep=1:ndep
|
||||
for ilon=1:nlon
|
||||
for ilat=1:nlat
|
||||
mdl(ilat,ilon,idep)=(aa(i,5)-1)/(aa(i,5)+1)*2;
|
||||
i=i+1;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% smooth the velocity model
|
||||
dlat=dlat/5;
|
||||
dlon=dlat/5;
|
||||
imagelat=maxlat:-dlat:minlat;
|
||||
imagelon=minlon:dlon:maxlon;
|
||||
[xin,yin]=meshgrid(lon,lat);
|
||||
[xout,yout]=meshgrid(imagelon,imagelat);
|
||||
image=griddata(xin,yin,squeeze(mdl(:,:,plotDepIndex)),xout,yout,'cubic');
|
||||
|
||||
% plot velocity
|
||||
rd=[(0:31)/31,ones(1,32)];
|
||||
gn=[(0:31)/31,(31:-1:0)/31];
|
||||
bl=[ones(1,32),(31:-1:0)/31];
|
||||
rwb=[rd',gn',bl'];
|
||||
rwb=flipud(rwb);
|
||||
imagesc(imagelon,imagelat,image); colormap(flipud(rwb)); colorbar('location','eastoutside');
|
||||
%imagesc(imagelon,imagelat,image); colormap(flipud(jet)); colorbar('location','eastoutside');
|
||||
hold on;
|
||||
set(gca,'ydir','normal','Fontsize',14,'pos',[0.15 0.3 0.6 0.4]);
|
||||
|
55
utils/plot/plotvsv.m
Normal file
55
utils/plot/plotvsv.m
Normal file
@@ -0,0 +1,55 @@
|
||||
%mdlFile='DRadiSurfTomo.inMeasure.dat';
|
||||
mdlFile='DRadiSurfTomo.inMeasure.dat.iter009';
|
||||
plotDep=30; % plot horizantal slice at plotDep (30) km
|
||||
|
||||
dep=[0,5,10,15,20,25,30,35,40,45,50,55,60,70,80,90,100];
|
||||
plotDepIndex=find(dep==plotDep);
|
||||
ndep=length(dep);
|
||||
|
||||
minlat=28.0;
|
||||
maxlat=32.50;
|
||||
dlat=0.5;
|
||||
lat=maxlat:-dlat:minlat;
|
||||
nlat=length(lat);
|
||||
minlon=90.5;
|
||||
maxlon=98.5;
|
||||
dlon=0.5;
|
||||
lon=minlon:dlon:maxlon;
|
||||
nlon=length(lon);
|
||||
|
||||
aa=load(mdlFile);
|
||||
mdl=zeros(nlat,nlon,ndep);
|
||||
|
||||
% read the velocity model
|
||||
i=1;
|
||||
for idep=1:ndep
|
||||
for ilon=1:nlon
|
||||
for ilat=1:nlat
|
||||
mdl(ilat,ilon,idep)=aa(i,4);
|
||||
i=i+1;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% smooth the velocity model
|
||||
dlat=dlat/5;
|
||||
dlon=dlat/5;
|
||||
imagelat=maxlat:-dlat:minlat;
|
||||
imagelon=minlon:dlon:maxlon;
|
||||
[xin,yin]=meshgrid(lon,lat);
|
||||
[xout,yout]=meshgrid(imagelon,imagelat);
|
||||
image=griddata(xin,yin,squeeze(mdl(:,:,plotDepIndex)),xout,yout,'cubic');
|
||||
|
||||
%{
|
||||
% plot velocity
|
||||
rd=[(0:31)/31,ones(1,32)];
|
||||
gn=[(0:31)/31,(31:-1:0)/31];
|
||||
bl=[ones(1,32),(31:-1:0)/31];
|
||||
rwb=[rd',gn',bl'];
|
||||
rwb=flipud(rwb);
|
||||
%imagesc(imagelon,imagelat,image); colormap(rwb); colorbar('location','eastoutside');
|
||||
%}
|
||||
imagesc(imagelon,imagelat,image); colormap(flipud(jet)); colorbar('location','eastoutside');
|
||||
hold on;
|
||||
set(gca,'ydir','normal','Fontsize',14,'pos',[0.15 0.3 0.6 0.4]);
|
||||
|
Reference in New Issue
Block a user