function surveypts = convert(new_data) %------------------------------------------------------------------------------------------ %************************** SUBROUTINE DESCRIPTION CONVERT.m ****************************** % CONVERT.m is a subroutine of CAVEMAP.m and not designed to stand alone. It converts % survey data into (x,y,z) coordinates describing the location of the survey stations and % four perimeter points describing the right and left walls, and top and bottom of the % cave at each station. A local rectangular coordinate system is used where the user % inputs the (x,y) coordinates at the point of origin. The water surface is used as the % vertical datum. % The output data is an 11 column matrix consisting of: % col #1 = new_ss = adjusted ss number. % col #2 = new_x = x coordinate for the ss. % col #3 = new_y = y coordinate for the ss. % col #4 = new_z = z coordinate for the ss. % col #5 = new_ztop = z coordinate for the cave top. % col #6 = new_zbot = z coordinate for the cave bot. % col #7 = new_room = room indicator. % col #8 = new_xrtw = x coordinate for the right wall. % col #9 = new_yrtw = y coordinate for the right wall. % col #10 = new_xltw = x coordinate for the left wall. % col #11 = new_yltw = y coordinate for the left wall. % Input data is the same as for CAVEMAP.m except distances between survey stations have % been adjusted to account for depth changes in CAVEMAP.m. %------------------------------------------------------------------------------------------ %*********************** DETERMINING SIZE OF THE INPUT DATA MATRIX ************************ [row,col] = size(new_data); %------------------------------------------------------------------------------------------ %************************** EXTRACTING DATA FROM INPUT MATRIX ***************************** ssj = new_data(:,1); ss = new_data(:,2); az = new_data(:,3); RecDis = new_data(:,4); depth = new_data(:,5); disrt = new_data(:,6); dislt = new_data(:,7); depthtop = new_data(:,8); depthbot = new_data(:,9); room = new_data(:,10); %------------------------------------------------------------------------------------------ %*********************** ASSIGNING BEGINNING X,Y COORDINATES ****************************** x(1) = input(' Enter the starting x coordinate. '); y(1) = input(' Enter the starting y coordinate. '); %------------------------------------------------------------------------------------------ %**************************** CREATING X,Y DATA POINTS ************************************ % looping over the data set to calculate x,y coordinates for the survey stations % note that z = depth taken directly from the original data set for i = 2:row %determines the location of the jumps if ss(i) > 1000 x(i) = x(ssj(i)); y(i) = y(ssj(i)); else x(i) = x(i-1) + (RecDis(i) * sin(az(i-1))); y(i) = y(i-1) + (RecDis(i) * cos(az(i-1))); end end % calaulating the right wall coordinates % note that zrtw = depth at the survey station xrtw = x + (disrt' .* sin(az' + pi/2)); yrtw = y + (disrt' .* cos(az' + pi/2)); % calculating the left wall coordinate % note that zltw = depth at the survey station xltw = x + (dislt' .* sin(az' + 3*pi/2)); yltw = y + (dislt' .* cos(az' + 3*pi/2)); % - note that xtop, ytop, xbot, and ybot will = % x and y at the survay station % - note that ztop = depthtop taken from the original data set % - note that zbot = depthbot taken from the original data set ztop = depthtop; zbot = depthbot; z = depth; %------------------------------------------------------------------------------------------ %****************************** INSERTING JUMP MARKERS ************************************ % Inserting -999.9 as a markers to deliniate side conduits stemming from the main conduit. count = 1; for i = 1:row if ss(i) > 1000 new_ss(count) = -999.9; new_x(count) = -999.9; new_y(count) = -999.9; new_z(count) = -999.9; new_ztop(count) = -999.9; new_zbot(count) = -999.9; new_room(count) = -999.9; new_xrtw(count) = -999.9; new_yrtw(count) = -999.9; new_xltw(count) = -999.9; new_yltw(count) = -999.9; count = count + 1; new_ss(count) = ss(i); new_x(count) = x(i); new_y(count) = y(i); new_z(count) = z(i); new_ztop(count) = ztop(i); new_zbot(count) = zbot(i); new_room(count) = room(i); new_xrtw(count) = xrtw(i); new_yrtw(count) = yrtw(i); new_xltw(count) = xltw(i); new_yltw(count) = yltw(i); count = count + 1; else new_ss(count) = ss(i); new_x(count) = x(i); new_y(count) = y(i); new_z(count) = z(i); new_ztop(count) = ztop(i); new_zbot(count) = zbot(i); new_room(count) = room(i); new_xrtw(count) = xrtw(i); new_yrtw(count) = yrtw(i); new_xltw(count) = xltw(i); new_yltw(count) = yltw(i); count = count + 1; end end new_ss(count) = -999.9; new_x(count) = -999.9; new_y(count) = -999.9; new_z(count) = -999.9; new_ztop(count) = -999.9; new_zbot(count) = -999.9; new_room(count) = -999.9; new_xrtw(count) = -999.9; new_yrtw(count) = -999.9; new_xltw(count) = -999.9; new_yltw(count) = -999.9; %------------------------------------------------------------------------------------------ %************************** CREATING OUTPUT DATA MATRIX *********************************** surveypts = [new_ss' new_x' new_y' new_z' new_ztop' new_zbot' new_room' new_xrtw' new_yrtw' new_xltw' new_yltw']; %------------------------------------------------------------------------------------------ %****************************** END SUBROUTINE CONVERT.m **********************************