/[MITgcm]/MITgcm_contrib/netcdf_matlab_examples/TRENBERTH_tau_mask/EH3_notes_mask.txt
ViewVC logotype

Contents of /MITgcm_contrib/netcdf_matlab_examples/TRENBERTH_tau_mask/EH3_notes_mask.txt

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


Revision 1.1 - (show annotations) (download)
Tue Dec 30 04:33:12 2003 UTC (20 years, 4 months ago) by edhill
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/plain
 o initial check-in

1 #
2 # Ed Hill
3 # Thu Dec 18 13:51:19 EST 2003
4
5 # Mask out wind forcing curl data over land (so only the sea data is
6 # left) using the WORLDBATH elevation data from Ingrid.
7
8 # URLs:
9
10 # http://iridl.ldeo.columbia.edu/expert/SOURCES/.TRENBERTH/.Annual/.taux
11 # http://iridl.ldeo.columbia.edu/expert/SOURCES/.TRENBERTH/.Annual/.taux
12
13 # http://ingrid.mit.edu/SOURCES/.WORLDBATH/.bath/
14
15
16 matlab -nojvm
17 clear all
18
19 ncload('TRENBERTH_taux.cdf')
20 ncload('TRENBERTH_tauy.cdf')
21 cx = mod(X+360.0,360.0);
22 cy = Y;
23 origX = X;
24 origY = Y;
25
26 ncload('WORLDBATH_data.cdf')
27 bx = X;
28 by = Y;
29 clear X Y
30
31 mask = zeros(size(taux));
32 nx = size(taux,2);
33 ny = size(taux,1);
34 ib = zeros(1,nx);
35 jb = zeros(1,ny);
36 for i = 1:nx,
37 ib(i) = round(mean([ max(find(bx < cx(i))) min(find(bx > cx(i))) ]));
38 end
39 for j = 1:ny,
40 jb(j) = round(mean([ max(find(by < cy(j))) min(find(by > cy(j))) ]));
41 end
42
43 b_tau = zeros(size(taux));
44 for j = 1:ny,
45 b_tau(j,:) = bath(jb(j),ib);
46 end
47 b_mask = double(b_tau < -50.0);
48
49 surf(b_mask), view(2), shading interp
50
51 m_taux = taux .* b_mask;
52 m_tauy = tauy .* b_mask;
53
54 idu = 'tau_x';
55 idv = 'tau_y';
56 units = 'newtons/m2';
57
58 desc = [ 'TRENBERTH tau data with a zero-mask over land.' ];
59 ncname = [ 'TRENBERTH_tau_masked.nc' ];
60 nc = netcdf(ncname, 'clobber');
61 nc.reference = desc;
62 nc.author = 'Ed Hill <eh3@mit.edu>';
63 nc.date = 'Dec 12, 2003';
64 nc('lon') = length(cx);
65 nc('lat') = length(cy);
66 nc{'lon'} = 'lon';
67 nc{'lat'} = 'lat';
68 nc{ idu } = { 'lat', 'lon' };
69 nc{ idv } = { 'lat', 'lon' };
70 nc{'lon'}.uniquename = 'lon';
71 nc{'lon'}.long_name = 'longitude';
72 nc{'lon'}.gridtype = ncint(1);
73 nc{'lat'}.uniquename = 'lat';
74 nc{'lat'}.long_name = 'latitude';
75 nc{'lat'}.gridtype = ncint(0);
76 nc{'lon'}.units = 'degree_east';
77 nc{'lat'}.units = 'degree_north';
78 nc{ idu }.units = units;
79 nc{ idu }.long_name = idu;
80 nc{ idu }.missing_value = ncdouble(NaN);
81 nc{ idu }.FillValue_ = ncdouble(-9999.);
82 nc{ idv }.units = units;
83 nc{ idv }.long_name = idv;
84 nc{ idv }.missing_value = ncdouble(NaN);
85 nc{ idv }.FillValue_ = ncdouble(-9999.);
86 nc{'lon'}(:) = origX;
87 nc{'lat'}(:) = origY;
88 nc{ idu }(:) = m_taux;
89 nc{ idv }(:) = m_tauy;
90 nc = close(nc);
91
92 scp TRENBERTH_tau_masked.nc channel.mit.edu:/home/edhill/TRENBERTH_tau_masked/
93
94 # AS ROOT ON channel.mit.edu :
95 cd /home/benno/ingrid/data/MIT/LOCAL/PEOPLE/EH3
96 mkdir TRENBERTH_tau_masked
97 cd TRENBERTH_tau_masked
98 ln -s /home/edhill/TRENBERTH_tau_masked/*
99
100 % OK, *THIS* (below) is the correct format for Ingrid
101
102 desc = [ 'TRENBERTH tau data with a zero-mask over land.' ];
103 ncname = [ 'TRENBERTH_tau_masked_XY.nc' ];
104 nc = netcdf(ncname, 'clobber');
105 nc.reference = desc;
106 nc.author = 'Ed Hill <eh3@mit.edu>';
107 nc.date = 'Dec 12, 2003';
108 nc('X') = length(cx);
109 nc('Y') = length(cy);
110 nc{'X'} = 'X';
111 nc{'Y'} = 'Y';
112 nc{ idu } = { 'Y', 'X' };
113 nc{ idv } = { 'Y', 'X' };
114 nc{'X'}.uniquename = 'X';
115 nc{'X'}.long_name = 'longitude';
116 nc{'X'}.gridtype = ncint(1);
117 nc{'Y'}.uniquename = 'Y';
118 nc{'Y'}.long_name = 'latitude';
119 nc{'Y'}.gridtype = ncint(0);
120 nc{'X'}.units = 'degree_east';
121 nc{'Y'}.units = 'degree_north';
122 nc{ idu }.units = units;
123 nc{ idu }.long_name = idu;
124 nc{ idu }.missing_value = ncdouble(NaN);
125 nc{ idu }.FillValue_ = ncdouble(-9999.);
126 nc{ idv }.units = units;
127 nc{ idv }.long_name = idv;
128 nc{ idv }.missing_value = ncdouble(NaN);
129 nc{ idv }.FillValue_ = ncdouble(-9999.);
130 nc{'X'}(:) = origX;
131 nc{'Y'}(:) = origY;
132 nc{ idu }(:) = m_taux;
133 nc{ idv }(:) = m_tauy;
134 nc = close(nc);
135
136
137 !scp TRENBERTH_tau_masked_XY.nc channel.mit.edu:/home/edhill/TRENBERTH_tau_masked/
138
139
140 % Mask out (zero) a region for the Pacific basin
141 matlab -nojvm
142 clear all
143
144 ncload('TRENBERTH_curl_all.cdf')
145 cx = mod(X+360.0,360.0);
146 cy = Y;
147 origX = X;
148 origY = Y;
149
150 ncload('WORLDBATH_data.cdf')
151 bx = X;
152 by = Y;
153 clear X Y
154
155 mask = zeros(size(ratio));
156 nx = size(ratio,2);
157 ny = size(ratio,1);
158 ib = zeros(1,nx);
159 jb = zeros(1,ny);
160 for i = 1:nx,
161 ib(i) = round(mean([ max(find(bx < cx(i))) min(find(bx > cx(i))) ]));
162 end
163 for j = 1:ny,
164 jb(j) = round(mean([ max(find(by < cy(j))) min(find(by > cy(j))) ]));
165 end
166
167 b_tau = zeros(size(ratio));
168 for j = 1:ny,
169 b_tau(j,:) = bath(jb(j),ib);
170 end
171 b_mask = double(b_tau < -50.0);
172
173 surf(b_mask), view(2), shading interp
174
175 pacm = b_mask;
176 surf(pacm), view(2), shading interp
177 pacm(:,46:63) = 0.0;
178 pacm(64:72,1:50) = 0.0;
179 pacm(43:70,35:50) = 0.0;
180 pacm(40:70,40:50) = 0.0;
181 surf(pacm), view(2), shading interp
182
183 curlmasked = ratio .* pacm;
184
185 id = 'curl'
186 desc = [ 'TRENBERTH curl data with a zero-mask for Pacific Basin integration.' ];
187 ncname = [ 'TRENBERTH_curl_masked.nc' ];
188 nc = netcdf(ncname, 'clobber');
189 nc.reference = desc;
190 nc.author = 'Ed Hill <eh3@mit.edu>';
191 nc.date = 'Dec 12, 2003';
192 nc('X') = length(cx);
193 nc('Y') = length(cy);
194 nc{'X'} = 'X';
195 nc{'Y'} = 'Y';
196 nc{ id } = { 'Y', 'X' };
197 nc{'X'}.uniquename = 'X';
198 nc{'X'}.long_name = 'longitude';
199 nc{'X'}.gridtype = ncint(1);
200 nc{'Y'}.uniquename = 'Y';
201 nc{'Y'}.long_name = 'latitude';
202 nc{'Y'}.gridtype = ncint(0);
203 nc{'X'}.units = 'degree_east';
204 nc{'Y'}.units = 'degree_north';
205 nc{ id }.units = 'kilogram meter-2 second-2';
206 nc{ id }.long_name = id;
207 nc{ id }.missing_value = ncdouble(NaN);
208 nc{ id }.FillValue_ = ncdouble(-9999.);
209 nc{'X'}(:) = origX;
210 nc{'Y'}(:) = origY;
211 nc{ id }(:) = curlmasked;
212 nc = close(nc);
213
214 !scp TRENBERTH_curl_masked.nc channel.mit.edu:/home/edhill/TRENBERTH_tau_masked/

  ViewVC Help
Powered by ViewVC 1.1.22