/******************************************************************
 * tempConv.java - This class contains methods for converting 
 * various temperature units. 
 * Unless noted otherwise, conversions taken from 
 * http://icoads.noaa.gov/software/lmrlib
 * @author Eric Freeman
 * date 2/01/2008
*/

package gov.noaa.ncdc.marine.lightship;

public class TempConverter {
/*****************************************************************
	The conv_CtoF method receives a temperature in Celsius
	and returns the temperature in Fahrenheit.
	Equation from:
		List, R.J., 1966: Smithsonian Meteorological Tables.
           Smithsonian Institution, Washington, DC, 527 pp.
		Table 2(p.17)
	
	@param tempC a double containing the temperature (C)
	@return a double containing the temperature (F)
*/
	public static double conv_CtoF(double tempC)
	{       
        return ((9.0/5.0) * tempC) + 32;
	}
	
/******************************************************************
	The conv_FtoC method receives a temperature in Fahrenheit
	and returns the temperature in Celsius.
	Equation from:
		List, R.J., 1966: Smithsonian Meteorological Tables.
           Smithsonian Institution, Washington, DC, 527 pp.
		Table 2(p.17)
	
	@param tempF a double containing the temperature (F)
	@return a double containing the temperature (C)
*/
	public static double conv_FtoC(double tempF)
	{
			return (5.0 / 9.0) * (tempF - 32) ;
	}
	
/******************************************************************
	The conv_KtoC method receives a temperature in Kelvin
	and returns the temperature in Celsius.
	Equation from:
		National Weather Service @ 
		http://www.srh.noaa.gov/elp/wxcalc/formulas/tempConvert.html
	
	@param tempK a double containing the temperature (K)
	@return a double containing the temperature (C)
*/
	public static double conv_KtoC(double tempK)
	{
			return tempK + 273.15;
	}

/******************************************************************
	The conv_CtoK method receives a temperature in Celsius
	and returns the temperature in Kelvin.
	Equation from:
		National Weather Service @ 
		http://www.srh.noaa.gov/elp/wxcalc/formulas/tempConvert.html
	
	@param tempC a double containing the temperature (C)
	@return a double containing the temperature (K)
*/
	public static double conv_CtoK(double tempC)
	{
			return tempC - 273.15;
	}

/******************************************************************
	The conv_KtoF method receives a temperature in Kelvin
	and returns the temperature in Fahrenheit.
	Equation from:
		National Weather Service @ 
		http://www.srh.noaa.gov/elp/wxcalc/formulas/tempConvert.html
	
	@param tempK a double containing the temperature (K)
	@return a double containing the temperature (F)
*/
	public static double conv_KtoF(double tempK)
	{
			return (9.0/5.0) * (tempK - 273.15) + 32;
	}	
	
/******************************************************************
	The conv_FtoK method receives a temperature in Fahrenheit
	and returns the temperature in Kelvin.
	Equation from:
		National Weather Service @ 
		http://www.srh.noaa.gov/elp/wxcalc/formulas/tempConvert.html
	
	@param tempF a double containing the temperature (F)
	@return a double containing the temperature (K)
*/
	public static double conv_FtoK(double tempF)
	{
			return ((5.0/9.0) * (tempF - 32)) - 273.15;
	}		
		
/*****************************************************************
	The conv_CtoR method receives a temperature in Celsius
	and returns the temperature in Reaumur.
	Equation from:
		List, R.J., 1966: Smithsonian Meteorological Tables.
           Smithsonian Institution, Washington, DC, 527 pp.
		Table 2(p.17)
	
	@param tempC a double containing the temperature (C)
	@return a double containing the temperature (R)
*/
	public static double conv_CtoR(double tempC)
	{       
        return (4.0/5.0) * tempC;
	}

/*****************************************************************
	The conv_RtoC method receives a temperature in Reaumur
	and returns the temperature in Celsius.
	Equation from:
		List, R.J., 1966: Smithsonian Meteorological Tables.
           Smithsonian Institution, Washington, DC, 527 pp.
		Table 2(p.17)
	
	@param tempR a double containing the temperature (R)
	@return a double containing the temperature (C)
*/
	public static double conv_RtoC(double tempR)
	{       
        return (5.0/4.0) * tempR;
	}

}
