Skip to content

Commit 774a947

Browse files
committed
Updates for latest release
1 parent 8e9590b commit 774a947

File tree

5 files changed

+144
-136
lines changed

5 files changed

+144
-136
lines changed

10-correlation.qmd

Lines changed: 33 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,12 @@ p1 = GaussianProcess(GaussianVariogram(range=10.0))
217217
p2 = GaussianProcess(GaussianVariogram(range=30.0))
218218
219219
Random.seed!(2023)
220-
d1 = rand(p1, g, [:Z => Float64], LUMethod())
221-
d2 = rand(p2, g, [:Z => Float64], LUMethod())
220+
d1 = rand(p1, g)
221+
d2 = rand(p2, g)
222222
223223
fig = Mke.Figure()
224-
viz(fig[1,1], d1.geometry, color = d1.Z, axis = (; title="range: 10"))
225-
viz(fig[2,1], d2.geometry, color = d2.Z, axis = (; title="range: 30"))
224+
viz(fig[1,1], d1.geometry, color = d1.field, axis = (; title="range: 10"))
225+
viz(fig[2,1], d2.geometry, color = d2.field, axis = (; title="range: 30"))
226226
fig
227227
```
228228

@@ -243,14 +243,14 @@ p1 = GaussianProcess(GaussianVariogram(range=10.0, sill=1.0))
243243
p2 = GaussianProcess(GaussianVariogram(range=10.0, sill=9.0))
244244
245245
Random.seed!(2023)
246-
d1 = rand(p1, g, [:Z => Float64], LUMethod())
247-
d2 = rand(p2, g, [:Z => Float64], LUMethod())
246+
d1 = rand(p1, g)
247+
d2 = rand(p2, g)
248248
249249
f(x) = ustrip(first(to(centroid(x))))
250250
251251
fig = Mke.Figure()
252-
Mke.lines(fig[1,1], f.(d1.geometry), d1.Z, color = "black", axis = (; title="sill: 1"))
253-
Mke.lines(fig[2,1], f.(d2.geometry), d2.Z, color = "black", axis = (; title="sill: 9"))
252+
Mke.lines(fig[1,1], f.(d1.geometry), d1.field, color = "black", axis = (; title="sill: 1"))
253+
Mke.lines(fig[2,1], f.(d2.geometry), d2.field, color = "black", axis = (; title="sill: 9"))
254254
fig
255255
```
256256

@@ -273,14 +273,14 @@ p1 = GaussianProcess(GaussianVariogram(range=10.0, nugget=0.1))
273273
p2 = GaussianProcess(GaussianVariogram(range=10.0, nugget=0.2))
274274
275275
Random.seed!(2023)
276-
d1 = rand(p1, g, [:Z => Float64], LUMethod())
277-
d2 = rand(p2, g, [:Z => Float64], LUMethod())
276+
d1 = rand(p1, g)
277+
d2 = rand(p2, g)
278278
279279
f(x) = ustrip(first(to(centroid(x))))
280280
281281
fig = Mke.Figure()
282-
Mke.lines(fig[1,1], f.(d1.geometry), d1.Z, color = "black", axis = (; title="nugget: 0.1"))
283-
Mke.lines(fig[2,1], f.(d2.geometry), d2.Z, color = "black", axis = (; title="nugget: 0.2"))
282+
Mke.lines(fig[1,1], f.(d1.geometry), d1.field, color = "black", axis = (; title="nugget: 0.1"))
283+
Mke.lines(fig[2,1], f.(d2.geometry), d2.field, color = "black", axis = (; title="nugget: 0.2"))
284284
fig
285285
```
286286

@@ -294,13 +294,13 @@ p1 = GaussianProcess(GaussianVariogram(range=10.0, nugget=0.0))
294294
p2 = GaussianProcess(GaussianVariogram(range=10.0, nugget=0.1))
295295
296296
Random.seed!(2023)
297-
d1 = rand(p1, g, [:Z => Float64], LUMethod())
297+
d1 = rand(p1, g)
298298
Random.seed!(2023)
299-
d2 = rand(p2, g, [:Z => Float64], LUMethod())
299+
d2 = rand(p2, g)
300300
301301
fig = Mke.Figure()
302-
viz(fig[1,1], d1.geometry, color = d1.Z, axis = (; title="nugget: 0.0"))
303-
viz(fig[2,1], d2.geometry, color = d2.Z, axis = (; title="nugget: 0.1"))
302+
viz(fig[1,1], d1.geometry, color = d1.field, axis = (; title="nugget: 0.0"))
303+
viz(fig[2,1], d2.geometry, color = d2.field, axis = (; title="nugget: 0.1"))
304304
fig
305305
```
306306

