Back to home page

MITgcm

 
 

    


Warning, /utils/matlab/cs_grid/bk_line/line_sep.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
323aa12fe2 Jean*0001 function [x3b,xPA,yPA,xAI,yAI,xIP,yIP]=line_sep(yIn);
                0002 
5ca580c734 Jean*0003 %- Realistic continents, check that it works at cs32 resolution
323aa12fe2 Jean*0004 %-sep. line Pac - Atl (y increasing order):
5ca580c734 Jean*0005  xPA=[ -70  -59  -70  -70  -62  -90 -104 -104  -88];
                0006  yPA=[ -70  -64  -52  -40  -10   17   21   64   72];
323aa12fe2 Jean*0007 %-sep. line Atl - Ind (y increasing order):
5ca580c734 Jean*0008  xAI=[  21   60  105];
                0009  yAI=[  12   50   75];
323aa12fe2 Jean*0010 %-sep. line Ind - Pac (y increasing order):
5ca580c734 Jean*0011  xIP=[ 146  106  106];
                0012  yIP=[ -34    6   90];
                0013 
                0014 %- Idealised Double-Drake type set-up:
                0015 % Note: 1) Define 3 bassins (instead of 2) since all the other scripts
                0016 %   work with 3 bassins ; But can always merge Ind+Pacfic into 1 bassin
                0017 %   when using these files (mask & sep line)
                0018 % Note: 2) Altantic is the large bassin and Ind+Pacific is the small one
                0019 %-sep. line Pac - Atl (y increasing order):
                0020 %xPA=[-180 -180 ];
                0021 %yPA=[ -34   90 ];
                0022 %-sep. line Atl - Ind (y increasing order):
                0023 %xAI=[  90   90 ];
                0024 %yAI=[ -34   90 ];
                0025 %-sep. line Ind - Pac (y increasing order):
                0026 %xIP=[ 135  135 ];
                0027 %yIP=[ -34   90 ];
323aa12fe2 Jean*0028 
                0029 if yPA(end) < 90, yPA(end+1)=90; xPA(end+1)=xPA(end); end
                0030 if yAI(end) < 90, yAI(end+1)=90; xAI(end+1)=xAI(end); end
                0031 if yIP(end) < 90, yIP(end+1)=90; xIP(end+1)=xIP(end); end
5ca580c734 Jean*0032 %if yPA(1) > -90, yPA(end+1)=0; yPA(2:end)=yPA(1:end-1);
323aa12fe2 Jean*0033 if yPA(1) > -90,  yPA(2:end+1)=yPA(1:end); xPA(2:end+1)=xPA(1:end); yPA(1)=-90; end
                0034 if yAI(1) > -90,  yAI(2:end+1)=yAI(1:end); xAI(2:end+1)=xAI(1:end); yAI(1)=-90; end
                0035 if yIP(1) > -90,  yIP(2:end+1)=yIP(1:end); xIP(2:end+1)=xIP(1:end); yIP(1)=-90; end
                0036 
                0037 n=length(yIn);
                0038 x3b=zeros(3,n);
                0039 for i=1:n,
                0040 
                0041  y=yIn(i);
                0042 %-sep. line Pac - Atl :
                0043  i2=min(find(y<yPA)); i1=i2-1;
                0044  if i1 < 1, x3b(1,i)=xPA(i2) ; else
                0045   x3b(1,i)=xPA(i2)+(xPA(i1)-xPA(i2))*(y-yPA(i2))/(yPA(i1)-yPA(i2));
                0046  end
                0047  if n==1, fprintf(' i2(PA)= %i ',i2); end
                0048 %-sep. line Atl - Ind :
                0049  i2=min(find(y<yAI)); i1=i2-1;
                0050  if i1 < 1, x3b(2,i)=xAI(i2) ; else
                0051   x3b(2,i)=xAI(i2)+(xAI(i1)-xAI(i2))*(y-yAI(i2))/(yAI(i1)-yAI(i2));
                0052  if n==1, fprintf(' i2(AI)= %i ',i2); end
                0053  end
                0054 %-sep. line Ind - Pac :
                0055  i2=min(find(y<yIP)); i1=i2-1;
                0056  if i1 < 1, x3b(3,i)=xIP(i2) ; else
                0057   x3b(3,i)=xIP(i2)+(xIP(i1)-xIP(i2))*(y-yIP(i2))/(yIP(i1)-yIP(i2));
                0058  end
                0059  if n==1, fprintf(' i2(IP)= %i \n',i2); end
                0060 
                0061 end
                0062 return