% Filename:	colorDepths.m
% Author:	Curt Blais (adapted from bathymetry sample by Don Brutzman)
% Created:	28 April 2001
% Utilized:	11 October 2001 by James Harney for Aden Harbor, Yemen geo.	
% Description:	Map depth values to a color map.

function rgbValue = colorDepths (depthInMeters, depthRange);

    startRed   = 0.7;  endRed   = 0.1;
    startGreen = 0.7;  endGreen = 0.1;
    startBlue  = 0.7;  endBlue  = 1.0;     
    spacer = '\t';
    
    if (depthRange == 0) depthRange = 1;
    end;

% interpolate color values over range of elevation
    ratio = depthInMeters/depthRange;
    newRed = startRed + ratio*(endRed-startRed);
    newGreen = startGreen + ratio*(endGreen-startGreen);
    newBlue = startBlue + ratio*(endBlue-startBlue);
    
	if    (depthInMeters > 0)	
        rgbValue = ' .2 .4 .6 ';		% blue-green
    else 
        rgbValue = strcat( spacer, num2str(newRed), spacer, num2str(newGreen), spacer, num2str(newBlue) );
% residual color map from bathymetry exemplar code -- could be re-used if banding of colors is preferred
%	elseif (depthInMeters < 10)	rgbValue = '0.91 0.91 0.56';		% tan
%   elseif (depthInMeters < 20)	rgbValue = '.871 .721 .529';		
%	elseif (depthInMeters < 30)	rgbValue = '.8 .75 .5';		
%	elseif (depthInMeters < 40)	rgbValue = '.7 .80 .4';		
%	elseif (depthInMeters < 50)	rgbValue = '.6 .82 .3';		
%	elseif (depthInMeters < 60)	rgbValue = '.5 .84 .2';		
%	elseif (depthInMeters < 70)	rgbValue = '.4 .86 .1';		
%	elseif (depthInMeters < 80)	rgbValue = '.3 .88 .05';	
%	elseif (depthInMeters < 90)	rgbValue = '.2 .90 .03';	
%	elseif (depthInMeters < 100)	rgbValue = '.18 .92 .02';	
%	elseif (depthInMeters < 150)	rgbValue = '.15 .94 .01';	
%	elseif (depthInMeters < 200)	rgbValue = '.10 .96 0';	
%	elseif (depthInMeters < 250)	rgbValue = '.05 .98 0';		
%	else                         	rgbValue = '0 1 0';	
	end;		
return;

% some helpful color-value definitions available at
% http://www.w3.org/TR/1998/REC-html40-19980424/types.html#idx-color
