1 |
% This is a matlab script that generates the input data |
2 |
|
3 |
% $Header: $ |
4 |
% $Name: $ |
5 |
|
6 |
nx=32; ny=nx; nf=6; |
7 |
kwr=1; |
8 |
|
9 |
%- flat bottom bathy with rectangular island on face 2 |
10 |
dp=ones(nx,nf,ny); |
11 |
Htot=1366; |
12 |
dp=-Htot*dp; |
13 |
|
14 |
fc=2; |
15 |
i1=1; i2=nx; j1=ny/4 ; j2=1+3*ny/4; |
16 |
dp(:,fc,j1:j2)=0; |
17 |
dp(nx,1,j1:j2)=0; |
18 |
dp(j1:j2,4,1)=0; |
19 |
|
20 |
if kwr > 0, |
21 |
fid=fopen('bathy_f2.bin','w','b'); |
22 |
fwrite(fid,dp,'real*8'); |
23 |
fclose(fid); |
24 |
end |
25 |
|
26 |
%---------- |
27 |
|
28 |
h=zeros(nx,nf,ny); |
29 |
|
30 |
x=0.25*((0.5:nx)/nx-0.5); |
31 |
[X,Y]=ndgrid(x,x); |
32 |
R=sqrt(X.^2+Y.^2); |
33 |
|
34 |
|
35 |
tileno=1; |
36 |
|
37 |
o=1; |
38 |
i=round(nx*1/2); |
39 |
j=round(ny*1/2); |
40 |
h(i:i+o,tileno,j:j+o)=1; |
41 |
|
42 |
h(:,1,:)=0.5+0.5*cos( pi*min(R,0*R+0.04)/0.04 ); |
43 |
|
44 |
%- 10 m max SSH anomaly: |
45 |
h=h*10; |
46 |
|
47 |
if kwr > 0, |
48 |
fid=fopen('ssh_eq.bin','w','b'); |
49 |
fwrite(fid,h,'real*8'); |
50 |
fclose(fid); |
51 |
end |
52 |
|
53 |
return |
54 |
%---------- |
55 |
% plot to check : ---------- |
56 |
rDir='/home/jmc/grid_cs32/'; |
57 |
G=load_grid(rDir,10); |
58 |
nc=G.dims(2); %nr=G.dims(3); nPxy=G.dims(1)*G.dims(2); nPp2=nPxy+2; |
59 |
ccB=[0 0]; shift=-1; cbV=0; AxBx=[-180 180 -90 90]; kEnv=0; |
60 |
|
61 |
figure(1);clf; |
62 |
var=reshape(dp,[nx*nf ny]); |
63 |
grph_CS(var,G.xC,G.yC,G.xG,G.yG,ccB(1),ccB(2),shift,cbV,AxBx,kEnv); |
64 |
|
65 |
figure(2);clf; |
66 |
var=reshape(h,[nx*nf ny]); |
67 |
grph_CS(var,G.xC,G.yC,G.xG,G.yG,ccB(1),ccB(2),shift,cbV,AxBx,kEnv); |
68 |
|
69 |
%---------- |