-
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.
Move GeoStatsBase into an ext. (#153)
- Loading branch information
Showing
7 changed files
with
55 additions
and
26 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,16 @@ | ||
name = "GeoArrays" | ||
uuid = "2fb1d81b-e6a0-5fc5-82e6-8e06903437ab" | ||
authors = ["Maarten Pronk <[email protected]>"] | ||
version = "0.8.4" | ||
version = "0.8.5" | ||
|
||
[weakdeps] | ||
GeoStatsBase = "323cb8eb-fbf6-51c0-afd0-f8fba70507b2" | ||
|
||
[extensions] | ||
# name of extension to the left | ||
# extension dependencies required to load the extension to the right | ||
# use a list for multiple extension dependencies | ||
GeoArraysStatsExt = "GeoStatsBase" | ||
|
||
[deps] | ||
ArchGDAL = "c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3" | ||
|
@@ -10,7 +19,6 @@ DataAPI = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" | |
Extents = "411431e0-e8b7-467b-b5e0-f676ba4f2910" | ||
GeoFormatTypes = "68eda718-8dee-11e9-39e7-89f7f65f511f" | ||
GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f" | ||
GeoStatsBase = "323cb8eb-fbf6-51c0-afd0-f8fba70507b2" | ||
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e" | ||
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" | ||
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" | ||
|
@@ -23,7 +31,7 @@ DataAPI = "1" | |
Extents = "0.1" | ||
GeoFormatTypes = "0.4" | ||
GeoInterface = "1" | ||
GeoStatsBase = "0.37, 0.38, 0.39" | ||
GeoStatsBase = "0.37 - 0.43" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
[deps] | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
GeoArrays = "2fb1d81b-e6a0-5fc5-82e6-8e06903437ab" | ||
GeoStatsBase = "323cb8eb-fbf6-51c0-afd0-f8fba70507b2" |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module GeoArraysStatsExt | ||
|
||
using GeoArrays, GeoStatsBase | ||
|
||
""" | ||
fill!(ga::GeoArray, solver::EstimationSolver, band=1) | ||
Replace missing values in GeoArray `ga` using `solver` from the GeoStats ecosystem. | ||
""" | ||
function GeoArrays.fill!(ga::GeoArray, solver::T, band=1) where {T<:EstimationSolver} | ||
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) | ||
|
||
data[m] .= getproperty(solution, :band) | ||
ga | ||
end | ||
|
||
@deprecate interpolate!(ga::GeoArray, solver::T, band=1) where {T<:EstimationSolver} fill!(ga, solver, band) | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,8 @@ | ||
using GeoStatsBase | ||
|
||
""" | ||
fill!(ga::GeoArray, solver::EstimationSolver, band=1) | ||
fill!(ga::GeoArray, solver, band=1) | ||
Replace missing values in GeoArray `ga` using `solver` from the GeoStats ecosystem. | ||
Replace missing values in GeoArray `ga` using `solver`. | ||
""" | ||
function fill!(ga::GeoArray, solver::T, band=1) where {T<:EstimationSolver} | ||
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) | ||
|
||
data[m] .= getproperty(solution, :band) | ||
ga | ||
function fill!(::GeoArray, solver, band) | ||
error("fill! using $solver is not implemented yet. Please use an `EstimationSolver` from the GeoStats.jl ecosystem.") | ||
end | ||
|
||
@deprecate interpolate!(ga::GeoArray, solver::T, band=1) where {T<:EstimationSolver} fill!(ga, solver, band) |
124e220
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
124e220
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/98404
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: