Commit 1756399c authored by Purves, Murray's avatar Purves, Murray
Browse files

Changed order of arguments in interpolate

parent db518f84
......@@ -8,8 +8,8 @@ namespace radix
{
std::vector<float> interpolateValues(
const std::vector<float> &baseValues,
const std::vector<float> &valuesToInterpolate, float missingValue,
bool circular)
const std::vector<float> &valuesToInterpolate, bool circular,
float missingValue)
{
std::vector<float> interpolatedValues = valuesToInterpolate;
......@@ -132,6 +132,15 @@ std::vector<float> interpolateValues(
}
}
// Write out initial values
radix_line("Interpolation complete. Final values:");
radix(" ");
for (float f : interpolatedValues)
{
radix(f << " ");
}
radix_line("");
return interpolatedValues;
}
......
......@@ -14,7 +14,7 @@ namespace radix
std::vector<float> RADIX_PUBLIC
interpolateValues(const std::vector<float> &baseValues,
const std::vector<float> &valuesToInterpolate,
float missingValue = -9999.f, bool circular = false);
bool circular = false, float missingValue = -9999.f);
} // namespace radix
......
......@@ -42,7 +42,7 @@ TEST(Interpolate, InternalInterpolation)
std::vector<float> interpValues3{16.f, missingValue, missingValue, 2.f};
std::vector<float> expectValues3{16.f, 8.f, 4.f, 2.f};
std::vector<float> testValues3 =
interpolateValues(baseValues3, interpValues3, missingValue);
interpolateValues(baseValues3, interpValues3, false, missingValue);
ASSERT_EQ(expectValues3.size(), testValues3.size());
for (int i = 0; i < testValues3.size(); ++i)
{
......@@ -60,7 +60,7 @@ TEST(Interpolate, CircularInterpolation)
350.f, missingValue, 30.f};
std::vector<float> expectValues1{90.f, 180.f, 270.f, 350.f, 10.f, 30.f};
std::vector<float> testValues1 =
interpolateValues(baseValues1, interpValues1, missingValue, true);
interpolateValues(baseValues1, interpValues1, true, missingValue);
ASSERT_EQ(expectValues1.size(), testValues1.size());
for (int i = 0; i < testValues1.size(); ++i)
{
......@@ -77,7 +77,7 @@ TEST(Interpolate, FillInBeginning)
std::vector<float> interpValues1{missingValue, missingValue, 103.23, 200.2};
std::vector<float> expectValues1{103.23, 103.23, 103.23, 200.2};
std::vector<float> testValues1 =
interpolateValues(baseValues1, interpValues1, missingValue, true);
interpolateValues(baseValues1, interpValues1);
ASSERT_EQ(expectValues1.size(), testValues1.size());
for (int i = 0; i < testValues1.size(); ++i)
{
......@@ -94,7 +94,7 @@ TEST(Interpolate, FillInEnd)
std::vector<float> interpValues1{103.23, 200.2, missingValue, missingValue};
std::vector<float> expectValues1{103.23, 200.2, 200.2, 200.2};
std::vector<float> testValues1 =
interpolateValues(baseValues1, interpValues1, missingValue, true);
interpolateValues(baseValues1, interpValues1);
ASSERT_EQ(expectValues1.size(), testValues1.size());
for (int i = 0; i < testValues1.size(); ++i)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment