initial upload

This commit is contained in:
2025-01-14 12:02:34 +08:00
parent 13ae91dcbe
commit 9677e0bf39
42 changed files with 80356 additions and 1 deletions

BIN
utils/.DS_Store vendored Normal file

Binary file not shown.

View 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);

View 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
View 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

View 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);

View 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
View 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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

53
utils/plot/plotgam.m Normal file
View 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
View 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]);