#ifndef _CALCULATION_H
#define _CALCULATION_H

#include "app_general.h"


typedef enum chill_calc_type {
	calc_chill_siple_passel,
	calc_warmth_loss_siple_passel,
	calc_chill_court,
	calc_warmth_loss_court,
	calc_chill_steadman,
	calc_warmth_loss_steadman,
	calc_chill_rees,
	calc_warmth_loss_rees
} chill_calc_type;

typedef enum heat_index_calc_type  {
	calc_heat_index_nws,
	calc_heat_index_usa_today,
	calc_humidex
} heat_index_calc_type;

void
calc_dew_rh (double t1, double t2, int rh1, int * rh2, double *dew);

const char *
calc_weather_type(double the_av_temp,double the_long_term_average_temp);

const char *
calc_weather_class(double the_av_temp,double the_long_term_average_temp,
		   double the_outside_temp, double the_relative_humidity,
		   double the_windspeed);

const char *
high_temp_classification (double temp);

const char *
low_temp_classification (double temp);

const char *
check_hittegolf (const char * history, const char * cur_temp_classification);

void
update_hittegolf_history(char * history, double temp);

void
calc_dew_point(double t, double h, char const * format, char * value);

int
calc_absolute_humidity (double t, double p, double h,char const * format, char * value);

int
calc_net_effective_temperature (double t, double h, double s, char const * format, char * value );

char const *
calc_heat_index_risk (double hi);

int
calc_heat_index (heat_index_calc_type heat_index_calculation,double t, double h, char const * format, char * value);

char const *
calc_heat_loss_risk (double h);

int
calc_chill (chill_calc_type chill_calculation,double t, double s, char const * format, char * value);

double
calc_graaddagen (double t, int the_month);

double
calc_degree_days (double t1, double t2);

void
calc_weighed_wind_dir (double speed, double filt_speed, double dir, double *filt_dir, double alpha);

char const *
calc_tendency(double to_value, double from_value,double slow_change,double fast_change);

double
calculate_normalized_baro(double the_baro,double the_heigth);

double
calc_temperature_height(double the_base_temp, double the_offset);

void
analyse_the_baro_pressure (double baro, double baro1,double baro2,
		double * the_future_baro_pressure,
		const char ** current_weather,
		const char ** expected_weather,
		int * current_rain_chance,
		int * expected_rain_chance);
char const *
calc_dir_tendency(double to_value,double from_value, double slow_change,double fast_change);

void
calc_easter (int the_year, int * the_month, int * the_day);

Boolean
is_day(double the_jd, double start_twilight, double end_twilight);

int
get_random (int min, int max);

double
calculate_medical_indicator1 (double baro1, double baro2, double humidity);
double
calculate_medical_indicator2(double baro1,double baro2,
			     double humidity, double the_current_baro,
			     double spring,double autumn,double now);

#endif