Skip to content

Commit

Permalink
Do not default power in the constructor, also return default to 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
chambbj committed Sep 3, 2019
1 parent f722b8f commit 3572de2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
7 changes: 1 addition & 6 deletions doc/stages/writers.gdal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,7 @@ radius

power
Exponent of the distance when computing IDW. Close points have higher
significance than far points. [Default: 2.0]

.. note::
Power is a newly added, optional argument, only used when computing
IDW. The default value of 2.0 represents a change from the previous
implementation, in which the power would have always been 1.0.
significance than far points. [Default: 1.0]

gdaldriver
GDAL code of the `GDAL driver`_ to use to write the output.
Expand Down
2 changes: 1 addition & 1 deletion io/GDALWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void GDALWriter::addArgs(ProgramArgs& args)
m_radiusArg = &args.add("radius", "Radius from cell center to use to locate"
" influencing points", m_radius);
args.add("power", "Power parameter for weighting points when using IDW",
m_power, 2.0);
m_power, 1.0);
args.add("gdaldriver", "GDAL writer driver name", m_drivername, "GTiff");
args.add("gdalopts", "GDAL driver options (name=value,name=value...)",
m_options);
Expand Down
2 changes: 1 addition & 1 deletion io/private/GDALGrid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class GDALGrid

// Exported for testing.
PDAL_DLL GDALGrid(size_t width, size_t height,
double edgeLength, double radius, int outputTypes, size_t windowSize, double power=2.0);
double edgeLength, double radius, int outputTypes, size_t windowSize, double power);

void expand(size_t width, size_t height, size_t xshift, size_t yshift);

Expand Down
5 changes: 1 addition & 4 deletions test/unit/io/GDALWriterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ TEST(GDALWriterTest, idw)
wo.add("output_type", "idw");
wo.add("resolution", 1);
wo.add("radius", .7071);
wo.add("power", 1);
wo.add("filename", outfile);

const std::string output =
Expand All @@ -392,7 +391,6 @@ TEST(GDALWriterTest, idwWindow)
wo.add("output_type", "idw");
wo.add("resolution", 1);
wo.add("radius", .7071);
wo.add("power", 1);
wo.add("filename", outfile);
wo.add("window_size", 2);

Expand Down Expand Up @@ -742,7 +740,7 @@ TEST(GDALWriterTest, issue_2074)

TEST(GDALWriterTest, issue_2095)
{
GDALGrid grid(5, 5, 1, .7, GDALGrid::statCount | GDALGrid::statMin, 0);
GDALGrid grid(5, 5, 1, .7, GDALGrid::statCount | GDALGrid::statMin, 0, 1.0);

EXPECT_EQ(grid.verticalIndex(0), 4);
EXPECT_EQ(grid.verticalIndex(.5), 4);
Expand All @@ -767,7 +765,6 @@ TEST(GDALWriterTest, issue_2545)
Options wOpts;
wOpts.add("resolution", 1);
wOpts.add("radius", 10);
wOpts.add("power", 1);
wOpts.add("output_type", "idw");
wOpts.add("gdaldriver", "GTiff");
wOpts.add("origin_x", .5);
Expand Down

0 comments on commit 3572de2

Please sign in to comment.