/[MITgcm]/MITgcm_contrib/netcdf_matlab_examples/maximenko_drifter/EH3_notes_maximenko.txt
ViewVC logotype

Contents of /MITgcm_contrib/netcdf_matlab_examples/maximenko_drifter/EH3_notes_maximenko.txt

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


Revision 1.1 - (show annotations) (download)
Tue Dec 30 05:10:00 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 % Fri Dec 12 12:09:00 EST 2003
4
5 % Convert ACSII drifter data to netCDF format suitable for Ingrid
6
7
8 cat ForJohnMarshall.dat | awk '{print $1}' | sort -n | uniq > xval
9 cat ForJohnMarshall.dat | awk '{print $2}' | sort -n | uniq > yval
10
11 matlab -nojvm
12 clear all
13
14 load ForJohnMarshall.dat
15 dat = ForJohnMarshall; clear ForJohnMarshall
16
17 xmin = min(dat(:,1));
18 xmax = max(dat(:,1));
19 x = [ xmin:0.25:xmax ];
20 ymin = min(dat(:,2));
21 ymax = max(dat(:,2));
22 y = [ ymin:0.25:ymax ];
23
24 u = NaN * ones(length(x),length(y));
25 v = NaN * ones(length(x),length(y));
26
27 n = size(dat,1);
28 k = 1;
29 for k = 1:n,
30 i = (dat(k,1) - xmin)/0.25 + 1;
31 j = (dat(k,2) - ymin)/0.25 + 1;
32 u(i,j) = dat(k,3);
33 v(i,j) = dat(k,4);
34 end
35
36 idu = 'zonal_velocity';
37 idv = 'meridional_velocity';
38 units = 'cm/s';
39
40 surf(u'), shading interp, view(2), title(idu)
41 pause(3)
42 surf(v'), shading interp, view(2), title(idv)
43 pause(3)
44
45 desc = [ 'Drifter data from Nikolai Maximenko' ];
46
47 ncname = [ 'maximenko_drifter.nc' ];
48 nc = netcdf(ncname, 'clobber');
49 nc.reference = desc;
50 nc.author = 'Ed Hill <eh3@mit.edu>';
51 nc.date = 'Dec 12, 2003';
52 nc('X') = length(x);
53 nc('Y') = length(y);
54 nc{'X'} = 'X';
55 nc{'Y'} = 'Y';
56 nc{ idu } = { 'Y', 'X' };
57 nc{ idv } = { 'Y', 'X' };
58 nc{'X'}.uniquename = 'X';
59 nc{'X'}.long_name = 'longitude';
60 nc{'X'}.gridtype = ncint(1);
61 nc{'Y'}.uniquename = 'Y';
62 nc{'Y'}.long_name = 'latitude';
63 nc{'Y'}.gridtype = ncint(0);
64 nc{'X'}.units = 'degree_east';
65 nc{'Y'}.units = 'degree_north';
66 nc{ idu }.units = units;
67 nc{ idu }.long_name = idu;
68 nc{ idu }.missing_value = ncdouble(NaN);
69 nc{ idu }.FillValue_ = ncdouble(0.);
70 nc{ idv }.units = units;
71 nc{ idv }.long_name = idv;
72 nc{ idv }.missing_value = ncdouble(NaN);
73 nc{ idv }.FillValue_ = ncdouble(0.);
74 nc{'X'}(:) = x;
75 nc{'Y'}(:) = y;
76 nc{ idu }(:) = u';
77 nc{ idv }(:) = v';
78 nc = close(nc);
79
80
81 uu = u;
82 ind = find(isnan(uu));
83 uu(ind) = 0.0;
84 vv = v;
85 ind = find(isnan(vv));
86 vv(ind) = 0.0;
87
88 desc = [ 'Drifter data from Nikolai Maximenko' ];
89 ncname = [ 'maximenko_zeros.nc' ];
90 nc = netcdf(ncname, 'clobber');
91 nc.reference = desc;
92 nc.author = 'Ed Hill <eh3@mit.edu>';
93 nc.date = 'Dec 12, 2003';
94 nc('X') = length(x);
95 nc('Y') = length(y);
96 nc{'X'} = 'X';
97 nc{'Y'} = 'Y';
98 nc{ idu } = { 'Y', 'X' };
99 nc{ idv } = { 'Y', 'X' };
100 nc{'X'}.uniquename = 'X';
101 nc{'X'}.long_name = 'longitude';
102 nc{'X'}.gridtype = ncint(1);
103 nc{'Y'}.uniquename = 'Y';
104 nc{'Y'}.long_name = 'latitude';
105 nc{'Y'}.gridtype = ncint(0);
106 nc{'X'}.units = 'degree_east';
107 nc{'Y'}.units = 'degree_north';
108 nc{ idu }.units = units;
109 nc{ idu }.long_name = idu;
110 nc{ idu }.missing_value = ncdouble(NaN);
111 nc{ idu }.FillValue_ = ncdouble(-9999.);
112 nc{ idv }.units = units;
113 nc{ idv }.long_name = idv;
114 nc{ idv }.missing_value = ncdouble(NaN);
115 nc{ idv }.FillValue_ = ncdouble(-9999.);
116 nc{'X'}(:) = x;
117 nc{'Y'}(:) = y;
118 nc{ idu }(:) = uu';
119 nc{ idv }(:) = vv';
120 nc = close(nc);
121
122
123
124 ncdump maximenko_drifter.nc | more
125 ncdump maximenko_zeros.nc | more
126
127 scp maximenko_drifter.nc channel.mit.edu:/home/edhill/maximenko_drifter/
128 scp maximenko_zeros.nc channel.mit.edu:/home/edhill/maximenko_drifter/
129
130 % AS ROOT ON channel.mit.edu :
131 cd /home/benno/ingrid/data/MIT/LOCAL/PEOPLE/EH3
132 mkdir maximenko_drifter
133 cd maximenko_drifter
134 ln -s /home/edhill/maximenko_drifter/* .
135
136
137 % Re-work with additional data
138
139 ! wget http://iprc.soest.hawaii.edu/~nikolai/ForJohnMarshall_1.dat.gz
140 ! gunzip ForJohnMarshall_1.dat.gz
141
142 matlab -nojvm
143 clear all
144
145 load ForJohnMarshall_1.dat
146 dat = ForJohnMarshall_1; clear ForJohnMarshall_1
147
148 xmin = min(dat(:,1));
149 xmax = max(dat(:,1));
150 x = [ xmin:0.25:xmax ];
151 ymin = min(dat(:,2));
152 ymax = max(dat(:,2));
153 y = [ ymin:0.25:ymax ];
154
155 u = NaN * ones(length(x),length(y));
156 v = NaN * ones(length(x),length(y));
157 uu = NaN * ones(length(x),length(y));
158 vv = NaN * ones(length(x),length(y));
159
160 n = size(dat,1);
161 k = 1;
162 for k = 1:n,
163 i = (dat(k,1) - xmin)/0.25 + 1;
164 j = (dat(k,2) - ymin)/0.25 + 1;
165 u(i,j) = dat(k,3);
166 v(i,j) = dat(k,4);
167 uu(i,j) = dat(k,6);
168 vv(i,j) = dat(k,7);
169 end
170
171 idu = 'zonal_velocity';
172 idv = 'meridional_velocity';
173 units = 'cm/s';
174 iduu = 'uu';
175 idvv = 'vv';
176 unitseke = 'cm^2/s^2';
177
178 surf(u'), shading interp, view(2), title(idu)
179 pause(3)
180 surf(v'), shading interp, view(2), title(idv)
181 pause(3)
182 surf(uu'), shading interp, view(2), title(iduu)
183 pause(3)
184 surf(vv'), shading interp, view(2), title(idvv)
185 pause(3)
186
187 desc = [ 'Drifter data from Nikolai Maximenko' ];
188
189 ncname = [ 'maximenko_drifter.nc' ];
190 nc = netcdf(ncname, 'clobber');
191 nc.reference = desc;
192 nc.author = 'Ed Hill <eh3@mit.edu>';
193 nc.date = 'Dec 12, 2003';
194 nc('X') = length(x);
195 nc('Y') = length(y);
196 nc{'X'} = 'X';
197 nc{'Y'} = 'Y';
198 nc{ idu } = { 'Y', 'X' };
199 nc{ idv } = { 'Y', 'X' };
200 nc{ iduu } = { 'Y', 'X' };
201 nc{ idvv } = { 'Y', 'X' };
202 nc{'X'}.uniquename = 'X';
203 nc{'X'}.long_name = 'longitude';
204 nc{'X'}.gridtype = ncint(1);
205 nc{'Y'}.uniquename = 'Y';
206 nc{'Y'}.long_name = 'latitude';
207 nc{'Y'}.gridtype = ncint(0);
208 nc{'X'}.units = 'degree_east';
209 nc{'Y'}.units = 'degree_north';
210 nc{ idu }.units = units;
211 nc{ idu }.long_name = idu;
212 nc{ idu }.missing_value = ncdouble(NaN);
213 nc{ idu }.FillValue_ = ncdouble(0.);
214 nc{ idv }.units = units;
215 nc{ idv }.long_name = idv;
216 nc{ idv }.missing_value = ncdouble(NaN);
217 nc{ idv }.FillValue_ = ncdouble(0.);
218 nc{ iduu }.units = unitseke;
219 nc{ iduu }.long_name = iduu;
220 nc{ iduu }.missing_value = ncdouble(NaN);
221 nc{ iduu }.FillValue_ = ncdouble(0.);
222 nc{ idvv }.units = unitseke;
223 nc{ idvv }.long_name = idvv;
224 nc{ idvv }.missing_value = ncdouble(NaN);
225 nc{ idvv }.FillValue_ = ncdouble(0.);
226 nc{'X'}(:) = x;
227 nc{'Y'}(:) = y;
228 nc{ idu }(:) = u';
229 nc{ idv }(:) = v';
230 nc{ iduu }(:) = uu';
231 nc{ idvv }(:) = vv';
232 nc = close(nc);
233
234 ! scp maximenko_drifter.nc channel.mit.edu:/home/edhill/maximenko_drifter/
235
236 % ;;; Local Variables: ***
237 % ;;; mode:matlab ***
238 % ;;; End: ***

  ViewVC Help
Powered by ViewVC 1.1.22