Skip to content

Commit

Permalink
Rename variotype to constructor (#16)
Browse files Browse the repository at this point in the history
* Rename 'variotype' to 'constructor'

* Update src/variogram.jl

---------

Co-authored-by: Júlio Hoffimann <[email protected]>
  • Loading branch information
eliascarv and juliohm authored Jun 26, 2024
1 parent e071cf4 commit c029148
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 16 deletions.
1 change: 0 additions & 1 deletion src/GeoStatsFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export
sill,
nugget,
metricball,
variotype,
isstationary,
isisotropic,
structures,
Expand Down
6 changes: 3 additions & 3 deletions src/variogram.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ A theoretical variogram model (e.g. Gaussian variogram).
abstract type Variogram end

"""
variotype(γ)
constructor(γ)
Return the type constructor of the variogram `γ`.
"""
function variotype end
function constructor end

"""
isstationary(γ)
Expand Down Expand Up @@ -65,7 +65,7 @@ Scale metric ball of variogram `γ` with strictly
positive scaling factor `s`.
"""
function scale::Variogram, s::Real)
V = variotype(γ)
V = constructor(γ)
V(s * metricball(γ); sill=sill(γ), nugget=nugget(γ))
end

Expand Down
2 changes: 1 addition & 1 deletion src/variogram/circular.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CircularVariogram(ball; sill=1.0, nugget=zero(typeof(sill))) = CircularVariogram

CircularVariogram(; range=1.0, sill=1.0, nugget=zero(typeof(sill))) = CircularVariogram(sill, nugget, MetricBall(range))

variotype(::CircularVariogram) = CircularVariogram
constructor(::CircularVariogram) = CircularVariogram

isstationary(::Type{<:CircularVariogram}) = true

Expand Down
2 changes: 1 addition & 1 deletion src/variogram/cubic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ CubicVariogram(ball; sill=1.0, nugget=zero(typeof(sill))) = CubicVariogram(sill,

CubicVariogram(; range=1.0, sill=1.0, nugget=zero(typeof(sill))) = CubicVariogram(sill, nugget, MetricBall(range))

variotype(::CubicVariogram) = CubicVariogram
constructor(::CubicVariogram) = CubicVariogram

isstationary(::Type{<:CubicVariogram}) = true

Expand Down
2 changes: 1 addition & 1 deletion src/variogram/exponential.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ExponentialVariogram(ball; sill=1.0, nugget=zero(typeof(sill))) = ExponentialVar
ExponentialVariogram(; range=1.0, sill=1.0, nugget=zero(typeof(sill))) =
ExponentialVariogram(sill, nugget, MetricBall(range))

variotype(::ExponentialVariogram) = ExponentialVariogram
constructor(::ExponentialVariogram) = ExponentialVariogram

isstationary(::Type{<:ExponentialVariogram}) = true

Expand Down
2 changes: 1 addition & 1 deletion src/variogram/gaussian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ GaussianVariogram(ball; sill=1.0, nugget=zero(typeof(sill))) = GaussianVariogram

GaussianVariogram(; range=1.0, sill=1.0, nugget=zero(typeof(sill))) = GaussianVariogram(sill, nugget, MetricBall(range))

variotype(::GaussianVariogram) = GaussianVariogram
constructor(::GaussianVariogram) = GaussianVariogram

isstationary(::Type{<:GaussianVariogram}) = true

Expand Down
2 changes: 1 addition & 1 deletion src/variogram/matern.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ MaternVariogram(ball; sill=1.0, nugget=zero(typeof(sill)), order=1.0) = MaternVa
MaternVariogram(; range=1.0, sill=1.0, nugget=zero(typeof(sill)), order=1.0) =
MaternVariogram(sill, nugget, order, MetricBall(range))

variotype(::MaternVariogram) = MaternVariogram
constructor(::MaternVariogram) = MaternVariogram

isstationary(::Type{<:MaternVariogram}) = true

Expand Down
2 changes: 1 addition & 1 deletion src/variogram/nugget.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ end

NuggetEffect(; nugget=1.0) = NuggetEffect(nugget)

variotype(::NuggetEffect) = NuggetEffect
constructor(::NuggetEffect) = NuggetEffect

isstationary(::Type{<:NuggetEffect}) = true

Expand Down
2 changes: 1 addition & 1 deletion src/variogram/pentaspherical.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ PentasphericalVariogram(ball; sill=1.0, nugget=zero(typeof(sill))) = Pentaspheri
PentasphericalVariogram(; range=1.0, sill=1.0, nugget=zero(typeof(sill))) =
PentasphericalVariogram(sill, nugget, MetricBall(range))

variotype(::PentasphericalVariogram) = PentasphericalVariogram
constructor(::PentasphericalVariogram) = PentasphericalVariogram

isstationary(::Type{<:PentasphericalVariogram}) = true

Expand Down
2 changes: 1 addition & 1 deletion src/variogram/power.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ end

PowerVariogram(; scaling=1.0, nugget=zero(typeof(scaling)), exponent=1.0) = PowerVariogram(scaling, nugget, exponent)

variotype(::PowerVariogram) = PowerVariogram
constructor(::PowerVariogram) = PowerVariogram

isstationary(::Type{<:PowerVariogram}) = false

Expand Down
2 changes: 1 addition & 1 deletion src/variogram/sinehole.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ SineHoleVariogram(ball; sill=1.0, nugget=zero(typeof(sill))) = SineHoleVariogram

SineHoleVariogram(; range=1.0, sill=1.0, nugget=zero(typeof(sill))) = SineHoleVariogram(sill, nugget, MetricBall(range))

variotype(::SineHoleVariogram) = SineHoleVariogram
constructor(::SineHoleVariogram) = SineHoleVariogram

isstationary(::Type{<:SineHoleVariogram}) = true

Expand Down
2 changes: 1 addition & 1 deletion src/variogram/spherical.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ SphericalVariogram(ball; sill=1.0, nugget=zero(typeof(sill))) = SphericalVariogr
SphericalVariogram(; range=1.0, sill=1.0, nugget=zero(typeof(sill))) =
SphericalVariogram(sill, nugget, MetricBall(range))

variotype(::SphericalVariogram) = SphericalVariogram
constructor(::SphericalVariogram) = SphericalVariogram

isstationary(::Type{<:SphericalVariogram}) = true

Expand Down
4 changes: 2 additions & 2 deletions test/variogram.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
@test size(Γ) == (3, 4)
@test all.> 0)

# variotype
# constructor
for γ in [
CircularVariogram(),
CubicVariogram(),
Expand All @@ -169,7 +169,7 @@
SineHoleVariogram(),
SphericalVariogram()
]
@test variotype(γ)() == γ
@test GeoStatsFunctions.constructor(γ)() == γ
end

# scale
Expand Down

0 comments on commit c029148

Please sign in to comment.