1 |
function []=check3dmask(T) |
2 |
% check3dmask(datafile) |
3 |
% |
4 |
% Load 3D data in "datafile", calculate a missing |
5 |
% value mask and compare to pmask.bin. |
6 |
% They should always be the same!!! |
7 |
% |
8 |
% Created 11/11/99 by adcroft@mit.edu |
9 |
% Modified by |
10 |
% Maintained by adcroft@mit.edu, abiastoch@ucsd.edu |
11 |
|
12 |
load VGRID.mat nzc |
13 |
load MASKS |
14 |
|
15 |
Tmsk=1+0*T; |
16 |
Tmsk( find(T==0) )=0; |
17 |
Tmsk( find(isnan(T)) )=0; |
18 |
|
19 |
oops=0; |
20 |
for k=1:nzc |
21 |
nmis=prod(size(find(msk(:,:,k)~=Tmsk(:,:,k)))); |
22 |
ndil=prod(size(find(msk(:,:,k)==0&Tmsk(:,:,k)==1))); |
23 |
nwnd=prod(size(find(msk(:,:,k)==1&Tmsk(:,:,k)==0))); |
24 |
if nmis~=0 | ndil~=0 | nwnd~=0 |
25 |
disp(... |
26 |
sprintf('Lev k=%3i: Mis = %i, Data/land = %i, Water/no data = %i, Unacc = %i',... |
27 |
k,nmis,ndil,nwnd,nmis-ndil-nwnd )); |
28 |
oops=1; |
29 |
end |
30 |
end |
31 |
if oops |
32 |
disp( sprintf('file = %s, mask-file = %s',datafile,pmaskfile) ); |
33 |
error('Some masks were inconsistent!') |
34 |
end |