1 |
% |
---|
2 |
% Load data from files and set data arrays |
---|
3 |
% |
---|
4 |
ls *.rvt |
---|
5 |
nfiles=input('Enter the number of .rvt files: '); |
---|
6 |
lead=input('Enter leading character string for your .rvt files: ','s'); |
---|
7 |
for i=1:nfiles |
---|
8 |
filename=[lead,num2str(i),'.rvt'] |
---|
9 |
load(filename); |
---|
10 |
rvt=eval(blank(filename(1:length(filename)-4))); |
---|
11 |
x(:,i)=rvt(:,2); |
---|
12 |
y(:,i)=rvt(:,3); |
---|
13 |
rho(:,i)=rvt(:,4); |
---|
14 |
u(:,i)=rvt(:,5); |
---|
15 |
v(:,i)=rvt(:,6); |
---|
16 |
w(:,i)=rvt(:,7); |
---|
17 |
enz(:,i)=rvt(:,8); |
---|
18 |
T(:,i)=rvt(:,9); |
---|
19 |
S(:,i)=rvt(:,10); |
---|
20 |
end |
---|
21 |
% |
---|
22 |
% Create mesh and create boundary |
---|
23 |
% |
---|
24 |
nnv=21; |
---|
25 |
size(x); |
---|
26 |
nn=ans(1); |
---|
27 |
nseg=nn/nnv-1; |
---|
28 |
femgen |
---|
29 |
bnd=detbndy(in); |
---|
30 |
xmin=min(x(:,1)); |
---|
31 |
xmax=max(x(:,1)); |
---|
32 |
ymin=min(y(:,1)); |
---|
33 |
ymax=max(y(:,1)); |
---|
34 |
% |
---|
35 |
% Set contour levels |
---|
36 |
% |
---|
37 |
newcont='y'; |
---|
38 |
while newcont == 'y', |
---|
39 |
scalarc=input('Enter variable you desire to contour (rho,u,v,w,enz,T,S): ','s'); |
---|
40 |
scalar=eval(scalarc); |
---|
41 |
scalarmin=min(min(scalar)) |
---|
42 |
scalarmax=max(max(scalar)) |
---|
43 |
cint=input('Enter the contour interval: '); |
---|
44 |
cmin=cint*ceil(scalarmin/cint); |
---|
45 |
cmax=cint*floor(scalarmax/cint); |
---|
46 |
clear cval |
---|
47 |
i=1 |
---|
48 |
cval(i)=cmin; |
---|
49 |
while cval(i) < cmax |
---|
50 |
i=i+1; |
---|
51 |
cval(i)=cval(i-1)+cint; |
---|
52 |
end |
---|
53 |
cval |
---|
54 |
% |
---|
55 |
% Make subplots |
---|
56 |
% |
---|
57 |
figure |
---|
58 |
whitebg('w') |
---|
59 |
for i=1:nfiles |
---|
60 |
subplot(nfiles/2,2,i) |
---|
61 |
hold on |
---|
62 |
bndo=plotbnd(x,y,bnd); |
---|
63 |
set(bndo,'Color','k') |
---|
64 |
axis([xmin xmax ymin ymax]) |
---|
65 |
axis('off') |
---|
66 |
hc=lcontour2(in,x(:,i),y(:,i),scalar(:,i),cval); |
---|
67 |
filename=[lead,num2str(i),'.rvt'] |
---|
68 |
title(filename) |
---|
69 |
end |
---|
70 |
% |
---|
71 |
% Plot min, max, avg data values |
---|
72 |
% |
---|
73 |
clear sstat |
---|
74 |
for i=1:nn |
---|
75 |
sstat(1,i)=min(scalar(i,:)); |
---|
76 |
sstat(2,i)=max(scalar(i,:)); |
---|
77 |
sstat(3,i)=mean(scalar(i,:)); |
---|
78 |
sstat(4,i)=sstat(2,i)-sstat(1,i); |
---|
79 |
end |
---|
80 |
sstat=sstat'; |
---|
81 |
figure |
---|
82 |
whitebg('w') |
---|
83 |
for i=1:3 |
---|
84 |
subplot(3,1,i) |
---|
85 |
hold on |
---|
86 |
bndo=plotbnd(x,y,bnd); |
---|
87 |
set(bndo,'Color','k') |
---|
88 |
axis([xmin xmax ymin ymax]) |
---|
89 |
axis('off') |
---|
90 |
hc=lcontour2(in,x(:,1),y(:,1),sstat(:,i),cval); |
---|
91 |
if i == 1 |
---|
92 |
string=[lead,' tidal time maximum ',scalarc]; |
---|
93 |
elseif i == 2 |
---|
94 |
string=[lead,' tidal time minimum ',scalarc]; |
---|
95 |
else |
---|
96 |
string=[lead,' tidal time average ',scalarc]; |
---|
97 |
end |
---|
98 |
title(string) |
---|
99 |
end |
---|
100 |
% |
---|
101 |
% Plot range of values |
---|
102 |
% |
---|
103 |
scalar=sstat(:,4); |
---|
104 |
% |
---|
105 |
scalarmin=min(min(scalar)) |
---|
106 |
scalarmax=max(max(scalar)) |
---|
107 |
scalar10=(scalarmax-scalarmin)/10. |
---|
108 |
cint=input('Enter the contour interval: '); |
---|
109 |
cmin=cint*ceil(scalarmin/cint); |
---|
110 |
cmax=cint*floor(scalarmax/cint); |
---|
111 |
clear cval |
---|
112 |
i=1 |
---|
113 |
cval(i)=cmin; |
---|
114 |
while cval(i) < cmax |
---|
115 |
i=i+1; |
---|
116 |
cval(i)=cval(i-1)+cint; |
---|
117 |
end |
---|
118 |
cval |
---|
119 |
% |
---|
120 |
figure |
---|
121 |
whitebg('w') |
---|
122 |
bndo=plotbnd(x,y,bnd); |
---|
123 |
set(bndo,'Color','k') |
---|
124 |
axis([xmin xmax ymin ymax]) |
---|
125 |
axis('off') |
---|
126 |
[cs,h]=lcontour3(in,x,y,scalar,cval); |
---|
127 |
hlabel=extclabel(cs); |
---|
128 |
bndo=plotbnd(x,y,bnd); |
---|
129 |
set(bndo,'Color','k') |
---|
130 |
axis([xmin xmax ymin ymax]) |
---|
131 |
axis('off') |
---|
132 |
% hc=lcontour2(in,x(:,1),y(:,1),sstat(:,4),cval); |
---|
133 |
filename=[lead,num2str(i),'.rvt'] |
---|
134 |
title([lead,' tidal time ',scalarc,' variations']) |
---|
135 |
% |
---|
136 |
% Make another plot? |
---|
137 |
% |
---|
138 |
newcont=input('Contour new variable? (y/n): ','s'); |
---|
139 |
end |
---|