/[MITgcm]/MITgcm_contrib/eh3/llc/ecco-godae/climatology/gen_bathy.m
ViewVC logotype

Diff of /MITgcm_contrib/eh3/llc/ecco-godae/climatology/gen_bathy.m

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

revision 1.1 by edhill, Tue Aug 22 04:40:00 2006 UTC revision 1.2 by edhill, Wed Aug 23 21:07:50 2006 UTC
# Line 106  k = 3; Line 106  k = 3;
106  for k = 1:5  for k = 1:5
107    disp(sprintf('  k = %d',k));    disp(sprintf('  k = %d',k));
108    ginfo(k).b_oce = ginfo(k).bathy;    ginfo(k).b_oce = ginfo(k).bathy;
109    ginfo(k).b_oce(find(ginfo(k).b_oce >= 0.0)) = NaN;    %  ginfo(k).b_oce(find(ginfo(k).b_oce >= 0.0)) = NaN;
110    %  if k == 2, hold on, end    ginfo(k).b_oce(find(ginfo(k).b_oce >= 0.0)) = 1000;
111    figure(k)    if k == 2
112        hold on
113      end
114      %  figure(k)
115    surf( ginfo(k).cor(:,:,1), ...    surf( ginfo(k).cor(:,:,1), ...
116          ginfo(k).cor(:,:,2), ...          ginfo(k).cor(:,:,2), ...
117          ginfo(k).cor(:,:,3), ginfo(k).b_oce )          ginfo(k).cor(:,:,3), ginfo(k).b_oce )
118    %  if k == 5, hold off, end    if k == 5
119    axis equal, view(2)      hold off
120      end
121  end  end
122    axis equal, view(2)
123    
124    
125  if do_print > 0  if do_print > 0
# Line 122  if do_print > 0 Line 127  if do_print > 0
127  end  end
128    
129    
130  %  Write the resulting bathymetry  %  Write the bathymetry to netCDF compatible with MNC
131    id = 'bathy';
132    units = 'm';
133    for k = 1:5
134      disp(sprintf('  k = %d',k));
135      ginfo(k).b_out = ginfo(k).bathy;
136      ginfo(k).b_out(find(ginfo(k).bathy >= 0.0)) = 0.0;
137      bfile = sprintf('llc_p90_bathy.f%03d.nc',k);
138      
139      nc = netcdf(bfile, 'clobber');
140      nc.reference = 'bathymetry';
141      nc.author = 'Ed Hill <eh3@mit.edu>';
142      nc.date = eval('date');
143      nc('X') = size( ginfo(k).XC, 1 );
144      nc('Y') = size( ginfo(k).XC, 2 );
145      nc{ id } = { 'Y', 'X' };
146      nc{ id }.units = units;
147      nc{ id }(:) = ginfo(k).b_out';
148      nc = close(nc);
149    end
150    
151    %  Write the bathymetry to a set of 90-by-90 per-tile MDSIO-compatible
152    %  files
153    %       face  is  js
154    iti = [   1    1   1  ; ...
155              1   91   1  ; ...
156              1  181   1  ; ...
157              1  271   1  ; ...
158              2    1   1  ; ...
159              2   91   1  ; ...
160              2  181   1  ; ...
161              2  271   1  ; ...
162              3    1   1  ; ...
163              4    1   1  ; ...
164              4    1  91  ; ...
165              4    1 181  ; ...
166              4    1 271  ; ...
167              5    1   1  ; ...
168              5    1  91  ; ...
169              5    1 181  ; ...
170              5    1 271  ];
171    for k = 1:size(iti,1)
172      disp(sprintf('  k = %d',k));
173      fname = sprintf('bathy.%03d.001.data',k);
174      fid = fopen(fname, 'w', 'ieee-be');
175      %  be careful of index orientation
176      is = iti(k,3);  ie = is + 90 - 1;
177      js = iti(k,2);  je = js + 90 - 1;
178      tmp = ginfo(iti(k,1)).b_out(is:ie,js:je)';
179      surf(tmp), view(2), axis equal, shading flat, pause(1)
180      fwrite(fid,tmp,'real*8',0,'ieee-be');
181      fclose(fid);
182    end
183    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.22