JuliaEarth / GeoStats.jl

An extensible framework for geospatial data science and geostatistical modeling fully written in Julia
https://juliaearth.github.io/GeoStatsDocs/stable/
MIT License
524 stars 63 forks source link

Gaussian Processes with Variogram vs Covariance #404

Closed markmbaum closed 7 months ago

markmbaum commented 8 months ago

I noticed that simulating random fields from a GaussianVariogram works but using a GaussianCovariance does not.

For example, after

using Meshes, GeoStatsFunctions, GeoStatsProcesses

The following works fine

field = rand(
    GaussianVariogram() |> GaussianProcess,
    CartesianGrid(10, 10),
    :x => Float64,
)

but using a Covariance does not

field = rand(
    GaussianCovariance() |> GaussianProcess,
    CartesianGrid(10, 10),
    :x => Float64,
)

and produces this error

ERROR: ArgumentError: Cannot construct range from arguments:
start = GaussianCovariance(sill: 1.0, nugget: 0.0, range: 1.0, distance: Euclidean)
step = nothing
stop = nothing
length = nothing
Try specifying more arguments.

This is with

  [aa102bde] GeoStatsProcesses v0.5.8
  [6771c435] GeoStatsFunctions v0.2.1
  [eacbb407] Meshes v0.40.12
juliohm commented 8 months ago

I can reproduce the issue. This is because the Covariance counterparts were added recently for convenience, but no one went ahead and added the necessary methods as in the Variogram types.

Would you like to add the missing methods in GeoStatsFunctions.jl?

markmbaum commented 8 months ago

Yes I can get to it, feel free to assign me.

I've been appreciating the Covariance types, by the way.

juliohm commented 8 months ago

Hi @markmbaum did you have a chance to take a look into this?

markmbaum commented 7 months ago

Yes sorry for the delay, planning to do it soon.