/// <summary>Constructor</summary> /// <param name="xproperty">x property</param> /// <param name="x">x values.</param> /// <param name="y">y values.</param> public LinearInterpolationFunction(string xproperty, double[] x, double[] y) { XProperty = xproperty; XYPairs = new XYPairs(); XYPairs.X = x; XYPairs.Y = y; }
/// <summary>Constructor</summary> public LinearInterpolationFunction(double[] x, double[] y) { XYPairs = new XYPairs() { X = x, Y = y }; }
/// <summary>Constructor</summary> /// <param name="xProperty">name of the x property</param> /// <param name="x">x values.</param> /// <param name="y">y values.</param> public LinearInterpolationFunction(string xProperty, double[] x, double[] y) { VariableReference XValue = new VariableReference(); XValue.VariableName = xProperty; XYPairs = new XYPairs(); XYPairs.X = x; XYPairs.Y = y; }
/// <summary>Linint3hrlies the temporary.</summary> /// <param name="tmax">The tmax.</param> /// <param name="tmin">The tmin.</param> /// <param name="ttFn">The tt function.</param> public double Linint3hrlyTemp(double tmax, double tmin, XYPairs ttFn) { // -------------------------------------------------------------------------- // Eight interpolations of the air temperature are // calculated using a three-hour correction factor. // For each air three-hour air temperature, a value // is calculated. The eight three-hour estimates // are then averaged to obtain the daily value. // -------------------------------------------------------------------------- // Local Variables double tot = 0.0; // sum_of of 3 hr interpolations for (int period = 1; period <= num3hr; period++) { // get mean temperature for 3 hr period (oC) double tmean_3hour = temp_3hr(tmax, tmin, period); tot = tot + ttFn.ValueIndexed(tmean_3hour); } return(tot / (double)num3hr); }