Open
Conversation
- Implement Simple Collocated Cokriging (SCCK) extending Krige class - Implement Intrinsic Collocated Cokriging (ICCK) with flexible secondary models - Add comprehensive test suite with 14 test cases covering: - Matrix construction and dimensions - Cross-correlation validation - RHS vector structure - Integration with drift functions - Edge cases (zero/perfect correlation) - Follow gstools patterns: property validation, error handling, documentation - Matrix structure: (n+1) x (n+1) for n conditioning points + 1 secondary variable - Uses Markov model assumption: C_zy(h) = ρ * √(C_zz(h) * C_yy(h)) - All tests passing with proper position handling via pre_pos method
- Clean minimal implementation extending Krige base class - Follows existing gstools design patterns exactly - Only adds cross_corr parameter and secondary_data requirement - Uses (n+1)×(n+1) matrix system solved per estimation point - Full API compatibility: return_var, chunk_size, only_mean, etc. - Proper integration with gstools post-processing and chunking - Zero cross-correlation equals Simple Kriging (verified) - Located in separate cokriging module as requested
Feature/collocated cokriging
- Create CollocatedCokriging base class following kriging module pattern - Refactor SCCK and ICCK as thin wrappers (algorithm='MM1' vs 'intrinsic') - Eliminate ~400 lines of duplicated code - Maintain full backward compatibility - All tests passing (14/14) - Cleaner architecture for future extensibility
This commit introduces a new Correlogram base class architecture that
makes collocated cokriging future-proof and extensible for different
cross-covariance models (MM1, MM2, etc.).
**New Features:**
- Added Correlogram abstract base class defining the interface for
cross-covariance models
- Implemented MarkovModel1 as the first concrete correlogram,
encapsulating Markov Model I assumptions
- Correlogram objects now hold all cross-covariance parameters:
primary_model, cross_corr, secondary_var, primary_mean, secondary_mean
**API Changes:**
New (recommended) API:
correlogram = gs.MarkovModel1(
primary_model=model,
cross_corr=0.8,
secondary_var=1.5,
primary_mean=1.0,
secondary_mean=0.5
)
scck = gs.SimpleCollocated(correlogram, cond_pos, cond_val)
Backward compatibility via from_parameters() classmethod (deprecated):
scck = gs.SimpleCollocated.from_parameters(
model, cond_pos, cond_val,
cross_corr=0.8, secondary_var=1.5,
mean=1.0, secondary_mean=0.5
)
**Refactored Classes:**
- CollocatedCokriging: Now accepts correlogram object instead of
individual parameters (cross_corr, secondary_var, etc.)
- SimpleCollocated: Updated to use new API with backward compatibility
- IntrinsicCollocated: Updated to use new API with backward compatibility
- Both classes delegate covariance computation to correlogram
**Benefits:**
- Separation of concerns: Cross-covariance modeling separated from
kriging algorithm
- Extensible: Easy to add MM2, Linear Model of Coregionalization, etc.
- Self-documenting: Explicit about which cross-covariance model is used
- Maintainable: Correlogram classes can be tested independently
- Future-proof: Ready for additional correlogram models
**Testing:**
- Added comprehensive test suite (test_correlogram.py)
- All tests pass with numerical equivalence between old and new API
- Updated examples to demonstrate new API
**Documentation:**
- Updated examples/05_kriging/10_simple_collocated_cokriging.py
- Updated examples/05_kriging/11_intrinsic_collocated_cokriging.py
- Added MarkovModel1 to top-level exports
- Comprehensive docstrings with usage examples
**Future Work:**
- Placeholder for MarkovModel2 implementation
- Potential for other correlogram models (intrinsic correlation, etc.)
Closes: #correlogram-architecture
- Explains new Correlogram base class design - Provides usage examples for MarkovModel1 - Shows how to implement MarkovModel2 (future) - Includes migration guide from old to new API - Documents testing and file structure
Feature/correlogram architecture
…ecture Revert "Feature/correlogram architecture"
…for cokriging This merge introduces the new Correlogram architecture to replace the direct-parameter API for collocated cokriging. Key Changes: - New Correlogram abstract base class for cross-covariance models - MarkovModel1 implementation (Markov Model I) - Refactored SimpleCollocated and IntrinsicCollocated to use Correlogram objects - Updated API: correlogram parameter replaces model/cross_corr/secondary_var - Cleaner documentation following GSTools philosophy - Comprehensive test suite for correlogram models All conflicts resolved in favor of the new architecture. All tests passing (14/14).
- Add MarkovModel1 to gstools main __init__.py exports - Update cokriging __init__.py with proper imports - Update example files to use new Correlogram API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
had to move cokriging to new branch and start pull request again