Comments (1)
Hi @mingtaojia, thank you for reporting the issue.
Recently I have migrated all the distances defined in GeoStats.jl to the package Distances.jl. There is a delay, however; in this final pull request for the Ellipsoidal distance: JuliaStats/Distances.jl#81. That is my fault, I need to find time to finish it.
I will release a hot fix soon introducing the distance back again in GeoStats.jl. Meanwhile, if you need to keep going with your work, you can copy the code below in your session to define the distance locally:
using Distances
struct Ellipsoidal{N,T} <: Metric
dist::Mahalanobis{T}
function Ellipsoidal{N,T}(semiaxes, angles) where {N,T<:Real}
@assert length(semiaxes) == N "number of semiaxes must match spatial dimension"
@assert all(semiaxes .> zero(T)) "semiaxes must be positive"
@assert N ∈ [2,3] "dimension must be either 2 or 3"
# scaling matrix
Λ = spdiagm(one(T)./semiaxes.^2)
# rotation matrix
if N == 2
θ = angles[1]
cosθ = cos(θ)
sinθ = sin(θ)
P = [cosθ -sinθ
sinθ cosθ]
end
if N == 3
θxy, θyz, θzx = angles
cosxy = cos(θxy)
sinxy = sin(θxy)
cosyz = cos(θyz)
sinyz = sin(θyz)
coszx = cos(θzx)
sinzx = sin(θzx)
_1 = one(T)
_0 = zero(T)
Rxy = [cosxy -sinxy _0
sinxy cosxy _0
_0 _0 _1]
Ryz = [_1 _0 _0
_0 cosyz -sinyz
_0 sinyz cosyz]
Rzx = [ coszx _0 sinzx
_0 _1 _0
-sinzx _0 coszx]
P = Rzx*Ryz*Rxy
end
# ellipsoid matrix
Q = P*Λ*P'
new(Mahalanobis(Q))
end
end
Ellipsoidal(semiaxes::AbstractVector{T}, angles::AbstractVector{T}) where {T<:Real} =
Ellipsoidal{length(semiaxes),T}(semiaxes, angles)
result_type(::Ellipsoidal{N,T}, ::AbstractArray, ::AbstractArray) where {N,T} = T
function evaluate(dist::Ellipsoidal{N,T}, a::AbstractVector, b::AbstractVector) where {N,T<:Real}
evaluate(dist.dist, a, b)
end
ellipsoidal(a::AbstractVector, b::AbstractVector,
semiaxes::AbstractVector, angles::AbstractVector) = evaluate(Ellipsoidal(semiaxes, angles), a, b)
After the code is pasted in your Julia session, you can proceed with the script as usual.
from geostats.jl.
Related Issues (20)
- Multi-output / Multi-task Processes HOT 3
- Add option in `geojoin` to also match by additional columns HOT 1
- Consider the usage of multi-threading in `geojoin` HOT 1
- Refactor `parent` of `AbstractGeoTable` to fill missing values
- Add `Rotate(theta)` for 2D rotation
- Improve show of `TransformedGrid`
- Add viz recipe for `Vec` and `Ray`
- Covariance types from Variogram
- Add `geotable.geometry = geometry` syntax to set domain HOT 1
- Rename `Strecth` to `Scale` HOT 1
- Documentation Versioning HOT 2
- Fix `show` of very large `GeoTable` HOT 1
- Observable transform pipelines HOT 1
- Add support for `geotable[bools, cols]` HOT 1
- Allow other Kriging variants in sequential Gaussian simulation
- Online generation of large realizations
- Gaussian Processes with Variogram vs Covariance HOT 4
- pairwise! with Covariance types
- Add `Aggregate` transform HOT 1
- missing "(" , ")" in 8.4 Applying expressions HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geostats.jl.