/[MITgcm]/MITgcm_contrib/high_res_cube/matlab/mk_input.m
ViewVC logotype

Annotation of /MITgcm_contrib/high_res_cube/matlab/mk_input.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Thu Aug 10 22:31:44 2006 UTC (18 years, 11 months ago) by dimitri
Branch: MAIN
CVS Tags: HEAD
Added files used to generate bathymetry and Levitus input files for cs510
integrations.

1 dimitri 1.1 % bathymetry
2     clear all, close all
3     nx=510;
4     LATC=readbin('LATC.bin',[nx 6 nx],1,'real*8');
5     LONC=readbin('LONC.bin',[nx 6 nx],1,'real*8');
6     ix=find(LONC<0); LONC(ix)=LONC(ix)+360;
7     load tbase12
8     BATH=LATC;
9     for i=1:nx, mydisp(i)
10     for j=1:nx
11     for k=1:6
12     BATH(i,k,j)=map(closest(LATC(i,k,j),lat),closest(LONC(i,k,j),lon));
13     end
14     end
15     end
16     writebin('BATHY_510x6x510.bin',BATH,1)
17     clear BATH map
18    
19     fix_bathy
20    
21    
22     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24    
25    
26     % levitus_01 January temperature and salinity
27     % input files are from nemo:/data2/odap/levitus_01
28     clear all, close all
29     grid; DPT=dpt; nx=510;
30     LATC=readbin('LATC.bin',[nx 6 nx],1,'real*8');
31     LONC=readbin('LONC.bin',[nx 6 nx],1,'real*8');
32     ix=find(LONC<0); LONC(ix)=LONC(ix)+360;
33     lon=.5:359.5; lat=-89.5:89.5;
34     dpt=[0 10 20 30 50 75 100 125 150 200 250 300 400 500 ...
35     600 700 800 900 1000 1100 1200 1300 1400 1500 ...
36     1750 2000 2500 3000 3500 4000 4500 5000 5500];
37     t=readbin('temp01',[360 180 33],1);
38     s=readbin('sal01',[360 180 33],1);
39     in=find(t<-50);
40    
41     % convert to potential
42     [Y X]=meshgrid(lat,lon);
43     for k=1:33
44     p=pressure(dpt(k),Y);
45     t(:,:,k)=insitutemp(s(:,:,k),t(:,:,k),p);
46     end
47     t(in)=nan; s(in)=nan;
48    
49     % fill-in nans
50     for k=1:33, mydisp(k)
51     t(:,:,k)=xpolate(t(:,:,k));
52     s(:,:,k)=xpolate(s(:,:,k));
53     end
54     save LEV01_JAN_TS lat lon dpt t s
55    
56    
57    
58     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
60    
61     % monthly Levitus salinity climatology
62     clear all, close all
63     pn='/host/nemo/data2/odap/levitus_01/SALINITY/sal';
64     lon=.5:359.5; lat=-89.5:89.5;
65     dpt=[0 10 20 30 50 75 100 125 150 200 250 300 400 500 ...
66     600 700 800 900 1000 1100 1200 1300 1400 1500 ...
67     1750 2000 2500 3000 3500 4000 4500 5000 5500];
68     nx=length(lon); ny=length(lat); nz=length(dpt);
69     salt=zeros(nx,ny,12);
70     for m=1:12
71     s=readbin([pn myint2str(m)],[nx ny nz]);
72     tmp=(s(:,:,1)+s(:,:,2))/2;
73     tmp(find(tmp<0))=nan;
74     salt(:,:,m)=xpolate(tmp);
75     mypcolor(lon,lat,salt(:,:,m)'); colorbar; pause(.01)
76     end
77     writebin('LEV01_SSS_360x180x12.bin',salt)
78    
79    
80     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
81     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82    
83     % interpolate to cube sphere
84     clear all, close all
85     grid; DPT=dpt; nx=510;
86     LATC=readbin('LATC.bin',[nx 6 nx],1,'real*8');
87     LONC=readbin('LONC.bin',[nx 6 nx],1,'real*8');
88     ix=find(LONC<0); LONC(ix)=LONC(ix)+360;
89     load LEV01_JAN_TS
90     t2=zeros(362,182,34);
91     t2(2:361,2:181,1:33)=t; t2(:,:,34) =t2(:,:,33);
92     t2(1,:,:)=t2(361,:,:); t2(362,:,:)=t2(2,:,:);
93     t2(:,1,:)=t2(:,2,:); t2(:,182,:)=t2(:,181,:);
94     s2=zeros(362,182,34);
95     s2(2:361,2:181,1:33)=s; s2(:,:,34) =s2(:,:,33);
96     s2(1,:,:)=s2(361,:,:); s2(362,:,:)=s2(2,:,:);
97     s2(:,1,:)=s2(:,2,:); s2(:,182,:)=s2(:,181,:);
98     lon2=-.5:360.5; lat2=-90.5:90.5; dpt=[dpt max(DPT)];
99     [Y X]=meshgrid(lat2,lon2);
100     LEVT=zeros(nx,6,nx,50); LEVS=LEVT;
101     for k=1:50
102     ix=closest(DPT(k),dpt,0);
103     tmp=(t2(:,:,ix(1))*abs(DPT(k)-dpt(ix(2)))+...
104     t2(:,:,ix(2))*abs(DPT(k)-dpt(ix(1))))/...
105     abs(dpt(ix(2))-dpt(ix(1)));
106     LEVT(:,:,:,k)=interp2(Y,X,tmp,LATC,LONC);
107     tmp=(s2(:,:,ix(1))*abs(DPT(k)-dpt(ix(2)))+...
108     s2(:,:,ix(2))*abs(DPT(k)-dpt(ix(1))))/...
109     abs(dpt(ix(2))-dpt(ix(1)));
110     LEVS(:,:,:,k)=interp2(Y,X,tmp,LATC,LONC);
111     end
112     writebin('LEVT01_JAN_510x6x510.bin',LEVT,1)
113     writebin('LEVS01_JAN_510x6x510.bin',LEVS,1)
114    
115    
116     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
117     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
118    
119     % convert to proper format for model input
120     clear all, close all
121     tx=85;ty=85;nt=216;cx=510;cy=510;
122    
123     te=readbin('BATHY_510x6x510_filled.bin',[510 6 510],1);
124     te=permute(te,[1 3 2]);
125     nz=1; anti_foo
126     writebin('BATHY_18360x85_filled.bin',phi,1)
127    
128     te=readbin('LEVT01_JAN_510x6x510.bin',[510 6 510 50],1);
129     te=permute(te,[1 3 2 4]);
130     nz=50; anti_foo
131     writebin('LEVT01_JAN_18360x85x50.bin',phi,1)
132    
133     te=readbin('LEVS01_JAN_510x6x510.bin',[510 6 510 50],1);
134     te=permute(te,[1 3 2 4]);
135     nz=50; anti_foo
136     writebin('LEVS01_JAN_18360x85x50.bin',phi,1)
137    
138    
139    
140     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
141     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
142    
143     % convert to proper format for model input
144     clear all, close all
145     tx=85;ty=85;nt=216;cx=510;cy=510;
146    
147     te=readbin('BATHY_510x6x510_filled.bin',[510 6 510],1);
148     te=permute(te,[1 3 2]);
149     nz=1; anti_foo
150     writebin('BATHY_18360x85_filled.bin',phi,1)
151    
152     te=readbin('LEVT01_JAN_510x6x510.bin',[510 6 510 50],1);
153     te=permute(te,[1 3 2 4]);
154     nz=50; anti_foo
155     writebin('LEVT01_JAN_18360x85x50.bin',phi,1)
156    
157     te=readbin('LEVS01_JAN_510x6x510.bin',[510 6 510 50],1);
158     te=permute(te,[1 3 2 4]);
159     nz=50; anti_foo
160     writebin('LEVS01_JAN_18360x85x50.bin',phi,1)
161    
162    
163     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
164     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
165    
166     % convert to proper format for model input
167     clear all, close all
168     tx=51;ty=510;nt=60;cx=510;cy=510;
169    
170     te=readbin('BATHY_510x6x510_filled.bin',[510 6 510],1);
171     te=permute(te,[1 3 2]);
172     nz=1; anti_foo
173     writebin('BATHY_3060x510_filled.bin',phi,1)
174    
175     te=readbin('LEVT01_JAN_510x6x510.bin',[510 6 510 50],1);
176     te=permute(te,[1 3 2 4]);
177     nz=50; anti_foo
178     writebin('LEVT01_JAN_3060x510x50.bin',phi,1)
179    
180     te=readbin('LEVS01_JAN_510x6x510.bin',[510 6 510 50],1);
181     te=permute(te,[1 3 2 4]);
182     nz=50; anti_foo
183     writebin('LEVS01_JAN_3060x510x50.bin',phi,1)

  ViewVC Help
Powered by ViewVC 1.1.22