Conversation
|
This is great! I love it. I wanted this for a long time but never found the time to work on it. I have some general questions/remarks:
import gstools as gs
correlo_model = gs.MarkovModel1(
model=gs.Gaussian(dim=1, var=0.5, len_scale=2),
cross_corr=0.8,
secondary_var=1.5,
)
scck = gs.SimpleCollocated(
correlo_model, cond_pos, cond_val,
mean=1.0, secondary_mean=0.5
)Maybe the means could be combined in a list then, or we could also move them into the MarkovModel1 (not sure what makes more sense here), or keep them as is.
|
|
1: I'm not sure if this will work very well with the approach I chose. As you maybe have seen, after some linear algebra reformulations of the problem, SCCK and ICCK can be shown as an extension to simple Kriging, making it not necessary to construct new matrices, that would need to be solved for every estimation point in collocated cokriging. That is also where the normalizer goes currently., it applies in the way it would apply for Simple Kriging. |
|
Hi, I also really like your work, thanks a lot! I suggest that we have a chat about @MuellerSeb's suggestions. The Correlogram base class he is talking about would ensure that we can later add more cokriging methods without breaking the interface. The source checks fail. You have to run a linter on your code, see the instructions at the end of this file. I also think that cokriging is missing after line 148 of Depending on the time you still have for this work, I think an example with 2d data would be really valuable, as I guess most applications will be 2d and many of our users like to have very specific examples. |
|
Hi, |
|
I think there are no import problems, the linter is just too stupid. from gstools import ( # noqa: I001put |
|
I tried to trace the circular import error and it occurs because krige needs field, it then initializes field with the submodule cond_srf and this needs again krige. I still don't understand why this doesn't happened before. |
This PR adds collocated cokriging methods to GSTools for multivariate geostatistical estimation, allowing users to improve sparse primary variable estimates by leveraging densely-sampled secondary variable data.
Collocated Cokriging Features
Krigebase class for full API compatibilityC_YZ(h) = ρ_YZ(0)·√(C_Z(h)·C_Y(h))gstools.cokrigingsubmodule or top-level:from gstools import SimpleCollocated, IntrinsicCollocatedreturn_var=Truecross_corr ∈ [-1, 1],secondary_var > 0ρ=0recovers Simple Kriging,ρ=±1gives zero ICCK varianceSimple Collocated Cokriging
Uses only collocated secondary data at the estimation point:
Intrinsic Collocated Cokriging
Uses collocated secondary data plus secondary values at all primary locations for more stable variance:
Implementation Details
gstools.cokrigingsubmodule with base class and methodsCollocatedCokrigingbase class handles MM1 formulation and variance computationSimpleCollocatedimplements SCCK estimator:Z*_SCCK = Z*_SK·(1-k·λ_Y0) + λ_Y0·(Y(u0)-m_Y) + k·λ_Y0·m_ZIntrinsicCollocatedimplements ICCK estimator using secondary weightssecondary_dataparameter on callC_YZ(0) = ρ_YZ(0)·√(C_Z(0)·C_Y(0))Krigefunctionality: grids, models, dimensions, anisotropy, drift, normalizersTests
11 tests in
test_cokriging.pytesting only cokriging logic:All tests passing with no warnings.
Examples
Two minimal examples following GSTools conventions (76 & 78 lines):
10_simple_collocated_cokriging.py- SCCK demonstration11_intrinsic_collocated_cokriging.py- ICCK demonstrationReferences