| 1 | 
gmaze | 
1.1 | 
% Test of the function surfbet2outcrops | 
| 2 | 
  | 
  | 
% | 
| 3 | 
  | 
  | 
 | 
| 4 | 
  | 
  | 
clear | 
| 5 | 
  | 
  | 
 | 
| 6 | 
  | 
  | 
% Theoritical fields: | 
| 7 | 
  | 
  | 
eg = 1; | 
| 8 | 
  | 
  | 
 | 
| 9 | 
  | 
  | 
switch eg | 
| 10 | 
  | 
  | 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   | 
| 11 | 
  | 
  | 
 case 1 % The more simple: | 
| 12 | 
  | 
  | 
  % Axis: | 
| 13 | 
  | 
  | 
  lon = [200:1/8:300]; nlon = length(lon); | 
| 14 | 
  | 
  | 
  lat = [0:1/8:20];   nlat = length(lat); | 
| 15 | 
  | 
  | 
     | 
| 16 | 
  | 
  | 
  % chp goes linearly from 20 at 0N to 0 at 20N | 
| 17 | 
  | 
  | 
  [a chp] = meshgrid(lon,-lat+lat(nlat)); clear a c | 
| 18 | 
  | 
  | 
%  chp(:,1:400) = chp(:,1:400).*NaN; | 
| 19 | 
  | 
  | 
   | 
| 20 | 
  | 
  | 
  % Define limits: | 
| 21 | 
  | 
  | 
  LIMITS(1) = 18 ; % Between 1.75N and 2N | 
| 22 | 
  | 
  | 
  LIMITS(2) = 18.2 ; | 
| 23 | 
  | 
  | 
  LIMITS(3:4) = lat([1 nlat]) ; | 
| 24 | 
  | 
  | 
  LIMITS(5:6) = lon([1 nlon]) ; | 
| 25 | 
  | 
  | 
    | 
| 26 | 
  | 
  | 
  % Expected surface: | 
| 27 | 
  | 
  | 
  dx = m_lldist([200 300],[1 1]*1.875)./1000; | 
| 28 | 
  | 
  | 
  dy = m_lldist([1 1],[1.75 2])./1000; | 
| 29 | 
  | 
  | 
  Sexp = dx*dy; % Unit is km^2 | 
| 30 | 
  | 
  | 
   | 
| 31 | 
  | 
  | 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   | 
| 32 | 
  | 
  | 
   | 
| 33 | 
  | 
  | 
end %switch | 
| 34 | 
  | 
  | 
 | 
| 35 | 
  | 
  | 
 | 
| 36 | 
  | 
  | 
 | 
| 37 | 
  | 
  | 
% Get surface: | 
| 38 | 
  | 
  | 
[S Smat dS] = surfbet2outcrops(chp,LIMITS,lat,lon); | 
| 39 | 
  | 
  | 
 | 
| 40 | 
  | 
  | 
disp('Computed:') | 
| 41 | 
  | 
  | 
disp(num2str(S/1000^2)) | 
| 42 | 
  | 
  | 
disp('Approximatly expected:') | 
| 43 | 
  | 
  | 
disp(num2str(Sexp)) |