/[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.3 by edhill, Thu Aug 24 15:30:24 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    %  Plot the bathymetry at 1/2 resolution
126    k = 3;
127    for k = 1:5
128      disp(sprintf('  k = %d',k));
129      ginfo(k).c_half = ginfo(k).cor(1:2:end,1:2:end,:);
130      ginfo(k).b_half = ginfo(k).bathy(1:2:end,1:2:end);
131      ginfo(k).b_half(find(ginfo(k).b_half >= 0.0)) = 1000;
132      if k == 2
133        hold on
134      end
135      %  figure(k)
136      surf( ginfo(k).c_half(:,:,1), ...
137            ginfo(k).c_half(:,:,2), ...
138            ginfo(k).c_half(:,:,3), ginfo(k).b_half )
139      if k == 5
140        hold off
141      end
142    end
143    axis equal, view(2)
144    
145    
146  if do_print > 0  if do_print > 0
# Line 122  if do_print > 0 Line 148  if do_print > 0
148  end  end
149    
150    
151  %  Write the resulting bathymetry  %  Write the bathymetry to netCDF compatible with MNC
152    id = 'bathy';
153    units = 'm';
154    for k = 1:5
155      disp(sprintf('  k = %d',k));
156      ginfo(k).b_out = ginfo(k).bathy;
157      ginfo(k).b_out(find(ginfo(k).bathy >= 0.0)) = 0.0;
158      bfile = sprintf('llc_p90_bathy.f%03d.nc',k);
159      
160      nc = netcdf(bfile, 'clobber');
161      nc.reference = 'bathymetry';
162      nc.author = 'Ed Hill <eh3@mit.edu>';
163      nc.date = eval('date');
164      nc('X') = size( ginfo(k).XC, 1 );
165      nc('Y') = size( ginfo(k).XC, 2 );
166      nc{ id } = { 'Y', 'X' };
167      nc{ id }.units = units;
168      nc{ id }(:) = ginfo(k).b_out';
169      nc = close(nc);
170    end
171    
172    %  Write the bathymetry to a set of 90-by-90 per-tile MDSIO-compatible
173    %  files
174    %       face  is  js
175    iti = [   1    1   1  ; ...
176              1   91   1  ; ...
177              1  181   1  ; ...
178              1  271   1  ; ...
179              2    1   1  ; ...
180              2   91   1  ; ...
181              2  181   1  ; ...
182              2  271   1  ; ...
183              3    1   1  ; ...
184              4    1   1  ; ...
185              4    1  91  ; ...
186              4    1 181  ; ...
187              4    1 271  ; ...
188              5    1   1  ; ...
189              5    1  91  ; ...
190              5    1 181  ; ...
191              5    1 271  ];
192    for k = 1:size(iti,1)
193      disp(sprintf('  k = %d',k));
194      fname = sprintf('bathy.%03d.001.data',k);
195      fid = fopen(fname, 'w', 'ieee-be');
196      %  be careful of index orientation
197      is = iti(k,3);  ie = is + 90 - 1;
198      js = iti(k,2);  je = js + 90 - 1;
199      tmp = ginfo(iti(k,1)).b_out(is:ie,js:je)';
200      surf(tmp), view(2), axis equal, shading flat, pause(1)
201      fwrite(fid,tmp,'real*8',0,'ieee-be');
202      fclose(fid);
203    end
204    

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

  ViewVC Help
Powered by ViewVC 1.1.22