@@ -325,13 +325,9 @@ geospatial correlation. The most widely used are the `GaussianVariogram`, the
325325
γ2 = SphericalVariogram()
326326
γ3 = ExponentialVariogram()
327327
328-
fig = Mke.Figure()
329-
Mke.Axis(fig[1,1])
330-
varioplot!(γ1, maxlag=2.0, color = "teal", label = "Gaussian")
331-
varioplot!(γ2, maxlag=2.0, color = "slategray3", label = "Spherical")
332-
varioplot!(γ3, maxlag=2.0, color = "brown", label = "Exponential")
333-
Mke.axislegend("Model", position = :rb)
334-
fig
328+
fig = funplot(γ1, maxlag=2.0, color = "teal")
329+
funplot!(fig, γ2, maxlag=2.0, color = "slategray3")
330+
funplot!(fig, γ3, maxlag=2.0, color = "brown")
335331
```
336332

337333
The faster is the increase of the function near the origin, the more "erratic" is the process:
@@ -345,14 +341,14 @@ p2 = GaussianProcess(SphericalVariogram(range=10.0))
345341
p3 = GaussianProcess(ExponentialVariogram(range=10.0))
346342
347343
Random.seed!(2023)
348-
d1 = rand(p1, g, [:Z => Float64], LUMethod())
349-
d2 = rand(p2, g, [:Z => Float64], LUMethod())
350-
d3 = rand(p3, g, [:Z => Float64], LUMethod())
344+
d1 = rand(p1, g)
345+
d2 = rand(p2, g)
346+
d3 = rand(p3, g)
351347
352348
fig = Mke.Figure()
353-
viz(fig[1,1], d1.geometry, color = d1.Z, axis = (; title="model: Gaussian"))
354-
viz(fig[2,1], d2.geometry, color = d2.Z, axis = (; title="model: Spherical"))
355-
viz(fig[3,1], d3.geometry, color = d3.Z, axis = (; title="model: Exponential"))
349+
viz(fig[1,1], d1.geometry, color = d1.field, axis = (; title="model: Gaussian"))
350+
viz(fig[2,1], d2.geometry, color = d2.field, axis = (; title="model: Spherical"))
351+
viz(fig[3,1], d3.geometry, color = d3.field, axis = (; title="model: Exponential"))
356352
fig
357353
```
358354

@@ -419,7 +415,7 @@ g = EmpiricalVariogram(img, :Z, maxlag = 50.0)
419415
```
420416

421417
```{julia}
422-
varioplot(g)
418+
funplot(g)
423419
```
424420

425421
::: {.callout-note}
@@ -437,27 +433,26 @@ specific directions:
437433
gₕ = DirectionalVariogram((1.0, 0.0), img, :Z, maxlag = 50.0)
438434
gᵥ = DirectionalVariogram((0.0, 1.0), img, :Z, maxlag = 50.0)
439435
440-
varioplot(gₕ, showhist = false, color = "maroon")
441-
varioplot!(gᵥ, showhist = false, color = "slategray")
442-
Mke.current_figure()
436+
fig = funplot(gₕ, showhist = false, color = "maroon")
437+
funplot!(fig, gᵥ, showhist = false, color = "slategray")
443438
```
444439

445440
In this example, we observe that the blobs are elongated with a horizontal
446441
range of 30 pixels and a vertical range of 10 pixels. This is known as
447442
geometric **anisotropy**.
448443

449444
We can also estimate the variogram in all directions on a plane with the
450-
`EmpiricalVarioplane`:
445+
`EmpiricalVariogramSurface`:
451446

452447
```{julia}
453-
gₚ = EmpiricalVarioplane(img, :Z, maxlag = 50.0)
448+
gₚ = EmpiricalVariogramSurface(img, :Z, maxlag = 50.0)
454449
```
455450

456-
The varioplane is usually plotted on a polar axis to highlight the different
457-
ranges as a function of the polar angle:
451+
The variogram surface is usually plotted on a polar axis to highlight the
452+
different ranges as a function of the polar angle:
458453

459454
```{julia}
460-
planeplot(gₚ)
455+
surfplot(gₚ)
461456
```
462457

463458
::: {.callout-note}

11-interpolation.qmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ g = EmpiricalVariogram(samples, "Z", maxlag = 100.0)
230230
```
231231

232232
```{julia}
233-
varioplot(g)
233+
funplot(g)
234234
```
235235

236236
A better alternative in this case is to use the robust `:cressie`
@@ -241,7 +241,7 @@ g = EmpiricalVariogram(samples, "Z", maxlag = 100.0, estimator = :cressie)
241241
```
242242

243243
```{julia}
244-
varioplot(g)
244+
funplot(g)
245245
```
246246

247247
After estimating the empirical variogram, the next step consists of fitting
@@ -252,7 +252,7 @@ a theoretical model. The behavior near the origin resembles a `SphericalVariogra
252252
```
253253

254254
```{julia}
255-
varioplot(γ, maxlag = 100.0)
255+
funplot(γ, maxlag = 100.0)
256256
```
257257

258258
Now that we extracted the geospatial correlation from the samples, we can

12-mining.qmd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,10 @@ square.
328328

329329
```{julia}
330330
function gammaplot(n, g, γ)
331-
varioplot(g, axis = (; title = n))
332-
varioplot!(γ, maxlag = maxlag, color = "teal")
333-
Mke.current_figure()
331+
fig = Mke.Figure()
332+
Mke.Axis(fig[1,1], title = n)
333+
funplot!(fig, g, maxlag = maxlag)
334+
funplot!(fig, γ, maxlag = maxlag)
334335
end
335336
336337
gammaplot(vs[1], gs[1], γs[1])

0 commit comments

Comments
 (0)