function section3D = wasa2int(S);
% Convert a vector with the 3D Water Accessible Surface Area from GETAREA (or SABLE)
% output representation (out/in) to integer representation with three categories.
% Program by Steinar Thorvaldsen, 14. november 2004. Changed 21. july 2005
% Use:
% section3D = wasa2int(S)

% S: Water Accessible Surface Area. Data from GETAREA/SABLE program (characters)
% section3D: GETAREA characters represented with numbers and three states:
%   1: internal, < 20% of residue on surface (i in GETAREA)
%   2: twilight zone, 20-39% on surface ('blank' in GETAREA notation, z in our files)
%   3: external, 40-100% on surface (o in GETAREA notation)
%   4: udetermined, gaps and unknown areas
% Tresholds may be changed

N=length(S(1,:));
section3D = 4*ones(1,N, 'uint8'); %section3D(1,N) = ones;
S=lower(S); %Convert string to lowercase
for n=1:N
    switch S(1,n)
        case {'i','0'} %in
            section3D(1,n) = 1;
        case {'z','1','2'}%intermediat
            section3D(1,n) = 2;
        case {'o','3','4','5','6','7','8','9'} %out
            section3D(1,n) = 3;
        otherwise % Gaps
            section3D(1,n) = 4;
    end
end

