/////////////////////////////////////////////////////////////////////////////
// Name:        pet_sl.h
// Author:      Stefan Liersch
// Contact:		stefan.liersch@ufz.de stefan.liersch@gmail.com
// Created:     2007-03-07
//
// --------------------------------------------------------------
// Note:		This class estimates potential evapotranspiration
//				Implemented methods:
//				- Hamon (1961)
//					- The provided temperature time series must start
//					  on January 1st !
//
// References:
// Hamon, W.R. (1961). Estimating potential evapotranspiration,
//		in: Division, J.o.H. (Ed.), 
//		Proceedings of the American Society of Civil Engineers pp. 107-120
/////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////
// ToDo
// -------------------------------------------------------------------------
// - Implement a function that enables the ETp calculation with a temperature
//		time series starting on any day in the year
//		(not neccessarily on January 1st).
//
//
/////////////////////////////////////////////////////////////////////////////

#ifndef __pet_sl_h
#define __pet_sl_h

#include "day_length.h"

class CpET
{
public:
	// default constructor
	CpET();

	// ----------------------------------------------------------------------
	//							HAMON (1961)
	// ----------------------------------------------------------------------
	// Use this constructor to estimate potential evapotranspiration
	// after Hamon (1961). After initializing this class with following constructor,
	// ETp will be calculated automatically. You can access the ETp time series
	// using function 'Get_pET_Hamon(int id)', where id is the element number.
	// The Hamon method uses only a temperature [°C] (mean daily air temperature)
	// time series and the latitude [in degrees] of the temperature station
	// in degrees to calculate a ETp time series.
	CpET(double* temperature, int size, double Latitude, int first_year);
	// ----------------------------------------------------------------------
	
	// destructor
	~CpET();
	// ----------------------------------------------------------------------

	// ----------------------------------------------------------------------
	// Returns the ETp time series (value by value), where id=0 is the first value.
	// If the following constructor was used:
	// CpET(double* temperature, int size, double Latitude, int first_year)
	// ETp after Hamon will be estimated automatically. Otherwise you must run
	// function '_Calc_pET_Hamon' to estimate the ETp time series.
	double			Get_pET_Hamon(int id)	{ return(pET_Hamon[id]); };
	// ----------------------------------------------------------------------


private:
	
	// ----------------------------------------------------------------------
	// Calculate pET after Hamon (1961)
	void			_Calc_pET_Hamon(double* temperature,// mean daily air
														// temperature [°C]
									int size,			// number of temperature values
									int first_year,		// first year of temperature
														// time series
									double* pET_Hamon,	// output time series
									Cday_length* dl);
	// ----------------------------------------------------------------------


	// ----------------------------------------------------------------------
	// pointer array storing ETp values in [mm]
	double*			pET_Hamon;
	// ----------------------------------------------------------------------

	// ----------------------------------------------------------------------
	// Class to estimate the day length, depending on the Julian day and
	// the latitude in degrees.
	Cday_length*	daylength;
	// ----------------------------------------------------------------------

};
#endif /* __pet_sl_h */