# \[ANN\] GeoStats.jl v0.18

**URL:** <https://discourse.julialang.org/t/ann-geostats-jl-v0-18/48951>\
**Category:** Package Announcements\
**Tags:** package, announcement, statistics, geo, geostatistics\
**Created:** [October 24, 2020, 8:16pm UTC](https://discourse.julialang.org/t/ann-geostats-jl-v0-18/48951 "2020-10-24T20:16:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [October 24, 2020, 8:16pm UTC](https://discourse.julialang.org/t/ann-geostats-jl-v0-18/48951/1 "2020-10-24T20:16:34Z")

</div>

[GeoStats.jl v0.18](https://github.com/JuliaEarth/GeoStats.jl) includes better support for nested spatial correlation and geometric anisotropy.

Given spatial correlation functions, a nested correlation can be obtained via a linear model:

```julia
julia> γ₁ = GaussianVariogram(range=2.0, sill=3.0)
GaussianVariogram{Float64,Distances.Euclidean}
  range: Float64 2.0
  sill: Float64 3.0
  nugget: Float64 0.0
  distance: Distances.Euclidean

julia> γ₂ = ExponentialVariogram()
ExponentialVariogram{Float64,Distances.Euclidean}
  range: Float64 1.0
  sill: Float64 1.0
  nugget: Float64 0.0
  distance: Distances.Euclidean

julia> γ₁ + 2γ₂
NestedVariogram{2}
  structures
    └─GaussianVariogram(range=2.0, sill=3.0, nugget=0.0)
    └─ExponentialVariogram(range=1.0, sill=1.0, nugget=0.0)
  coefficients
    └─1
    └─2

```

In the multivariate case, the coefficients can be matrices, thus producing a linear model of coregionalization (LMC):

```julia
julia> [1.0 0.5; 0.5 2.0] * γ₁ + [3.0 0.1; 0.1 3.0] * γ₂
NestedVariogram{2}
  structures
    └─GaussianVariogram(range=2.0, sill=3.0, nugget=0.0)
    └─ExponentialVariogram(range=1.0, sill=1.0, nugget=0.0)
  coefficients
    └─[1.0 0.5; 0.5 2.0]
    └─[3.0 0.1; 0.1 3.0]

```

Geometric anisotropy can be produced with the `aniso2distance` helper function, which now includes the rotation conventions of major commercial software (e.g. Datamine, Leapfrog):

```julia
help?> aniso2distance
search: aniso2distance

  aniso2distance(semiaxes, angles; convention=:TaitBryanExtr)

  A distance defined by an ellipsoid with given semiaxes and rotation angles.

    • For 2D ellipsoids, there are two semiaxes and one rotation angle.

    • For 3D ellipsoids, there are three semiaxes and three rotation angles.

  Conventions
  =============

  Different rotation conventions can be passed via the convention option:

    • :TaitBryanExtr => Extrinsic right-handed rotation by the ZXY axes

    • :TaitBryanIntr => Intrinsic right-handed rotation by the ZXY axes

    • :EulerExtr => Extrinsic right-handed rotation by the ZXZ axes

    • :EulerIntr => Intrinsic right-handed rotation by the ZXZ axes

    • :GSLIB => GSLIB software rotation convention

    • :Leapfrog => LeapFrog software rotation convention

    • :Datamine => Datamine software rotation convention (fixed to ZXZ axes)

  Tait-Bryan and Euler conventions expect angles in radians. The other conventions expect them in degrees.

  Default convention is :TaitBryanExtr.

  Examples
  ==========

  2D ellipsoid making 45ᵒ with the horizontal axis:

  julia> aniso2distance([1.0,0.5], [π/2])

  3D ellipsoid rotated by 45ᵒ in the xy plane:

  julia> aniso2distance([1.0,0.5,0.5], [π/2,0.0,0.0])

```
