%
% MATLAB code for reading extracted fracture data
% "Fracture in tuff" project on Digital Rocks Portal
%

%read the file indicating mid plane
mid = load('cc02-2aMid.txt');
[n,m] = size(mid);

x = 0:(n-1); x = x*0.2344; % scale x coord to mm
z = 0:(m-1); z = z*0.25;   % scale z coord to mm

[X,Z] = meshgrid(z,x);

surf(X,Z,mid,'linestyle','none')
xlabel('z coord in mm');
ylabel('x coord in mm');
zlabel('y coord in mm');

title('Fracture mid plane');
colormap('copper')
colorbar
set(gca,'fontsize',16)
axis tight

% this is how to read the rest of the files, you can visualize them in
% similar manner
%top = load('cc02-2aTop.txt');
%bot = load('cc02-2aBot.txt');

% visualize aperture
ap = load('cc02-2aAp.txt');

figure
surf(X,Z,ap,'linestyle','none')
xlabel('z coord in mm');
ylabel('x coord in mm');

colormap('jet')
h=colorbar
ylabel(h,'Aperture (mm)')
set(gca,'fontsize',16)
axis tight
view([0,90]);


