-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplot_bath.m
More file actions
57 lines (40 loc) · 1.1 KB
/
plot_bath.m
File metadata and controls
57 lines (40 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
%This script is used to plot the bathymetry/topgraphic data file, layer##.dat, by COMCOT
%The Script only works for COMCOT version1.7
%Last Revise: Nov21 2008 by Xiaoming Wang
function plot_bath(id)
if id < 10
str_id = ['0',num2str(id)];
end
if id >= 10 & id<100
str_id = num2str(id);
end
% str_id
layer = load(['layer',str_id,'.dat']);
layer_x = load(['layer',str_id,'_x.dat']);
layer_y = load(['layer',str_id,'_y.dat']);
[x,y] = meshgrid(layer_x,layer_y);
nx = length(layer_x);
ny = length(layer_y);
depth = reshape(layer,nx,ny);
clear layer
clear layer_x
clear layer_y
% fid = fopen('ini_surface.dat');
% a = fscanf(fid,'%g',inf); % write all data into a column of matrix a.
% fclose(fid);
% deform = reshape(a,nx,ny);
% zmax = max(max(depth))
zmin = min(min(depth))
zmax = max(max(abs(depth)))
% depth = -depth;
pcolor(x,y,-depth')
shading interp
axis equal
axis tight
caxis([-0.90*zmax 0.90*zmax])
colorbar
xlabel('X Coordinate')
ylabel('Y Coordinate')
hold on
contour(x,y,-depth',[0 0],'k')
print('-dpng', ['Figure_Bathymetry_layer',str_id]);