function [B,A] = datadjust(data, newpiecedepths, log) % [B,A] = datadjust(DATA, NEWPIECEDEPTHS, LOG) % % This script will integrate any physical property data with % the new piece depths. % % ------------------------------------------------------------------------- % INPUTS: DATA, NEWPIECEDEPTHS, LOG % DATA is a 6-column matrix of physical property data from ODP/IODP core data, in % a format similar to Janus, http://www-odp.tamu.edu/database/. % DATA(:,1) is core number % DATA(:,2) is section number % DATA(:,3) is curated depth (mbsf) % DATA(:,4) is physical property data (e.g. density, velocity, porosity) % DATA(:,5) is piece number % DATA(:,6) is the depth of data from top of piece (cm) % % NEWPIECEDEPTHS is a 4-column matrix computed by corelogintegrate.m % NEWPIECEDEPTHS(:,1) is core number % NEWPIECEDEPTHS(:,2) is section number % NEWPIECEDEPTHS(:,3) is piece number % NEWPIECEDEPTHS(:,4) is new depth to the top of the piece (mbsf) % % LOG is a 2-column matrix of downhole logging data of the physical % property found in DATA(:,4) % LOG(:,1) is depth (mbsf) % LOG(:,2) is physical property data (see DATA(:,4)) % % PIECES is a 7-column matrix. % PIECES(:,1) is core number % PIECES(:,2) is section number % PIECES(:,3) is piece number % PIECES(:,4) is distance below top of section to top of piece (cm) % PIECES(:,5) is distance below top of section to bottom of piece (cm) % PIECES(:,6) is length of piece (cm) % PIECES(:,7) is tide-corrected depth to top of core (mbsf) % % OUTPUT: B, A % B is a 4-column matrix representing the data before depth shifting % B(:,1) is curated depth (mbsf) % B(:,2) is physical property data for the core piece % B(:,3) is the nearest logging depth to the curated depth (mbsf) % B(:,4) is the physical property value at that nearest depth in the log record % A is a 4-column matrix representing the data after depth shifting % A(:,1) is new depth after shifting of physical property (mbsf) % A(:,2) is physical property data for the core piece % A(:,3) is the nearest logging depth to the new depth (mbsf) % A(:,4) is the physical property value at that nearest depth in the log record % % ------------------------------------------------------------------------- % % Gilbert, L.A. and A. Burke, 2008, Depth-shifting cores % incompletely recovered from the upper oceanic crust, IODP Hole 1256D, % G-cubed, 2008gc002010. % % Revised 5/8/08, AB and LAG % for further information contact aburke@mit.edu or lgilbert@williams.edu newdata = []; for i = 1:length(data) if data(i,1) >= newpiecedepths(1,1) & data(i,1) <= newpiecedepths(end,1) index = find(newpiecedepths(:,1) == data(i,1) & newpiecedepths(:,2) == data(i,2) & newpiecedepths(:,3) == data(i,5)); newdata = [newdata; data(i,1) data(i,2) data(i,3) data(i,4) data(i,5) data(i,6) newpiecedepths(index(1,1),4)+(data(i,6)/100)]; end end datadepths = [newdata(:,4) newdata(:,3) newdata(:,7)]; %% Now find the closest log datapoint before and after depth shifting B = []; A = []; for i = 1:length(datadepths) beforeindex = findnearest(datadepths(i,2),log); afterindex = findnearest(datadepths(i,3),log); B = [B; datadepths(i,2) datadepths(i,1) log(beforeindex(1,1),1) log(beforeindex(1,1),2)]; A = [A; datadepths(i,3) datadepths(i,1) log(afterindex(1,1),1) log(afterindex(1,1),2)]; end