% % Ed Hill % Fri Dec 12 12:09:00 EST 2003 % Convert ACSII drifter data to netCDF format suitable for Ingrid % NOTE: see Chris Hill to obtain the two necessary (large) binary % data files: % % uVeltave.0000049680.data % vVeltave.0000049680.data % % At the time of writing, they were in: % % eliot.lcs.mit.edu:/export/d06/cnh/latlon_global_1-4 /usr/local/pkg/matlab/matlab-6.5r13/bin/matlab -nojvm matlab -nojvm clear all dz = [ 10.00 10.00 10.00 10.00 10.00 10.00 10.00 10.01 ... 10.03 10.11 10.32 10.80 11.76 13.42 16.04 19.82 24.85 ... 31.10 38.42 46.50 55.00 63.50 71.58 78.90 85.15 90.18 ... 93.96 96.58 98.25 99.25 100.01 101.33 104.56 111.33 122.83 ... 139.09 158.94 180.83 203.55 226.50 249.50 272.50 295.50 318.50 ... 341.50 364.50 387.50 410.50 433.50 456.50 ]; z = zeros(size(dz)); z(1) = dz(1)/2.0; for i=2:length(dz), z(i) = sum(dz(1:(i-1))) + dz(i)/2.0; end load dy.txt dy = dy'; y = zeros(size(dy)); y(1) = dy(1)/2.0; for i=2:length(dy), y(i) = sum(dy(1:(i-1))) + dy(i)/2.0; end % plotu.m fid=fopen('uVeltave.0000049680.data','r','ieee-be'); phi=fread(fid,1088*1440*50,'float32'); fclose(fid); uall=reshape(phi,[1440 1088 50]); % imagesc(phi(:,:,1)); u = uall(:,:,[ 1 11 29 38 ]); clear uall phi % plotv.m fid=fopen('vVeltave.0000049680.data','r','ieee-be'); phi=fread(fid,1088*1440*50,'float32'); fclose(fid); vall=reshape(phi,[1440 1088 50]); v = vall(:,:,[ 1 11 29 38 ]); % imagesc(phi(:,:,1)); clear vall phi x = [ 0:0.25:(360-0.25) ] + (0.25)/2; phimin = -78.6671; y = phimin + y; z = z([ 1 11 29 38 ]); % surf(u(:,:,1)'), shading interp, view(2) % surf(u(:,:,1)'), shading interp, view(2) save dat_needed u v x y z matlab -nojvm clear all load dat_needed idu = 'zonal_velocity'; idv = 'meridional_velocity'; units = 'm/s'; desc = [ 'Simulated velocities (1/4-deg) from Chris Hill.' ]; ncname = [ 'cnh_1-4.nc' ]; nc = netcdf(ncname, 'clobber'); nc.reference = desc; nc.author = 'Ed Hill '; nc.date = 'Dec 12, 2003'; nc('X') = length(x); nc('Y') = length(y); nc('Z') = length(z); nc{'X'} = 'X'; nc{'Y'} = 'Y'; nc{'Z'} = 'Z'; nc{ idu } = { 'Z', 'Y', 'X' }; nc{ idv } = { 'Z', 'Y', 'X' }; nc{'X'}.uniquename = 'X'; nc{'X'}.long_name = 'longitude'; nc{'X'}.gridtype = ncint(1); nc{'X'}.units = 'degree_east'; nc{'Y'}.uniquename = 'Y'; nc{'Y'}.long_name = 'latitude'; nc{'Y'}.gridtype = ncint(0); nc{'Y'}.units = 'degree_north'; nc{'Z'}.uniquename = 'Z'; nc{'Z'}.long_name = 'depth'; nc{'Z'}.gridtype = ncint(0); nc{'Z'}.units = 'm'; nc{ idu }.units = units; nc{ idu }.long_name = idu; nc{ idu }.missing_value = ncdouble(NaN); nc{ idu }.FillValue_ = ncdouble(0.); nc{ idv }.units = units; nc{ idv }.long_name = idv; nc{ idv }.missing_value = ncdouble(NaN); nc{ idv }.FillValue_ = ncdouble(0.); nc{'X'}(:) = x; nc{'Y'}(:) = y; nc{'Z'}(:) = z; p = permute(u,[ 3 2 1 ]); nc{ idu }(:) = p; p = permute(v,[ 3 2 1 ]); nc{ idv }(:) = p; nc = close(nc); ! scp ./cnh_1-4.nc channel.mit.edu:/home/edhill/cnh_1-4 ! gzip cnh_1-4.nc ! scp ./cnh_1-4.nc.gz channel.mit.edu:/home/edhill/cnh_1-4 % AS ROOT ON channel.mit.edu : cd /home/benno/ingrid/data/MIT/LOCAL/PEOPLE/EH3 mkdir cnh_1-4 cd cnh_1-4 ln -s /home/edhill/cnh_1-4/* . % ;;; Local Variables: *** % ;;; mode:matlab *** % ;;; End: ***