diff --git a/src/interpneighbors.jl b/src/interpneighbors.jl index 30aeb1d..bbfafd9 100644 --- a/src/interpneighbors.jl +++ b/src/interpneighbors.jl @@ -8,6 +8,10 @@ Interpolate geospatial data on given `domain` using geostatistical models `model₁`, ..., `modelₙ` for variables `vars₁`, ..., `varsₙ`. + InterpolateNeighbors(domain, model=IDW(); [parameters]) + +Interpolate geospatial data on given `domain` using geostatistical `model` for all variables. + Unlike [`Interpolate`](@ref), this transform uses neighbor search methods to fit geostatistical models at each interpolation location with a reduced number of measurements. @@ -69,7 +73,8 @@ InterpolateNeighbors( prob ) -InterpolateNeighbors(domain::Domain; kwargs...) = InterpolateNeighbors(domain, [AllSpec()], [IDW()]; kwargs...) +InterpolateNeighbors(domain::Domain, model::GeoStatsModel=IDW(); kwargs...) = + InterpolateNeighbors(domain, [AllSpec()], [model]; kwargs...) InterpolateNeighbors(domain::Domain, pairs::Pair{<:Any,<:GeoStatsModel}...; kwargs...) = InterpolateNeighbors(domain, colspec.(first.(pairs)), last.(pairs); kwargs...) diff --git a/src/interpolate.jl b/src/interpolate.jl index 8101617..a625f8d 100644 --- a/src/interpolate.jl +++ b/src/interpolate.jl @@ -8,6 +8,10 @@ Interpolate geospatial data on given `domain` using geostatistical models `model₁`, ..., `modelₙ` for variables `vars₁`, ..., `varsₙ`. + Interpolate(domain, model=IDW(); [parameters]) + +Interpolate geospatial data on given `domain` using geostatistical `model` for all variables. + ## Parameters * `point` - Perform interpolation on point support (default to `true`) @@ -26,7 +30,8 @@ end Interpolate(domain::Domain, colspecs, models; point=true, prob=false) = Interpolate(domain, collect(ColSpec, colspecs), collect(GeoStatsModel, models), point, prob) -Interpolate(domain::Domain; kwargs...) = Interpolate(domain, [AllSpec()], [IDW()]; kwargs...) +Interpolate(domain::Domain, model::GeoStatsModel=IDW(); kwargs...) = + Interpolate(domain, [AllSpec()], [model]; kwargs...) Interpolate(domain::Domain, pairs::Pair{<:Any,<:GeoStatsModel}...; kwargs...) = Interpolate(domain, colspec.(first.(pairs)), last.(pairs); kwargs...) diff --git a/test/interpneighbors.jl b/test/interpneighbors.jl index 822d9b7..599800e 100644 --- a/test/interpneighbors.jl +++ b/test/interpneighbors.jl @@ -3,7 +3,7 @@ pset = PointSet(rand(Point2, 3)) gtb = georef((a=[1, 2, 3], b=[4, 5, 6]), pset) - ngtb = gtb |> InterpolateNeighbors(pset, maxneighbors=3) + ngtb = gtb |> InterpolateNeighbors(pset, IDW(), maxneighbors=3) @test ngtb.a == gtb.a @test ngtb.b == gtb.b @test ngtb.geometry == pset diff --git a/test/interpolate.jl b/test/interpolate.jl index d85931b..aef0b70 100644 --- a/test/interpolate.jl +++ b/test/interpolate.jl @@ -3,7 +3,7 @@ pset = PointSet(rand(Point2, 3)) gtb = georef((a=[1, 2, 3], b=[4, 5, 6]), pset) - ngtb = gtb |> Interpolate(pset) + ngtb = gtb |> Interpolate(pset, IDW()) @test ngtb.a == gtb.a @test ngtb.b == gtb.b @test ngtb.geometry == pset