Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
juliohm committed Oct 24, 2024
2 parents 4792f49 + f96d9dc commit 4847e25
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GeoStatsFunctions"
uuid = "6771c435-bc22-4842-b0c3-41852a255103"
authors = ["Júlio Hoffimann <[email protected]> and contributors"]
version = "0.5.4"
version = "0.5.5"

[deps]
Bessels = "0e736298-9ec6-45e8-9647-e4fc86a2fe38"
Expand Down
1 change: 1 addition & 0 deletions src/theoretical/variogram/circular.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ struct CircularVariogram{V,B} <: Variogram
sill::V
nugget::V
ball::B
CircularVariogram(sill::V, nugget::V, ball::B) where {V,B} = new{float(V),B}(sill, nugget, ball)
end

CircularVariogram(ball; sill=1.0, nugget=zero(typeof(sill))) = CircularVariogram(sill, nugget, ball)
Expand Down
1 change: 1 addition & 0 deletions src/theoretical/variogram/cubic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct CubicVariogram{V,B} <: Variogram
sill::V
nugget::V
ball::B
CubicVariogram(sill::V, nugget::V, ball::B) where {V,B} = new{float(V),B}(sill, nugget, ball)
end

CubicVariogram(ball; sill=1.0, nugget=zero(typeof(sill))) = CubicVariogram(sill, nugget, ball)
Expand Down
1 change: 1 addition & 0 deletions src/theoretical/variogram/exponential.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct ExponentialVariogram{V,B} <: Variogram
sill::V
nugget::V
ball::B
ExponentialVariogram(sill::V, nugget::V, ball::B) where {V,B} = new{float(V),B}(sill, nugget, ball)
end

ExponentialVariogram(ball; sill=1.0, nugget=zero(typeof(sill))) = ExponentialVariogram(sill, nugget, ball)
Expand Down
1 change: 1 addition & 0 deletions src/theoretical/variogram/gaussian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct GaussianVariogram{V,B} <: Variogram
sill::V
nugget::V
ball::B
GaussianVariogram(sill::V, nugget::V, ball::B) where {V,B} = new{float(V),B}(sill, nugget, ball)
end

GaussianVariogram(ball; sill=1.0, nugget=zero(typeof(sill))) = GaussianVariogram(sill, nugget, ball)
Expand Down
2 changes: 2 additions & 0 deletions src/theoretical/variogram/matern.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ struct MaternVariogram{V,O,B} <: Variogram
nugget::V
order::O
ball::B
MaternVariogram(sill::V, nugget::V, order::O, ball::B) where {V,O,B} =
new{float(V),float(O),B}(sill, nugget, order, ball)
end

MaternVariogram(ball; sill=1.0, nugget=zero(typeof(sill)), order=1.0) = MaternVariogram(sill, nugget, order, ball)
Expand Down
1 change: 1 addition & 0 deletions src/theoretical/variogram/nugget.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ A pure nugget effect variogram with nugget `n`.
"""
struct NuggetEffect{V} <: Variogram
nugget::V
NuggetEffect(nugget::V) where {V} = new{float(V)}(nugget)
end

NuggetEffect(; nugget=1.0) = NuggetEffect(nugget)
Expand Down
1 change: 1 addition & 0 deletions src/theoretical/variogram/pentaspherical.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct PentasphericalVariogram{V,B} <: Variogram
sill::V
nugget::V
ball::B
PentasphericalVariogram(sill::V, nugget::V, ball::B) where {V,B} = new{float(V),B}(sill, nugget, ball)
end

PentasphericalVariogram(ball; sill=1.0, nugget=zero(typeof(sill))) = PentasphericalVariogram(sill, nugget, ball)
Expand Down
1 change: 1 addition & 0 deletions src/theoretical/variogram/power.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ struct PowerVariogram{V,E} <: Variogram
scaling::V
nugget::V
exponent::E
PowerVariogram(scaling::V, nugget::V, exponent::E) where {V,E} = new{float(V),float(E)}(scaling, nugget, exponent)
end

PowerVariogram(; scaling=1.0, nugget=zero(typeof(scaling)), exponent=1.0) = PowerVariogram(scaling, nugget, exponent)
Expand Down
1 change: 1 addition & 0 deletions src/theoretical/variogram/sinehole.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct SineHoleVariogram{V,B} <: Variogram
sill::V
nugget::V
ball::B
SineHoleVariogram(sill::V, nugget::V, ball::B) where {V,B} = new{float(V),B}(sill, nugget, ball)
end

SineHoleVariogram(ball; sill=1.0, nugget=zero(typeof(sill))) = SineHoleVariogram(sill, nugget, ball)
Expand Down
1 change: 1 addition & 0 deletions src/theoretical/variogram/spherical.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct SphericalVariogram{V,B} <: Variogram
sill::V
nugget::V
ball::B
SphericalVariogram(sill::V, nugget::V, ball::B) where {V,B} = new{float(V),B}(sill, nugget, ball)
end

SphericalVariogram(ball; sill=1.0, nugget=zero(typeof(sill))) = SphericalVariogram(sill, nugget, ball)
Expand Down
33 changes: 33 additions & 0 deletions test/theoretical/variogram.jl
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,39 @@
g = GeoStatsFunctions.scale(γ, 2)
@test g == γ

# convert parameters to float
γ = CircularVariogram(sill=1, nugget=1)
@test sill(γ) isa Float64
@test nugget(γ) isa Float64
γ = CubicVariogram(sill=1, nugget=1)
@test sill(γ) isa Float64
@test nugget(γ) isa Float64
γ = ExponentialVariogram(sill=1, nugget=1)
@test sill(γ) isa Float64
@test nugget(γ) isa Float64
γ = GaussianVariogram(sill=1, nugget=1)
@test sill(γ) isa Float64
@test nugget(γ) isa Float64
γ = MaternVariogram(sill=1, nugget=1, order=1)
@test sill(γ) isa Float64
@test nugget(γ) isa Float64
@test γ.order isa Float64
γ = NuggetEffect(nugget=1)
@test nugget(γ) isa Float64
γ = PentasphericalVariogram(sill=1, nugget=1)
@test sill(γ) isa Float64
@test nugget(γ) isa Float64
γ = PowerVariogram(scaling=1, nugget=1, exponent=1)
@test γ.scaling isa Float64
@test nugget(γ) isa Float64
@test γ.exponent isa Float64
γ = SineHoleVariogram(sill=1, nugget=1)
@test sill(γ) isa Float64
@test nugget(γ) isa Float64
γ = SphericalVariogram(sill=1, nugget=1)
@test sill(γ) isa Float64
@test nugget(γ) isa Float64

# shows
γ = CircularVariogram()
@test sprint(show, γ) == "CircularVariogram(sill: 1.0, nugget: 0.0, range: 1.0 m, distance: Euclidean)"
Expand Down

0 comments on commit 4847e25

Please sign in to comment.