Back to home page

MITgcm

 
 

    


Warning, /verification/tutorial_global_oce_latlon/diags_matlab/mit_oceanmasks.m is written in an unsupported language. File is not indexed.

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
051ee7f715 Jean*0001 function grid = mit_oceanmasks(grid,plotit)
                0002 % function grid = mit_oceanmasks(grid)
                0003 % create masks for the 4x4 degree run for the individual oceans
                0004 % hfacc/s/w have to be available for this
                0005   
                0006   if grid.nx ~= 90 | grid.ny ~= 40 
                0007     error(sprintf( ...
                0008         '%s\n%s\n%s\n%s', ...
                0009         'Your horizontal grid has dimensions different from 90x40.', ...
                0010         'mit_oceanmasks creates masks for the individual ocean basins,', ...
                0011         'therefore it needs to be customized if you change the', ...
                0012         'horizontal dimensions.'))
                0013   end
                0014     
                0015   % masks for the zonal velocities:
                0016   % hfacw
                0017   
                0018   % Atlantic mask
                0019   grid.atlantic_hfacw = grid.hfacw;
                0020   ixsow = 6:73; % southern ocean and most of pacific
                0021   iysow = 1:24; 
                0022   grid.atlantic_hfacw(ixsow,iysow,:) = NaN;
                0023   ixnpw = 15:67; % northern pacific
                0024   iynpw = 25:37;
                0025   grid.atlantic_hfacw(ixnpw,iynpw,:) = NaN;
                0026   % Pacific mask
                0027   grid.pacific_hfacw = grid.hfacw;
                0028   ixaw = 74:90; % most of the atlantic
                0029   iyaw = 1:40;
                0030   grid.pacific_hfacw(ixaw,iyaw,:) = NaN;
                0031   ixnaw = 68:73; % north atlantic and gulf of Mexico
                0032   iynaw = 27:40;
                0033   grid.pacific_hfacw(ixnaw,iynaw,:) = NaN;
                0034   ixcaw = 70:73; % carribean
                0035   iycaw = 24:26;
                0036   grid.pacific_hfacw(ixcaw,iycaw,:) = NaN;
                0037   ixiw = 1:27; % most of the indic
                0038   iyiw = 1:40;
                0039   grid.pacific_hfacw(ixiw,iyiw,:) = NaN;
                0040   ixauw = 28:35; % water south and west of Australia
                0041   iyauw = 1:20;
                0042   grid.pacific_hfacw(ixauw,iyauw,:) = NaN;
                0043   
                0044   
                0045   % masks for the meridional overturning stream functions:
                0046   % hfacs
                0047   
                0048   % Atlantic mask
                0049   grid.atlantic_hfacs = grid.hfacs;
                0050   ixso = 5:73; % southern ocean
                0051   iyso = 1:24;
                0052   grid.atlantic_hfacs(ixso,iyso,:) = NaN;
                0053   ixnp = 14:65; % northern pacific
                0054   iynp = 25:36; 
                0055   grid.atlantic_hfacs(ixnp,iynp,:) = NaN;
                0056   ixsoc = 1:90; % complete southern ocean
                0057   iysoc = 1:12; % south of latg(12) = -34 degN;
                0058   grid.atlantic_hfacs(ixsoc,iysoc,:) = NaN;
                0059   
                0060   % Pacific mask
                0061   grid.pacific_hfacs = grid.hfacs;
                0062   ixatl = [1:26 74:90]; % most of altantic and indian ocean
                0063   iyatl = 1:grid.ny;
                0064   grid.pacific_hfacs(ixatl,iyatl,:) = NaN;
                0065   ixatlf = 73; % small fix
                0066   iyatlf = 31;
                0067   grid.pacific_hfacs(ixatlf,iyatlf,:) = NaN;
                0068   ixgm = 66:73; % Gulf of Mexico
                0069   iygm = 25:30;
                0070   grid.pacific_hfacs(ixgm,iygm,:) = NaN;
                0071   ixhb = 68:73; % Hudson Bay and Baffin Bay
                0072   iyhb = 36:40;
                0073   grid.pacific_hfacs(ixhb,iyhb,:) = NaN;
                0074   ixsop = 1:grid.nx; % southern ocean
                0075   iysop = 1:12;
                0076   grid.pacific_hfacs(ixsop,iysop,:) = NaN;
                0077   ixio = 27:32; % rest of indian ocean
                0078   iyio = 13:19;
                0079   grid.pacific_hfacs(ixio,iyio,:) = NaN;
                0080   %pacific_hfacs(33:34,12,:) = NaN; % two points south of Australia
                0081   
                0082   % Indian ocean
                0083   grid.indic_hfacs = grid.hfacs;
                0084   ixsoi = 1:90; % southern ocean
                0085   iysoi = 1:12;
                0086   grid.indic_hfacs(ixsoi,iysoi,:) = NaN;
                0087   ixap = [1:4 33:90]; % atlantic and pacific
                0088   iyap = 1:40;
                0089   grid.indic_hfacs(ixap,iyap,:) = NaN;
                0090   iynps = 35:40; % north polar sea
                0091   grid.indic_hfacs(:,iynps,:) = NaN;
                0092   ixmeds = 1:10;  % mediterraenan
                0093   iymeds = 29:31;
                0094   grid.indic_hfacs(ixmeds,iymeds,:) = NaN;
                0095   ixscs = 27:32; % south china sea
                0096   iyscs = 21:29;
                0097   grid.indic_hfacs(ixscs,iyscs,:) = NaN;
                0098   grid.indic_hfacs(5,39,:) = NaN; % singular point near Murmansk
                0099   
                0100   % Southern Ocean
                0101   grid.so_hfacs = change( ...
                0102       change(grid.atlantic_hfacs,'==',NaN,-1) ...
                0103       + change(grid.pacific_hfacs,'==',NaN,-1) ...
                0104       + change(grid.indic_hfacs,'==',NaN,-1) ...
                0105       + grid.hfacs-grid.hfacs,'==',-1,NaN);
                0106   iso = find(~isnan(grid.so_hfacs));
                0107   grid.so_hfacs(iso)= grid.hfacs(iso);
                0108 
                0109   if exist('plotit','var')
                0110     figure;
                0111     spy(isnan(grid.hfacs(:,:,1)'),'kx');
                0112     hold on; 
                0113     spy(~isnan(grid.atlantic_hfacs(:,:,1)')); 
                0114     spy(~isnan(grid.indic_hfacs(:,:,1)'),'g.'); 
                0115     spy(~isnan(grid.so_hfacs(:,:,1)'),'r.'); 
                0116     spy(~isnan(grid.pacific_hfacs(:,:,1)'),'y.');
                0117     title('hfacs')
                0118     axis xy
                0119   end
                0120   
                0121   % masks for zonal averages of C-properties:
                0122   % hfacc
                0123   
                0124   % Atlantic mask
                0125   grid.atlantic_hfacc = grid.hfacc;
                0126   ixe = 6:65; % indian ocean
                0127   iye = 1:28;
                0128   grid.atlantic_hfacc(ixe,iye,:) = NaN;
                0129   ixep = 26:65; % eastern pacific
                0130   iyep = 1:grid.ny; 
                0131   grid.atlantic_hfacc(ixep,iyep,:) = NaN;
                0132   ixw = 6:73; % western pacific
                0133   iyw = 1:23;
                0134   grid.atlantic_hfacc(ixw,iyw,:) = NaN;
                0135   ixgl = 66:68; % galapagos
                0136   iygl = 24;
                0137   grid.atlantic_hfacc(ixgl,iygl,:) = NaN;
                0138   ixch = 73; % coast of Chile
                0139   iych = 13:15;
                0140   grid.atlantic_hfacc(ixch,iych,:) = NaN;
                0141   
                0142   % Pacific mask
                0143   grid.pacific_hfacc = grid.hfacc;
                0144   ixatl = [1:25 74:90]; % most of altantic and indian ocean
                0145   iyatl = 1:grid.ny;
                0146   grid.pacific_hfacc(ixatl,iyatl,:) = NaN;
                0147   ixatlf = 73; % small fix
                0148   iyatlf = 31;
                0149   grid.pacific_hfacc(ixatlf,iyatlf,:) = NaN;
                0150   ixgme = 69:73; % Gulf of Mexico
                0151   iygme = 24:30;
                0152   ixgmw = 66:69;
                0153   iygmw = 26:28;
                0154   grid.pacific_hfacc(ixgme,iygme,:) = NaN;
                0155   grid.pacific_hfacc(ixgmw,iygmw,:) = NaN;
                0156   ixhbb = 68:73; % Hudson and Baffin Bay
                0157   iyhbb = 35:40;
                0158   grid.pacific_hfacc(ixhbb,iyhbb,:) = NaN;
                0159   ixio = 26:34; % rest of indian ocean
                0160   iyio =  1:19;
                0161   grid.pacific_hfacc(ixio,iyio,:) = NaN;
                0162 %  grid.pacific_hfacc(33:34,12,:) = NaN; % two points south of Australia
                0163   
                0164   % Indian ocean
                0165   grid.indic_hfacc = ...
                0166       change(change(grid.atlantic_hfacc,'==',NaN,0),'>',0,NaN) ...
                0167       + change(change(grid.pacific_hfacc,'==',NaN,0),'>',0,NaN) ...
                0168       + grid.hfacc;
                0169   
                0170   if exist('plotit','var')
                0171     figure;
                0172     spy(isnan(grid.hfacc(:,:,1)'),'kx'); axis xy
                0173     hold on; 
                0174     spy(~isnan(grid.atlantic_hfacc(:,:,1)')); 
                0175     spy(~isnan(grid.pacific_hfacc(:,:,1)'),'r.');
                0176     spy(~isnan(grid.indic_hfacc(:,:,1)'),'g.'); 
                0177     axis xy
                0178     title('hfacc');
                0179 
                0180   end
                0181   
                0182   return