1 |
edhill |
1.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 |
|
|
% NOTE: see Chris Hill to obtain the two necessary (large) binary |
8 |
|
|
% data files: |
9 |
|
|
% |
10 |
|
|
% uVeltave.0000049680.data |
11 |
|
|
% vVeltave.0000049680.data |
12 |
|
|
% |
13 |
|
|
% At the time of writing, they were in: |
14 |
|
|
% |
15 |
|
|
% eliot.lcs.mit.edu:/export/d06/cnh/latlon_global_1-4 |
16 |
|
|
|
17 |
|
|
|
18 |
|
|
/usr/local/pkg/matlab/matlab-6.5r13/bin/matlab -nojvm |
19 |
|
|
|
20 |
|
|
matlab -nojvm |
21 |
|
|
clear all |
22 |
|
|
|
23 |
|
|
dz = [ 10.00 10.00 10.00 10.00 10.00 10.00 10.00 10.01 ... |
24 |
|
|
10.03 10.11 10.32 10.80 11.76 13.42 16.04 19.82 24.85 ... |
25 |
|
|
31.10 38.42 46.50 55.00 63.50 71.58 78.90 85.15 90.18 ... |
26 |
|
|
93.96 96.58 98.25 99.25 100.01 101.33 104.56 111.33 122.83 ... |
27 |
|
|
139.09 158.94 180.83 203.55 226.50 249.50 272.50 295.50 318.50 ... |
28 |
|
|
341.50 364.50 387.50 410.50 433.50 456.50 ]; |
29 |
|
|
z = zeros(size(dz)); |
30 |
|
|
z(1) = dz(1)/2.0; |
31 |
|
|
for i=2:length(dz), |
32 |
|
|
z(i) = sum(dz(1:(i-1))) + dz(i)/2.0; |
33 |
|
|
end |
34 |
|
|
load dy.txt |
35 |
|
|
dy = dy'; |
36 |
|
|
y = zeros(size(dy)); |
37 |
|
|
y(1) = dy(1)/2.0; |
38 |
|
|
for i=2:length(dy), |
39 |
|
|
y(i) = sum(dy(1:(i-1))) + dy(i)/2.0; |
40 |
|
|
end |
41 |
|
|
|
42 |
|
|
% plotu.m |
43 |
|
|
fid=fopen('uVeltave.0000049680.data','r','ieee-be'); |
44 |
|
|
phi=fread(fid,1088*1440*50,'float32'); |
45 |
|
|
fclose(fid); |
46 |
|
|
uall=reshape(phi,[1440 1088 50]); |
47 |
|
|
% imagesc(phi(:,:,1)); |
48 |
|
|
u = uall(:,:,[ 1 11 29 38 ]); |
49 |
|
|
clear uall phi |
50 |
|
|
|
51 |
|
|
% plotv.m |
52 |
|
|
fid=fopen('vVeltave.0000049680.data','r','ieee-be'); |
53 |
|
|
phi=fread(fid,1088*1440*50,'float32'); |
54 |
|
|
fclose(fid); |
55 |
|
|
vall=reshape(phi,[1440 1088 50]); |
56 |
|
|
v = vall(:,:,[ 1 11 29 38 ]); |
57 |
|
|
% imagesc(phi(:,:,1)); |
58 |
|
|
clear vall phi |
59 |
|
|
|
60 |
|
|
x = [ 0:0.25:(360-0.25) ] + (0.25)/2; |
61 |
|
|
phimin = -78.6671; |
62 |
|
|
y = phimin + y; |
63 |
|
|
z = z([ 1 11 29 38 ]); |
64 |
|
|
|
65 |
|
|
% surf(u(:,:,1)'), shading interp, view(2) |
66 |
|
|
% surf(u(:,:,1)'), shading interp, view(2) |
67 |
|
|
|
68 |
|
|
save dat_needed u v x y z |
69 |
|
|
|
70 |
|
|
matlab -nojvm |
71 |
|
|
clear all |
72 |
|
|
load dat_needed |
73 |
|
|
|
74 |
|
|
idu = 'zonal_velocity'; |
75 |
|
|
idv = 'meridional_velocity'; |
76 |
|
|
units = 'm/s'; |
77 |
|
|
|
78 |
|
|
desc = [ 'Simulated velocities (1/4-deg) from Chris Hill.' ]; |
79 |
|
|
ncname = [ 'cnh_1-4.nc' ]; |
80 |
|
|
nc = netcdf(ncname, 'clobber'); |
81 |
|
|
nc.reference = desc; |
82 |
|
|
nc.author = 'Ed Hill <eh3@mit.edu>'; |
83 |
|
|
nc.date = 'Dec 12, 2003'; |
84 |
|
|
nc('X') = length(x); |
85 |
|
|
nc('Y') = length(y); |
86 |
|
|
nc('Z') = length(z); |
87 |
|
|
nc{'X'} = 'X'; |
88 |
|
|
nc{'Y'} = 'Y'; |
89 |
|
|
nc{'Z'} = 'Z'; |
90 |
|
|
nc{ idu } = { 'Z', 'Y', 'X' }; |
91 |
|
|
nc{ idv } = { 'Z', 'Y', 'X' }; |
92 |
|
|
nc{'X'}.uniquename = 'X'; |
93 |
|
|
nc{'X'}.long_name = 'longitude'; |
94 |
|
|
nc{'X'}.gridtype = ncint(1); |
95 |
|
|
nc{'X'}.units = 'degree_east'; |
96 |
|
|
nc{'Y'}.uniquename = 'Y'; |
97 |
|
|
nc{'Y'}.long_name = 'latitude'; |
98 |
|
|
nc{'Y'}.gridtype = ncint(0); |
99 |
|
|
nc{'Y'}.units = 'degree_north'; |
100 |
|
|
nc{'Z'}.uniquename = 'Z'; |
101 |
|
|
nc{'Z'}.long_name = 'depth'; |
102 |
|
|
nc{'Z'}.gridtype = ncint(0); |
103 |
|
|
nc{'Z'}.units = 'm'; |
104 |
|
|
nc{ idu }.units = units; |
105 |
|
|
nc{ idu }.long_name = idu; |
106 |
|
|
nc{ idu }.missing_value = ncdouble(NaN); |
107 |
|
|
nc{ idu }.FillValue_ = ncdouble(0.); |
108 |
|
|
nc{ idv }.units = units; |
109 |
|
|
nc{ idv }.long_name = idv; |
110 |
|
|
nc{ idv }.missing_value = ncdouble(NaN); |
111 |
|
|
nc{ idv }.FillValue_ = ncdouble(0.); |
112 |
|
|
nc{'X'}(:) = x; |
113 |
|
|
nc{'Y'}(:) = y; |
114 |
|
|
nc{'Z'}(:) = z; |
115 |
|
|
p = permute(u,[ 3 2 1 ]); |
116 |
|
|
nc{ idu }(:) = p; |
117 |
|
|
p = permute(v,[ 3 2 1 ]); |
118 |
|
|
nc{ idv }(:) = p; |
119 |
|
|
nc = close(nc); |
120 |
|
|
|
121 |
|
|
! scp ./cnh_1-4.nc channel.mit.edu:/home/edhill/cnh_1-4 |
122 |
|
|
|
123 |
|
|
! gzip cnh_1-4.nc |
124 |
|
|
! scp ./cnh_1-4.nc.gz channel.mit.edu:/home/edhill/cnh_1-4 |
125 |
|
|
|
126 |
|
|
% AS ROOT ON channel.mit.edu : |
127 |
|
|
cd /home/benno/ingrid/data/MIT/LOCAL/PEOPLE/EH3 |
128 |
|
|
mkdir cnh_1-4 |
129 |
|
|
cd cnh_1-4 |
130 |
|
|
ln -s /home/edhill/cnh_1-4/* . |
131 |
|
|
|
132 |
|
|
|
133 |
|
|
|
134 |
|
|
% ;;; Local Variables: *** |
135 |
|
|
% ;;; mode:matlab *** |
136 |
|
|
% ;;; End: *** |