-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added Makie plotting extension. * Fixed GeoStats compat.. * Fix tests. * Some more fixes.. * Docs fix.
- Loading branch information
Showing
13 changed files
with
52 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
name = "GeoArrays" | ||
uuid = "2fb1d81b-e6a0-5fc5-82e6-8e06903437ab" | ||
authors = ["Maarten Pronk <[email protected]>"] | ||
version = "0.9.1" | ||
version = "0.9.2" | ||
|
||
|
||
[deps] | ||
ArchGDAL = "c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3" | ||
|
@@ -16,12 +17,13 @@ RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" | |
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" | ||
|
||
[weakdeps] | ||
GeoStatsBase = "323cb8eb-fbf6-51c0-afd0-f8fba70507b2" | ||
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" | ||
GeoStatsModels = "ad987403-13c5-47b5-afee-0a48f6ac4f12" | ||
GeoStatsTransforms = "725d9659-360f-4996-9c94-5f19c7e4a8a6" | ||
|
||
[extensions] | ||
GeoArraysMakieExt = "Makie" | ||
GeoArraysStatsExt = "GeoStatsBase" | ||
GeoArraysStatsExt = ["GeoStatsModels", "GeoStatsTransforms"] | ||
|
||
[compat] | ||
ArchGDAL = "0.7 - 0.9, 0.10" | ||
|
@@ -30,7 +32,8 @@ DataAPI = "1" | |
Extents = "0.1" | ||
GeoFormatTypes = "0.4" | ||
GeoInterface = "1" | ||
GeoStatsBase = "0.37 - 0.43" | ||
GeoStatsModels = "0.6" | ||
GeoStatsTransforms = "0.9" | ||
IterTools = "1" | ||
PrecompileTools = "1" | ||
RecipesBase = "0.7, 0.8, 1.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[deps] | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
GeoArrays = "2fb1d81b-e6a0-5fc5-82e6-8e06903437ab" | ||
GeoStatsBase = "323cb8eb-fbf6-51c0-afd0-f8fba70507b2" | ||
GeoStatsModels = "ad987403-13c5-47b5-afee-0a48f6ac4f12" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,25 @@ | ||
module GeoArraysStatsExt | ||
|
||
using GeoArrays, GeoStatsBase | ||
using GeoArrays, GeoStatsModels, GeoStatsTransforms | ||
|
||
""" | ||
fill!(ga::GeoArray, solver::EstimationSolver, band=1) | ||
fill!(ga::GeoArray, solver::GeoStatsModels.GeoStatsModel, band=1, kwargs...) | ||
Replace missing values in GeoArray `ga` using `solver` from the GeoStats ecosystem. | ||
""" | ||
function GeoArrays.fill!(ga::GeoArray, solver::T, band=1) where {T<:EstimationSolver} | ||
function GeoArrays.fill!(ga::GeoArray, solver::T, band=1; kwargs...) where {T<:GeoStatsModels.GeoStatsModel} | ||
GeoArrays.is_rotated(ga) && error("Can't interpolate rotated GeoArrays yet. Please make an issue.") | ||
|
||
data = @view ga.A[:, :, band] | ||
m = ismissing.(data) | ||
sum(m) == 0 && return ga | ||
cds = collect(coords(ga)) | ||
problemdata = GeoStatsBase.georef( | ||
(; band=@view data[.!m]), | ||
@view cds[.!m] | ||
) | ||
problem = EstimationProblem(problemdata, GeoStatsBase.PointSet(cds[m]), :band) | ||
solution = solve(problem, solver) | ||
any(ismissing, data) || return ga | ||
|
||
data[m] .= getproperty(solution, :band) | ||
domain = GeoStatsModels.CartesianGrid(size(ga)[1:2], Tuple(ga.f.translation), (abs(ga.f.linear[1]), abs(ga.f.linear[4]))) | ||
problemdata = GeoStatsModels.georef((; z=vec(data)), domain) | ||
interp = problemdata |> GeoStatsTransforms.InterpolateMissing(:z => solver; kwargs...) | ||
data .= reshape(getproperty(interp, :z), size(data)) | ||
ga | ||
end | ||
|
||
@deprecate interpolate!(ga::GeoArray, solver::T, band=1) where {T<:EstimationSolver} fill!(ga, solver, band) | ||
@deprecate interpolate!(ga::GeoArray, solver::T, band=1; kwargs...) where {T<:GeoStatsModels.GeoStatsModel} fill!(ga, solver, band; kwargs...) | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,29 @@ | ||
using StaticArrays | ||
using GeoStatsSolvers | ||
using GeoStatsTransforms | ||
using GeoStatsModels | ||
|
||
|
||
@testset "Interpolating rasters" begin | ||
@testset "Regular Grid interpolation" begin | ||
ga = GeoArray(Array{Union{Missing,Float64}}(rand(10, 10, 1)), GeoArrays.geotransform_to_affine(SVector(0.0, 1.0, 0.0, 0.0, 0.0, 1.0)), "") | ||
ga.A[2, 2, 1] = missing | ||
@test count(ismissing, ga.A) == 1 | ||
GeoArrays.fill!(ga, KrigingSolver()) | ||
GeoArrays.fill!(ga, IDW()) | ||
@test count(ismissing, ga.A) == 0 | ||
end | ||
@testset "Regular Grid interpolation with negative spacing" begin | ||
ga = GeoArray(Array{Union{Missing,Float64}}(rand(10, 10, 1)), GeoArrays.geotransform_to_affine(SVector(0.0, 1.0, 0.0, 0.0, 0.0, -1.0)), "") | ||
ga.A[2, 2, 1] = missing | ||
@test count(ismissing, ga.A) == 1 | ||
GeoArrays.fill!(ga, KrigingSolver()) | ||
@test count(ismissing, ga.A) == 0 | ||
end | ||
@testset "Irregular Grid interpolation" begin | ||
ga = GeoArray(Array{Union{Missing,Float64}}(rand(10, 10, 1)), GeoArrays.geotransform_to_affine(SVector(0.0, 1.0, 1.0, 0.0, 0.0, 1.0)), "") | ||
ga.A[2, 2, 1] = missing | ||
@test count(ismissing, ga.A) == 1 | ||
GeoArrays.fill!(ga, IDWSolver()) | ||
GeoArrays.fill!(ga, IDW()) | ||
@test count(ismissing, ga.A) == 0 | ||
end | ||
# TODO Currently broken | ||
# @testset "Irregular Grid interpolation" begin | ||
# ga = GeoArray(Array{Union{Missing,Float64}}(rand(10, 10, 1)), GeoArrays.geotransform_to_affine(SVector(0.0, 1.0, 1.0, 0.0, 0.0, 1.0)), "") | ||
# ga.A[2, 2, 1] = missing | ||
# @test count(ismissing, ga.A) == 1 | ||
# GeoArrays.fill!(ga, IDW(2), maxneighbors=5) | ||
# @test count(ismissing, ga.A) == 0 | ||
# end | ||
end |
8fe698c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
8fe698c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/121004
Tip: Release Notes
Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.
To add them here just re-invoke and the PR will be updated.
Tagging
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: