1 |
gmaze |
1.1 |
% Test of the function intbet2outcrops |
2 |
|
|
clear |
3 |
|
|
|
4 |
|
|
% Theoritical fields: |
5 |
|
|
eg = 1; |
6 |
|
|
|
7 |
|
|
switch eg |
8 |
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
9 |
|
|
case 1 % The more simple: |
10 |
|
|
% Axis: |
11 |
|
|
lon = [200:1/8:300]; nlon = length(lon); |
12 |
|
|
lat = [0:1/8:20]; nlat = length(lat); |
13 |
|
|
|
14 |
|
|
% chp goes linearly from 20 at 0N to 0 at 20N |
15 |
|
|
[a chp] = meshgrid(lon,-lat+lat(nlat)); clear a c |
16 |
|
|
[a chp] = meshgrid(lon,-lat+2); clear a c |
17 |
|
|
chp(14:16,:)=1; % Make the integral proportional to the surface |
18 |
|
|
|
19 |
|
|
% Define limits: |
20 |
|
|
LIMITS(1) = -1 ; |
21 |
|
|
LIMITS(2) = -1 ; |
22 |
|
|
LIMITS(3:4) = lat([15 15]) ; |
23 |
|
|
LIMITS(5:6) = lon([1 nlon]) ; |
24 |
|
|
|
25 |
|
|
% Expected integral: |
26 |
|
|
dx = m_lldist([200 300],[1 1]*1.75)./1000; |
27 |
|
|
dy = m_lldist([1 1],[1.625 1.875])./1000; |
28 |
|
|
Iexp = dx*dy/2; % Unit is km^2 |
29 |
|
|
|
30 |
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
31 |
|
|
|
32 |
|
|
end %switch |
33 |
|
|
|
34 |
|
|
|
35 |
|
|
% Get integral: |
36 |
|
|
[I Imat dI] = intbet2outcrops(chp,LIMITS,lat,lon); |
37 |
|
|
|
38 |
|
|
disp('Computed:') |
39 |
|
|
disp(num2str(I/1000^2)) |
40 |
|
|
disp('Approximatly expected:') |
41 |
|
|
disp(num2str(Iexp)) |
42 |
|
|
|
43 |
|
|
break |
44 |
|
|
figure;iw=1;jw=2; |
45 |
|
|
subplot(iw,jw,1);hold on |
46 |
|
|
pcolor(chp);shading flat;canom;colorbar;axis tight |
47 |
|
|
title('Tracer to integrate'); |
48 |
|
|
|
49 |
|
|
subplot(iw,jw,2);hold on |
50 |
|
|
pcolor(double(Imat));shading flat;canom;colorbar;axis tight |
51 |
|
|
title('Points selected for the integration'); |