/// <summary> /// Get Y coordinate array /// </summary> /// <returns>Y array</returns> private double[] GetYArray() { double[] Y = new double[NY]; switch (GridType) { case 4: //Gaussian Lat/Lon grid Y = (double[])DataMath.Gauss2Lats(NY)[0]; break; //default: // double dy = Math.Abs(DY); // //double sLat = Math.Min(Lat1, Lat2); // double sLat = Lat1; // for (int i = 0; i < NY; i++) // { // Y[i] = sLat + dy * i; // } // break; default: for (int i = 0; i < NY; i++) { Y[i] = Lat1 + DY * i; } if (DY < 0) { Array.Reverse(Y); } break; } return(Y); }
/// <summary>Adds the specified numbers.</summary> /// <param name="numbers">The numbers.</param> /// <returns>The result of the operation.</returns> /// <exception cref="ArgumentNullException">When numbers is null.</exception> /// <exception cref="ArgumentException">When the length of numbers do not equal <see cref="ArgumentCount"/>.</exception> public object Add(object[] numbers) { //base.Validate(numbers); //double result = 0; //foreach (double n in numbers) // result += n; object result = DataMath.Add(numbers[0], numbers[1]); return(result); }
/// <summary> /// Get Y coordinate array of Gaussian grid /// </summary> /// <returns>Y coordinate array</returns> public double[] GetGaussYArray() { double[] Y = new double[NY]; Y = (double[])DataMath.Gauss2Lats(NY)[0]; //double ymin = Y[0]; //double ymax = Y[Y.Length - 1]; //double delta = (ymax - ymin) / (NY - 1); //for (int i = 0; i < NY; i++) // Y[i] = ymin + i * delta; return(Y); }
/// <summary>Divides the specified numbers.</summary> /// <param name="numbers">The numbers.</param> /// <returns>The result of the operation.</returns> /// <exception cref="ArgumentNullException">When numbers is null.</exception> /// <exception cref="ArgumentException">When the length of numbers do not equal <see cref="ArgumentCount"/>.</exception> public object Divide(object[] numbers) { //base.Validate(numbers); //double? result = null; //foreach (double n in numbers) // if (result.HasValue) // result /= n; // else // result = n; object result = DataMath.Divide(numbers[0], numbers[1]); return(result); }
/// <summary>Executes the function on specified numbers.</summary> /// <param name="numbers">The numbers used in the function.</param> /// <returns>The result of the function execution.</returns> /// <exception cref="ArgumentNullException">When numbers is null.</exception> /// <exception cref="ArgumentException">When the length of numbers do not equal <see cref="ArgumentCount"/>.</exception> public object Execute(object[] numbers) { base.Validate(numbers); string function = char.ToUpperInvariant(_function[0]) + _function.Substring(1); switch (function) { case "Abs": return(DataMath.Abs(numbers[0])); case "Acos": return(DataMath.Acos(numbers[0])); case "Asin": return(DataMath.Asin(numbers[0])); case "Atan": return(DataMath.Atan(numbers[0])); case "Cos": return(DataMath.Cos(numbers[0])); case "Exp": return(DataMath.Exp(numbers[0])); case "Log": return(DataMath.Log(numbers[0])); case "Log10": return(DataMath.Log10(numbers[0])); case "Sin": return(DataMath.Sin(numbers[0])); case "Sqrt": return(DataMath.Sqrt(numbers[0])); case "Tan": return(DataMath.Tan(numbers[0])); default: return(null); } }
/// <summary>Power for the specified numbers.</summary> /// <param name="numbers">The numbers.</param> /// <returns>The result of the operation.</returns> /// <exception cref="ArgumentNullException">When numbers is null.</exception> /// <exception cref="ArgumentException">When the length of numbers do not equal <see cref="ArgumentCount"/>.</exception> public object Power(object[] numbers) { base.Validate(numbers); return(DataMath.Pow(numbers[0], (double)numbers[1])); }