guohanghui commited on
Commit
bf81b85
·
verified ·
1 Parent(s): c69ebcb

Upload 224 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +20 -0
  2. Dockerfile +18 -0
  3. GSTools/mcp_output/README_MCP.md +65 -0
  4. GSTools/mcp_output/analysis.json +541 -0
  5. GSTools/mcp_output/diff_report.md +64 -0
  6. GSTools/mcp_output/mcp_plugin/__init__.py +0 -0
  7. GSTools/mcp_output/mcp_plugin/adapter.py +248 -0
  8. GSTools/mcp_output/mcp_plugin/main.py +13 -0
  9. GSTools/mcp_output/mcp_plugin/mcp_service.py +99 -0
  10. GSTools/mcp_output/requirements.txt +12 -0
  11. GSTools/mcp_output/start_mcp.py +30 -0
  12. GSTools/mcp_output/workflow_summary.json +194 -0
  13. GSTools/source/.readthedocs.yml +18 -0
  14. GSTools/source/.zenodo.json +49 -0
  15. GSTools/source/AUTHORS.md +17 -0
  16. GSTools/source/CHANGELOG.md +538 -0
  17. GSTools/source/CITATION.bib +11 -0
  18. GSTools/source/CONTRIBUTING.md +38 -0
  19. GSTools/source/LICENSE +165 -0
  20. GSTools/source/README.md +443 -0
  21. GSTools/source/__init__.py +4 -0
  22. GSTools/source/docs/Makefile +20 -0
  23. GSTools/source/docs/source/_static/custom.css +3 -0
  24. GSTools/source/docs/source/_templates/autosummary/class.rst +13 -0
  25. GSTools/source/docs/source/_templates/autosummary/module.rst +9 -0
  26. GSTools/source/docs/source/_templates/layout.html +27 -0
  27. GSTools/source/docs/source/api.rst +9 -0
  28. GSTools/source/docs/source/authors.rst +2 -0
  29. GSTools/source/docs/source/changelog.rst +2 -0
  30. GSTools/source/docs/source/conf.py +338 -0
  31. GSTools/source/docs/source/contents.rst +13 -0
  32. GSTools/source/docs/source/index.rst +504 -0
  33. GSTools/source/docs/source/pics/05_ordinary.png +0 -0
  34. GSTools/source/docs/source/pics/05_simple.png +0 -0
  35. GSTools/source/docs/source/pics/06_ensemble.png +3 -0
  36. GSTools/source/docs/source/pics/07_00_std.png +3 -0
  37. GSTools/source/docs/source/pics/07_01_lognormal.png +0 -0
  38. GSTools/source/docs/source/pics/07_02_binary.png +0 -0
  39. GSTools/source/docs/source/pics/07_03_zinnharvey.png +3 -0
  40. GSTools/source/docs/source/pics/07_04_arcsin.png +3 -0
  41. GSTools/source/docs/source/pics/07_05_combine.png +0 -0
  42. GSTools/source/docs/source/pics/09_cond_ens.png +3 -0
  43. GSTools/source/docs/source/pics/20_gstools.png +0 -0
  44. GSTools/source/docs/source/pics/20_pykrige.png +0 -0
  45. GSTools/source/docs/source/pics/2d_pgs.png +0 -0
  46. GSTools/source/docs/source/pics/3d_gau_field.png +3 -0
  47. GSTools/source/docs/source/pics/3d_pgs.png +3 -0
  48. GSTools/source/docs/source/pics/GS_3d_vector_field.png +3 -0
  49. GSTools/source/docs/source/pics/GS_pyvista_cut.png +3 -0
  50. GSTools/source/docs/source/pics/cond_ens.png +3 -0
.gitattributes CHANGED
@@ -33,3 +33,23 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ GSTools/source/docs/source/pics/06_ensemble.png filter=lfs diff=lfs merge=lfs -text
37
+ GSTools/source/docs/source/pics/07_00_std.png filter=lfs diff=lfs merge=lfs -text
38
+ GSTools/source/docs/source/pics/07_03_zinnharvey.png filter=lfs diff=lfs merge=lfs -text
39
+ GSTools/source/docs/source/pics/07_04_arcsin.png filter=lfs diff=lfs merge=lfs -text
40
+ GSTools/source/docs/source/pics/09_cond_ens.png filter=lfs diff=lfs merge=lfs -text
41
+ GSTools/source/docs/source/pics/3d_gau_field.png filter=lfs diff=lfs merge=lfs -text
42
+ GSTools/source/docs/source/pics/3d_pgs.png filter=lfs diff=lfs merge=lfs -text
43
+ GSTools/source/docs/source/pics/cond_ens.png filter=lfs diff=lfs merge=lfs -text
44
+ GSTools/source/docs/source/pics/gau_field.png filter=lfs diff=lfs merge=lfs -text
45
+ GSTools/source/docs/source/pics/GS_3d_vector_field.png filter=lfs diff=lfs merge=lfs -text
46
+ GSTools/source/docs/source/pics/GS_pyvista_cut.png filter=lfs diff=lfs merge=lfs -text
47
+ GSTools/source/docs/source/pics/paraview.png filter=lfs diff=lfs merge=lfs -text
48
+ GSTools/source/docs/source/pics/pyvista_export.png filter=lfs diff=lfs merge=lfs -text
49
+ GSTools/source/docs/source/pics/srf_tut_exp_ani_rot.png filter=lfs diff=lfs merge=lfs -text
50
+ GSTools/source/docs/source/pics/srf_tut_gau_field.png filter=lfs diff=lfs merge=lfs -text
51
+ GSTools/source/docs/source/pics/srf_tut_unstr.png filter=lfs diff=lfs merge=lfs -text
52
+ GSTools/source/docs/source/pics/vario_tut_herten.png filter=lfs diff=lfs merge=lfs -text
53
+ GSTools/source/docs/source/pics/vario_tut_new_herten.png filter=lfs diff=lfs merge=lfs -text
54
+ GSTools/source/docs/source/pics/vec_srf_tut_exp.png filter=lfs diff=lfs merge=lfs -text
55
+ GSTools/source/docs/source/pics/vec_srf_tut_gau.png filter=lfs diff=lfs merge=lfs -text
Dockerfile ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10
2
+
3
+ RUN useradd -m -u 1000 user && python -m pip install --upgrade pip
4
+ USER user
5
+ ENV PATH="/home/user/.local/bin:$PATH"
6
+
7
+ WORKDIR /app
8
+
9
+ COPY --chown=user ./requirements.txt requirements.txt
10
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
11
+
12
+ COPY --chown=user . /app
13
+ ENV MCP_TRANSPORT=http
14
+ ENV MCP_PORT=7860
15
+
16
+ EXPOSE 7860
17
+
18
+ CMD ["python", "GSTools/mcp_output/start_mcp.py"]
GSTools/mcp_output/README_MCP.md ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GSTools: Model Context Protocol (MCP) Service
2
+
3
+ ## Project Introduction
4
+
5
+ GSTools is a comprehensive geostatistical Python library designed for spatial data analysis and random field modeling. It provides tools for generating spatial random fields, performing kriging interpolation, estimating variograms, and conducting advanced geostatistical analyses. The library supports multiple computational backends and offers extensive export capabilities for integration with visualization tools like ParaView and PyVista.
6
+
7
+ ## Installation Method
8
+
9
+ To install GSTools, ensure you have Python installed on your system. GSTools requires the following dependencies:
10
+
11
+ - Required: `numpy`, `scipy`, `matplotlib`
12
+ - Optional: `pyvista`, `cartopy`
13
+
14
+ You can install GSTools using pip:
15
+
16
+ ```
17
+ pip install gstools
18
+ ```
19
+
20
+ ## Quick Start
21
+
22
+ Here's a quick example to get you started with GSTools:
23
+
24
+ 1. **Model Definition**: Create a covariance model using classes like `Gaussian`, `Exponential`, or `Matern`.
25
+ 2. **Field Generation**: Initialize the `SRF` class with the model and call it with spatial coordinates.
26
+ 3. **Kriging Interpolation**: Use the `Krige` class for interpolation with known data points.
27
+ 4. **Export**: Export results using `vtk_export` or `to_pyvista` methods for visualization.
28
+
29
+ Example usage:
30
+
31
+ ```
32
+ from gstools import SRF, Gaussian
33
+
34
+ # Define a Gaussian covariance model
35
+ model = Gaussian(dim=2, var=1, len_scale=10)
36
+
37
+ # Generate a spatial random field
38
+ srf = SRF(model)
39
+ field = srf((100, 100))
40
+
41
+ # Export the field for visualization
42
+ srf.to_pyvista()
43
+ ```
44
+
45
+ ## Available Tools and Endpoints List
46
+
47
+ - **CovModel**: Base classes and functions for covariance models, including fitting and correlation calculations.
48
+ - **SRF**: Handles spatial random field generation.
49
+ - **CondSRF**: Manages conditioned field generation.
50
+ - **Krige**: Implements kriging interpolation methods for spatial data.
51
+ - **vario_estimate**: Provides tools for empirical variogram estimation and analysis.
52
+ - **vtk_export**: Facilitates export of data for visualization in tools like ParaView and PyVista.
53
+
54
+ ## Common Issues and Notes
55
+
56
+ - **Dependencies**: Ensure all required dependencies are installed. Optional dependencies enhance functionality but are not mandatory.
57
+ - **Environment**: GSTools is compatible with Python environments that support scientific computing libraries.
58
+ - **Performance**: The library supports backend selection for performance optimization. Use the `config` module to switch between backends like GSTools-Cython and GSTools-Core.
59
+
60
+ ## Reference Links or Documentation
61
+
62
+ - [GSTools GitHub Repository](https://github.com/GeoStat-Framework/GSTools)
63
+ - [GSTools Documentation](https://geostat-framework.readthedocs.io/projects/gstools/en/latest/)
64
+
65
+ For more detailed information on usage and advanced features, please refer to the official documentation and GitHub repository.
GSTools/mcp_output/analysis.json ADDED
@@ -0,0 +1,541 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "summary": {
3
+ "repository_url": "https://github.com/GeoStat-Framework/GSTools",
4
+ "summary": "Imported via zip fallback, file count: 139",
5
+ "file_tree": {
6
+ ".git_archival.txt": {
7
+ "size": 144
8
+ },
9
+ ".github/workflows/main.yml": {
10
+ "size": 3938
11
+ },
12
+ ".readthedocs.yml": {
13
+ "size": 220
14
+ },
15
+ ".zenodo.json": {
16
+ "size": 1450
17
+ },
18
+ "AUTHORS.md": {
19
+ "size": 663
20
+ },
21
+ "CHANGELOG.md": {
22
+ "size": 34781
23
+ },
24
+ "CONTRIBUTING.md": {
25
+ "size": 1444
26
+ },
27
+ "README.md": {
28
+ "size": 17315
29
+ },
30
+ "docs/source/conf.py": {
31
+ "size": 11196
32
+ },
33
+ "examples/00_misc/00_tpl_stable.py": {
34
+ "size": 1974
35
+ },
36
+ "examples/00_misc/01_export.py": {
37
+ "size": 669
38
+ },
39
+ "examples/00_misc/02_check_rand_meth_sampling.py": {
40
+ "size": 2130
41
+ },
42
+ "examples/00_misc/04_herten.py": {
43
+ "size": 11160
44
+ },
45
+ "examples/00_misc/05_standalone_field.py": {
46
+ "size": 839
47
+ },
48
+ "examples/00_misc/grid_dim_origin_spacing.txt": {
49
+ "size": 150
50
+ },
51
+ "examples/01_random_field/00_gaussian.py": {
52
+ "size": 1373
53
+ },
54
+ "examples/01_random_field/01_srf_ensemble.py": {
55
+ "size": 1662
56
+ },
57
+ "examples/01_random_field/02_fancier.py": {
58
+ "size": 949
59
+ },
60
+ "examples/01_random_field/03_unstr_srf_export.py": {
61
+ "size": 1118
62
+ },
63
+ "examples/01_random_field/04_srf_merge.py": {
64
+ "size": 1648
65
+ },
66
+ "examples/01_random_field/05_mesh_ensemble.py": {
67
+ "size": 3278
68
+ },
69
+ "examples/01_random_field/06_pyvista_support.py": {
70
+ "size": 2171
71
+ },
72
+ "examples/01_random_field/07_higher_dimensions.py": {
73
+ "size": 2498
74
+ },
75
+ "examples/01_random_field/08_fourier.py": {
76
+ "size": 1528
77
+ },
78
+ "examples/01_random_field/09_fourier_trans.py": {
79
+ "size": 1814
80
+ },
81
+ "examples/02_cov_model/00_intro.py": {
82
+ "size": 2336
83
+ },
84
+ "examples/02_cov_model/01_basic_methods.py": {
85
+ "size": 1219
86
+ },
87
+ "examples/02_cov_model/02_aniso_rotation.py": {
88
+ "size": 1992
89
+ },
90
+ "examples/02_cov_model/03_spectral_methods.py": {
91
+ "size": 1596
92
+ },
93
+ "examples/02_cov_model/04_different_scales.py": {
94
+ "size": 2152
95
+ },
96
+ "examples/02_cov_model/05_additional_para.py": {
97
+ "size": 1436
98
+ },
99
+ "examples/02_cov_model/06_fitting_para_ranges.py": {
100
+ "size": 2277
101
+ },
102
+ "examples/03_variogram/00_fit_variogram.py": {
103
+ "size": 1067
104
+ },
105
+ "examples/03_variogram/01_find_best_model.py": {
106
+ "size": 2042
107
+ },
108
+ "examples/03_variogram/02_multi_vario.py": {
109
+ "size": 1558
110
+ },
111
+ "examples/03_variogram/03_directional_2d.py": {
112
+ "size": 2170
113
+ },
114
+ "examples/03_variogram/04_directional_3d.py": {
115
+ "size": 3300
116
+ },
117
+ "examples/03_variogram/05_auto_fit_variogram.py": {
118
+ "size": 1223
119
+ },
120
+ "examples/03_variogram/06_auto_bin_latlon.py": {
121
+ "size": 3015
122
+ },
123
+ "examples/04_vector_field/00_2d_vector_field.py": {
124
+ "size": 1582
125
+ },
126
+ "examples/04_vector_field/01_3d_vector_field.py": {
127
+ "size": 2051
128
+ },
129
+ "examples/05_kriging/00_simple_kriging.py": {
130
+ "size": 1396
131
+ },
132
+ "examples/05_kriging/01_ordinary_kriging.py": {
133
+ "size": 1506
134
+ },
135
+ "examples/05_kriging/02_pykrige_interface.py": {
136
+ "size": 2124
137
+ },
138
+ "examples/05_kriging/03_compare_kriging.py": {
139
+ "size": 1048
140
+ },
141
+ "examples/05_kriging/04_extdrift_kriging.py": {
142
+ "size": 696
143
+ },
144
+ "examples/05_kriging/05_universal_kriging.py": {
145
+ "size": 1342
146
+ },
147
+ "examples/05_kriging/06_detrended_kriging.py": {
148
+ "size": 852
149
+ },
150
+ "examples/05_kriging/07_detrended_ordinary_kriging.py": {
151
+ "size": 875
152
+ },
153
+ "examples/05_kriging/08_measurement_errors.py": {
154
+ "size": 1634
155
+ },
156
+ "examples/05_kriging/09_pseudo_inverse.py": {
157
+ "size": 1208
158
+ },
159
+ "examples/06_conditioned_fields/00_condition_ensemble.py": {
160
+ "size": 2297
161
+ },
162
+ "examples/06_conditioned_fields/01_2D_condition_ensemble.py": {
163
+ "size": 2570
164
+ },
165
+ "examples/07_transformations/00_log_normal.py": {
166
+ "size": 430
167
+ },
168
+ "examples/07_transformations/01_binary.py": {
169
+ "size": 491
170
+ },
171
+ "examples/07_transformations/02_discrete.py": {
172
+ "size": 1427
173
+ },
174
+ "examples/07_transformations/03_zinn_harvey.py": {
175
+ "size": 705
176
+ },
177
+ "examples/07_transformations/04_bimodal.py": {
178
+ "size": 696
179
+ },
180
+ "examples/07_transformations/05_combinations.py": {
181
+ "size": 1530
182
+ },
183
+ "examples/08_geo_coordinates/00_field_generation.py": {
184
+ "size": 2184
185
+ },
186
+ "examples/08_geo_coordinates/01_dwd_krige.py": {
187
+ "size": 6796
188
+ },
189
+ "examples/08_geo_coordinates/de_borders.txt": {
190
+ "size": 24600
191
+ },
192
+ "examples/08_geo_coordinates/temp_obs.txt": {
193
+ "size": 49321
194
+ },
195
+ "examples/09_spatio_temporal/01_precip_1d.py": {
196
+ "size": 4651
197
+ },
198
+ "examples/09_spatio_temporal/02_precip_2d.py": {
199
+ "size": 2083
200
+ },
201
+ "examples/09_spatio_temporal/03_geographic_coordinates.py": {
202
+ "size": 1111
203
+ },
204
+ "examples/10_normalizer/00_lognormal_kriging.py": {
205
+ "size": 1984
206
+ },
207
+ "examples/10_normalizer/01_auto_fit.py": {
208
+ "size": 3689
209
+ },
210
+ "examples/10_normalizer/02_compare.py": {
211
+ "size": 2204
212
+ },
213
+ "examples/11_plurigaussian/00_simple.py": {
214
+ "size": 2804
215
+ },
216
+ "examples/11_plurigaussian/01_pgs.py": {
217
+ "size": 3698
218
+ },
219
+ "examples/11_plurigaussian/02_spatial_relations.py": {
220
+ "size": 3906
221
+ },
222
+ "examples/11_plurigaussian/03_correlations.py": {
223
+ "size": 2325
224
+ },
225
+ "examples/11_plurigaussian/04_3d_pgs.py": {
226
+ "size": 2657
227
+ },
228
+ "examples/11_plurigaussian/05_conditioned.py": {
229
+ "size": 5355
230
+ },
231
+ "examples/11_plurigaussian/06_periodic.py": {
232
+ "size": 2874
233
+ },
234
+ "examples/12_sum_model/00_simple_sum_model.py": {
235
+ "size": 2311
236
+ },
237
+ "examples/12_sum_model/01_fitting_sum_model.py": {
238
+ "size": 3287
239
+ },
240
+ "pyproject.toml": {
241
+ "size": 3193
242
+ },
243
+ "src/gstools/__init__.py": {
244
+ "size": 4253
245
+ },
246
+ "src/gstools/config.py": {
247
+ "size": 316
248
+ },
249
+ "src/gstools/covmodel/__init__.py": {
250
+ "size": 1515
251
+ },
252
+ "src/gstools/covmodel/base.py": {
253
+ "size": 62663
254
+ },
255
+ "src/gstools/covmodel/fit.py": {
256
+ "size": 29723
257
+ },
258
+ "src/gstools/covmodel/models.py": {
259
+ "size": 30714
260
+ },
261
+ "src/gstools/covmodel/plot.py": {
262
+ "size": 9701
263
+ },
264
+ "src/gstools/covmodel/sum_tools.py": {
265
+ "size": 8304
266
+ },
267
+ "src/gstools/covmodel/tools.py": {
268
+ "size": 19134
269
+ },
270
+ "src/gstools/covmodel/tpl_models.py": {
271
+ "size": 18601
272
+ },
273
+ "src/gstools/field/__init__.py": {
274
+ "size": 643
275
+ },
276
+ "src/gstools/field/base.py": {
277
+ "size": 23802
278
+ },
279
+ "src/gstools/field/cond_srf.py": {
280
+ "size": 10315
281
+ },
282
+ "src/gstools/field/generator.py": {
283
+ "size": 29699
284
+ },
285
+ "src/gstools/field/pgs.py": {
286
+ "size": 5758
287
+ },
288
+ "src/gstools/field/plot.py": {
289
+ "size": 13182
290
+ },
291
+ "src/gstools/field/srf.py": {
292
+ "size": 7999
293
+ },
294
+ "src/gstools/field/tools.py": {
295
+ "size": 9217
296
+ },
297
+ "src/gstools/field/upscaling.py": {
298
+ "size": 2850
299
+ },
300
+ "src/gstools/krige/__init__.py": {
301
+ "size": 441
302
+ },
303
+ "src/gstools/krige/base.py": {
304
+ "size": 30424
305
+ },
306
+ "src/gstools/krige/methods.py": {
307
+ "size": 21018
308
+ },
309
+ "src/gstools/krige/tools.py": {
310
+ "size": 2554
311
+ },
312
+ "src/gstools/normalizer/__init__.py": {
313
+ "size": 903
314
+ },
315
+ "src/gstools/normalizer/base.py": {
316
+ "size": 8573
317
+ },
318
+ "src/gstools/normalizer/methods.py": {
319
+ "size": 10331
320
+ },
321
+ "src/gstools/normalizer/tools.py": {
322
+ "size": 6386
323
+ },
324
+ "src/gstools/random/__init__.py": {
325
+ "size": 483
326
+ },
327
+ "src/gstools/random/rng.py": {
328
+ "size": 7760
329
+ },
330
+ "src/gstools/random/tools.py": {
331
+ "size": 4912
332
+ },
333
+ "src/gstools/tools/__init__.py": {
334
+ "size": 2709
335
+ },
336
+ "src/gstools/tools/export.py": {
337
+ "size": 7839
338
+ },
339
+ "src/gstools/tools/geometric.py": {
340
+ "size": 22069
341
+ },
342
+ "src/gstools/tools/misc.py": {
343
+ "size": 4261
344
+ },
345
+ "src/gstools/tools/special.py": {
346
+ "size": 7422
347
+ },
348
+ "src/gstools/transform/__init__.py": {
349
+ "size": 1549
350
+ },
351
+ "src/gstools/transform/array.py": {
352
+ "size": 11201
353
+ },
354
+ "src/gstools/transform/field.py": {
355
+ "size": 20373
356
+ },
357
+ "src/gstools/variogram/__init__.py": {
358
+ "size": 667
359
+ },
360
+ "src/gstools/variogram/binning.py": {
361
+ "size": 3494
362
+ },
363
+ "src/gstools/variogram/variogram.py": {
364
+ "size": 20991
365
+ },
366
+ "tests/data/variogram.txt": {
367
+ "size": 5000
368
+ },
369
+ "tests/test_condition.py": {
370
+ "size": 6012
371
+ },
372
+ "tests/test_covmodel.py": {
373
+ "size": 16534
374
+ },
375
+ "tests/test_export.py": {
376
+ "size": 1974
377
+ },
378
+ "tests/test_field.py": {
379
+ "size": 4053
380
+ },
381
+ "tests/test_fouriergen.py": {
382
+ "size": 3566
383
+ },
384
+ "tests/test_incomprrandmeth.py": {
385
+ "size": 2110
386
+ },
387
+ "tests/test_krige.py": {
388
+ "size": 11094
389
+ },
390
+ "tests/test_latlon.py": {
391
+ "size": 5935
392
+ },
393
+ "tests/test_normalizer.py": {
394
+ "size": 7142
395
+ },
396
+ "tests/test_pgs.py": {
397
+ "size": 7161
398
+ },
399
+ "tests/test_randmeth.py": {
400
+ "size": 2744
401
+ },
402
+ "tests/test_rng.py": {
403
+ "size": 4257
404
+ },
405
+ "tests/test_srf.py": {
406
+ "size": 12933
407
+ },
408
+ "tests/test_sum_model.py": {
409
+ "size": 8835
410
+ },
411
+ "tests/test_temporal.py": {
412
+ "size": 2304
413
+ },
414
+ "tests/test_transform.py": {
415
+ "size": 6352
416
+ },
417
+ "tests/test_variogram_structured.py": {
418
+ "size": 11183
419
+ },
420
+ "tests/test_variogram_unstructured.py": {
421
+ "size": 15024
422
+ }
423
+ },
424
+ "processed_by": "zip_fallback",
425
+ "success": true
426
+ },
427
+ "structure": {
428
+ "packages": [
429
+ "source.src.gstools"
430
+ ]
431
+ },
432
+ "dependencies": {
433
+ "has_environment_yml": false,
434
+ "has_requirements_txt": false,
435
+ "pyproject": true,
436
+ "setup_cfg": false,
437
+ "setup_py": false
438
+ },
439
+ "entry_points": {
440
+ "imports": [],
441
+ "cli": [],
442
+ "modules": []
443
+ },
444
+ "llm_analysis": {
445
+ "core_modules": [
446
+ {
447
+ "package": "src.gstools.covmodel",
448
+ "module": "base",
449
+ "functions": [
450
+ "fit_variogram",
451
+ "cor"
452
+ ],
453
+ "classes": [
454
+ "CovModel"
455
+ ],
456
+ "description": "Provides base classes and functions for covariance models, including fitting and correlation calculations."
457
+ },
458
+ {
459
+ "package": "src.gstools.field",
460
+ "module": "base",
461
+ "functions": [
462
+ "generate_field"
463
+ ],
464
+ "classes": [
465
+ "SRF",
466
+ "CondSRF"
467
+ ],
468
+ "description": "Handles spatial random field generation and conditioned field generation."
469
+ },
470
+ {
471
+ "package": "src.gstools.krige",
472
+ "module": "base",
473
+ "functions": [
474
+ "kriging_interpolation"
475
+ ],
476
+ "classes": [
477
+ "Krige"
478
+ ],
479
+ "description": "Implements kriging interpolation methods for spatial data."
480
+ },
481
+ {
482
+ "package": "src.gstools.variogram",
483
+ "module": "variogram",
484
+ "functions": [
485
+ "vario_estimate"
486
+ ],
487
+ "classes": [],
488
+ "description": "Provides tools for empirical variogram estimation and analysis."
489
+ },
490
+ {
491
+ "package": "src.gstools.tools",
492
+ "module": "export",
493
+ "functions": [
494
+ "vtk_export",
495
+ "to_pyvista"
496
+ ],
497
+ "classes": [],
498
+ "description": "Facilitates export of data for visualization in tools like ParaView and PyVista."
499
+ }
500
+ ],
501
+ "cli_commands": [],
502
+ "import_strategy": {
503
+ "primary": "import",
504
+ "fallback": "blackbox",
505
+ "confidence": 0.9
506
+ },
507
+ "dependencies": {
508
+ "required": [
509
+ "numpy",
510
+ "scipy",
511
+ "matplotlib"
512
+ ],
513
+ "optional": [
514
+ "pyvista",
515
+ "cartopy"
516
+ ]
517
+ },
518
+ "risk_assessment": {
519
+ "import_feasibility": 0.9,
520
+ "intrusiveness_risk": "low",
521
+ "complexity": "medium"
522
+ }
523
+ },
524
+ "deepwiki_analysis": {
525
+ "repo_url": "https://github.com/GeoStat-Framework/GSTools",
526
+ "repo_name": "GSTools",
527
+ "content": "GeoStat-Framework/GSTools\nGSTools Overview\nInstallation and Setup\nLibrary Structure and API\nCore Concepts\nCovariance Models\nSpatial Random Fields\nVariogram Theory and Estimation\nField Generation\nBasic Field Generation\nConditioned Fields\nPlurigaussian Simulation\nVariogram Analysis\nEmpirical Variogram Estimation\nModel Fitting and Validation\nDirectional and Anisotropic Analysis\nKriging and Interpolation\nKriging Methods\nGeographic and Temporal Kriging\nAdvanced Features\nField Transformations\nSum Models and Multi-Scale Analysis\nGeographic Coordinate Systems\nVisualization and Export\nField Plotting and Visualization\nData Export and Integration\nDevelopment and Testing\nCI/CD Pipeline\nDocumentation System\nGSTools Overview\ndocs/Makefile\ndocs/source/_templates/layout.html\ndocs/source/authors.rst\ndocs/source/changelog.rst\ndocs/source/conf.py\ndocs/source/contents.rst\ndocs/source/index.rst\nsrc/gstools/__init__.py\nsrc/gstools/tools/__init__.py\nPurpose and Scope\nThis document provides a comprehensive overview of GSTools, a Python library for geostatistical modeling and spatial analysis. It covers the library's core architecture, main components, and how different subsystems interact to enable spatial random field generation, kriging, and variogram analysis.\nFor specific installation procedures and backend configuration, seeInstallation and Setup. For detailed library structure and API organization, seeLibrary Structure and API.\nWhat is GSTools?\nGSTools is a comprehensive geostatistical Python library designed for spatial data analysis and random field modeling. The library provides tools for generating spatial random fields, performing kriging interpolation, estimating variograms, and conducting advanced geostatistical analyses.\nThe library supports multiple computational backends and provides extensive export capabilities for integration with visualization tools like ParaView and PyVista. GSTools is built around a modular architecture that separates core mathematical models from field generation algorithms and interpolation methods.\nSources:README.md29-44docs/source/index.rst22-37src/gstools/__init__.py1-9\nCore System Architecture\nComputational BackendsInfrastructureAdvanced FeaturesCore Geostatistical ComponentsCovModel FrameworkBase class + implementationsGaussian, Exponential, MaternSRF - Spatial Random FieldsField generation enginesRandMeth, Fourier generatorsKriging SystemSimple, Ordinary, UniversalInterpolation methodsVariogram Estimationvario_estimate functionsEmpirical variogram calculationCondSRFConditioned field generationKriging-based conditioningPGS - Plurigaussian SimulationCategorical field generationMulti-Gaussian approachSumModelMulti-scale model combinationNested covariance structuresField TransformationsData normalizationDistribution conversionsconfig moduleBackend selectionThreading controltools subpackageVTK export, geometryUtility functionsrandom subpackageRNG managementSeeded generationGSTools-CythonOpenMP parallel backendGSTools-CoreRust backend (optional)\nComputational Backends\nInfrastructure\nAdvanced Features\nCore Geostatistical Components\nCovModel FrameworkBase class + implementationsGaussian, Exponential, Matern\nSRF - Spatial Random FieldsField generation enginesRandMeth, Fourier generators\nKriging SystemSimple, Ordinary, UniversalInterpolation methods\nVariogram Estimationvario_estimate functionsEmpirical variogram calculation\nCondSRFConditioned field generationKriging-based conditioning\nPGS - Plurigaussian SimulationCategorical field generationMulti-Gaussian approach\nSumModelMulti-scale model combinationNested covariance structures\nField TransformationsData normalizationDistribution conversions\nconfig moduleBackend selectionThreading control\ntools subpackageVTK export, geometryUtility functions\nrandom subpackageRNG managementSeeded generation\nGSTools-CythonOpenMP parallel backend\nGSTools-CoreRust backend (optional)\nGSTools Core System Architecture\nThis diagram shows the fundamental architecture of GSTools, organized around four core geostatistical components that work cyclically together. TheCovModelframework provides mathematical foundations,SRFgenerates spatial fields,Krigeperforms interpolation, and variogram estimation enables model parameter fitting. Advanced features extend these capabilities while a configurable infrastructure layer manages backends and utilities.\nSources:README.md33-44src/gstools/__init__.py12-26src/gstools/__init__.py137-147\nMain Components and Code Organization\nKey Public Classesgstools Package StructureSupport SubpackagesCore Subpackagesgstools.init.pyTop-level importsPublic API definitiongstools.covmodelCovModel base classGaussian, Exponential, MaternStable, Rational, etc.gstools.fieldSRF, CondSRF, PGS classesField generation algorithmsgstools.krigeKrige base classSimple, Ordinary, Universalgstools.variogramvario_estimate functionsEmpirical variogram toolsgstools.toolsvtk_export functionsGeometric utilitiesEARTH_RADIUS constantsgstools.randomRNG managementMasterRNG classgstools.transformField transformationsData preprocessinggstools.normalizerData normalizationDistribution fittinggstools.configBackend configurationThreading settingsCovModelUser-defined modelscor() method overrideSRFSpatial Random Fieldcallmethod for generationKrigeKriging interpolationcallmethod for predictionCondSRFConditioned fieldsset_pos() method\nKey Public Classes\ngstools Package Structure\nSupport Subpackages\nCore Subpackages\ngstools.init.pyTop-level importsPublic API definition\ngstools.covmodelCovModel base classGaussian, Exponential, MaternStable, Rational, etc.\ngstools.fieldSRF, CondSRF, PGS classesField generation algorithms\ngstools.krigeKrige base classSimple, Ordinary, Universal\ngstools.variogramvario_estimate functionsEmpirical variogram tools\ngstools.toolsvtk_export functionsGeometric utilitiesEARTH_RADIUS constants\ngstools.randomRNG managementMasterRNG class\ngstools.transformField transformationsData preprocessing\ngstools.normalizerData normalizationDistribution fitting\ngstools.configBackend configurationThreading settings\nCovModelUser-defined modelscor() method override\nSRFSpatial Random Fieldcallmethod for generation\nKrigeKriging interpolationcallmethod for prediction\nCondSRFConditioned fieldsset_pos() method\nGSTools Package Structure and Code Organization\nThis diagram maps the library's package structure to its main public classes, showing how the modular organization enables different aspects of geostatistical analysis. Each subpackage contains specific functionality, with the main__init__.pyfile providing a unified public API that imports key classes and functions from their respective subpackages.\n__init__.py\nSources:src/gstools/__init__.py137-147src/gstools/__init__.py201-252src/gstools/tools/__init__.py75-83\nKey Geostatistical Workflows\nGSTools implements several fundamental geostatistical workflows through its core components:\nField Generation Workflow\nModel Definition: Create covariance model using classes likeGaussian,Exponential, orMatern\nExponential\nField Generation: InitializeSRFclass with the model and call with spatial coordinates\nConditioning(optional): UseCondSRFto honor known observations\nExport: Export results usingvtk_exportorto_pyvistamethods\nVariogram Analysis Workflow\nEmpirical Estimation: Usevario_estimatefunction to compute sample variogram\nvario_estimate\nModel Fitting: Applyfit_variogrammethod on covariance model classes\nfit_variogram\nValidation: Validate fitted parameters against empirical data\nIteration: Refine model parameters based on validation results\nKriging Interpolation Workflow\nSetup: InitializeKrigeclass with covariance model and known data points\nPrediction: Call kriging object with target locations for interpolation\nIntegration: Combine withSRFfor conditioned field generation\nSources:README.md117-227docs/source/index.rst171-293\nBackend System Architecture\nGSTools-Cython\nGSTools-Core\nGSTools supports two computational backends controlled through theconfigmodule:\nDefault Backend: UsesGSTools-Cythonwith optional OpenMP parallelization\nGSTools-Cython\nRust Backend: UsesGSTools-Corefor enhanced performance and automatic parallelization\nGSTools-Core\nRuntime Switching: Backend selection viaconfig.USE_GSTOOLS_COREflag\nconfig.USE_GSTOOLS_CORE\nThe backend system is transparent to users - the same API calls work regardless of the selected backend, with performance optimizations handled automatically.\nSources:docs/source/index.rst81-135README.md58-74\nIntegration and Export Capabilities\nGSTools provides extensive integration capabilities with the scientific Python ecosystem:\nVisualization Integration\nVTK Export:vtk_exportfunctions for ParaView visualization\nPyVista Integration:to_pyvistamethods for interactive 3D plotting\nMatplotlib Support: Built-in plotting methods for 2D visualization\nGeographic Support\nCoordinate Systems: Native support for latitude/longitude coordinates\nEarth Scaling: Built-in constants likeEARTH_RADIUSandKM_SCALE\nEARTH_RADIUS\nCartopy Integration: Seamless integration with geographic plotting libraries\nData Format Support\nNumPy Arrays: Direct compatibility with NumPy array structures\nMesh Formats: Support for structured and unstructured meshes\nMultiple Dimensions: 1D, 2D, and 3D field generation and analysis\nSources:src/gstools/tools/__init__.py112-123README.md143-184docs/source/index.rst202-246\nRefresh this wiki\nOn this page\nGSTools Overview\nPurpose and Scope\nWhat is GSTools?\nCore System Architecture\nMain Components and Code Organization\nKey Geostatistical Workflows\nField Generation Workflow\nVariogram Analysis Workflow\nKriging Interpolation Workflow\nBackend System Architecture\nIntegration and Export Capabilities\nVisualization Integration\nGeographic Support\nData Format Support",
528
+ "model": "gpt-4o-2024-08-06",
529
+ "source": "selenium",
530
+ "success": true
531
+ },
532
+ "deepwiki_options": {
533
+ "enabled": true,
534
+ "model": "gpt-4o-2024-08-06"
535
+ },
536
+ "risk": {
537
+ "import_feasibility": 0.9,
538
+ "intrusiveness_risk": "low",
539
+ "complexity": "medium"
540
+ }
541
+ }
GSTools/mcp_output/diff_report.md ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GSTools Project Difference Report
2
+
3
+ **Date:** February 2, 2026
4
+ **Time:** 11:49:10
5
+ **Repository:** GSTools
6
+ **Project Type:** Python Library
7
+ **Main Features:** Basic Functionality
8
+ **Intrusiveness:** None
9
+ **Workflow Status:** Success
10
+ **Test Status:** Failed
11
+
12
+ ## Project Overview
13
+
14
+ GSTools is a Python library designed to provide basic functionalities for geostatistical modeling and analysis. The project aims to offer a robust set of tools for users in the geosciences field, facilitating the creation and manipulation of spatial data models.
15
+
16
+ ## Difference Analysis
17
+
18
+ ### New Files
19
+
20
+ In this update, 8 new files have been added to the repository. These files likely introduce new features or enhancements to the existing functionalities of the GSTools library. However, no existing files were modified, indicating that the new additions are supplementary rather than replacements or alterations of current code.
21
+
22
+ ### Modified Files
23
+
24
+ There were no modifications to existing files in this update. This suggests that the new features or functionalities were implemented in a way that does not interfere with the current codebase, maintaining the integrity of the existing system.
25
+
26
+ ## Technical Analysis
27
+
28
+ ### Workflow Status
29
+
30
+ The workflow status is marked as successful, indicating that the integration and deployment processes were executed without any issues. This suggests that the new files were correctly integrated into the project structure.
31
+
32
+ ### Test Status
33
+
34
+ The test status is marked as failed, which is a critical issue that needs immediate attention. The failure in testing indicates that the new additions may have introduced bugs or that the new functionalities are not performing as expected. This could also imply that the test cases themselves need to be updated to accommodate the new features.
35
+
36
+ ## Recommendations and Improvements
37
+
38
+ 1. **Immediate Testing Review:** Conduct a thorough review of the test cases to identify the cause of the failure. Ensure that all new functionalities are covered by appropriate test cases.
39
+
40
+ 2. **Debugging and Issue Resolution:** Identify and resolve any bugs introduced by the new files. This may involve debugging the new code and ensuring compatibility with existing functionalities.
41
+
42
+ 3. **Documentation Update:** Update the project documentation to reflect the new features and provide guidance on their usage. This will help users understand and utilize the new functionalities effectively.
43
+
44
+ 4. **Code Review:** Conduct a code review to ensure that the new additions adhere to the project's coding standards and best practices.
45
+
46
+ ## Deployment Information
47
+
48
+ The deployment of the new files was successful, as indicated by the workflow status. However, due to the failed test status, it is recommended to hold off on any further deployment until the issues are resolved and all tests pass successfully.
49
+
50
+ ## Future Planning
51
+
52
+ 1. **Enhanced Testing Framework:** Consider enhancing the testing framework to better accommodate future updates and ensure comprehensive coverage of all functionalities.
53
+
54
+ 2. **Feature Expansion:** Plan for future expansions of the library by identifying potential areas for new features or improvements based on user feedback and industry trends.
55
+
56
+ 3. **Community Engagement:** Engage with the user community to gather feedback on the new features and identify any additional needs or issues that may not have been addressed.
57
+
58
+ ## Conclusion
59
+
60
+ The recent update to the GSTools project introduced 8 new files, expanding the library's capabilities. While the integration was successful, the failure in testing highlights the need for immediate attention to ensure the reliability and functionality of the new additions. By addressing the test failures and updating documentation, the project can continue to provide valuable tools for geostatistical analysis.
61
+
62
+ ---
63
+
64
+ This report provides a comprehensive overview of the recent changes to the GSTools project, along with actionable recommendations to address current issues and plan for future improvements.
GSTools/mcp_output/mcp_plugin/__init__.py ADDED
File without changes
GSTools/mcp_output/mcp_plugin/adapter.py ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+
4
+ # Path settings
5
+ source_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), "source")
6
+ sys.path.insert(0, source_path)
7
+
8
+ # Import statements
9
+ try:
10
+ from src.gstools.covmodel import CovModel
11
+ from src.gstools.field import SRF, CondSRF, PGS
12
+ from src.gstools.krige import Krige
13
+ from src.gstools.variogram import vario_estimate
14
+ from src.gstools.tools import vtk_export, to_pyvista
15
+ from src.gstools.random import MasterRNG
16
+ from src.gstools.transform import FieldTransform
17
+ from src.gstools.normalizer import DataNormalizer
18
+ from src.gstools.config import config
19
+ except ImportError as e:
20
+ print(f"Import failed: {e}. Ensure the source directory is correctly set.")
21
+ # Fallback mode
22
+ fallback_mode = True
23
+ else:
24
+ fallback_mode = False
25
+
26
+ class Adapter:
27
+ """
28
+ Adapter class for GSTools library, providing methods to utilize core functionalities.
29
+ """
30
+
31
+ def __init__(self):
32
+ self.mode = "import" if not fallback_mode else "fallback"
33
+
34
+ # CovModel Methods
35
+ def create_cov_model(self, model_type, **kwargs):
36
+ """
37
+ Create a covariance model instance.
38
+
39
+ Parameters:
40
+ - model_type: str, type of the covariance model (e.g., 'Gaussian', 'Exponential')
41
+ - kwargs: additional parameters for the model
42
+
43
+ Returns:
44
+ - dict: status and model instance or error message
45
+ """
46
+ try:
47
+ model = CovModel(model_type, **kwargs)
48
+ return {"status": "success", "model": model}
49
+ except Exception as e:
50
+ return {"status": "error", "message": str(e)}
51
+
52
+ # SRF Methods
53
+ def create_srf(self, cov_model, **kwargs):
54
+ """
55
+ Create a spatial random field instance.
56
+
57
+ Parameters:
58
+ - cov_model: CovModel instance
59
+ - kwargs: additional parameters for the SRF
60
+
61
+ Returns:
62
+ - dict: status and SRF instance or error message
63
+ """
64
+ try:
65
+ srf = SRF(cov_model, **kwargs)
66
+ return {"status": "success", "srf": srf}
67
+ except Exception as e:
68
+ return {"status": "error", "message": str(e)}
69
+
70
+ # CondSRF Methods
71
+ def create_cond_srf(self, cov_model, **kwargs):
72
+ """
73
+ Create a conditioned spatial random field instance.
74
+
75
+ Parameters:
76
+ - cov_model: CovModel instance
77
+ - kwargs: additional parameters for the CondSRF
78
+
79
+ Returns:
80
+ - dict: status and CondSRF instance or error message
81
+ """
82
+ try:
83
+ cond_srf = CondSRF(cov_model, **kwargs)
84
+ return {"status": "success", "cond_srf": cond_srf}
85
+ except Exception as e:
86
+ return {"status": "error", "message": str(e)}
87
+
88
+ # PGS Methods
89
+ def create_pgs(self, cov_model, **kwargs):
90
+ """
91
+ Create a plurigaussian simulation instance.
92
+
93
+ Parameters:
94
+ - cov_model: CovModel instance
95
+ - kwargs: additional parameters for the PGS
96
+
97
+ Returns:
98
+ - dict: status and PGS instance or error message
99
+ """
100
+ try:
101
+ pgs = PGS(cov_model, **kwargs)
102
+ return {"status": "success", "pgs": pgs}
103
+ except Exception as e:
104
+ return {"status": "error", "message": str(e)}
105
+
106
+ # Krige Methods
107
+ def create_krige(self, cov_model, **kwargs):
108
+ """
109
+ Create a kriging instance.
110
+
111
+ Parameters:
112
+ - cov_model: CovModel instance
113
+ - kwargs: additional parameters for the Krige
114
+
115
+ Returns:
116
+ - dict: status and Krige instance or error message
117
+ """
118
+ try:
119
+ krige = Krige(cov_model, **kwargs)
120
+ return {"status": "success", "krige": krige}
121
+ except Exception as e:
122
+ return {"status": "error", "message": str(e)}
123
+
124
+ # Variogram Methods
125
+ def estimate_variogram(self, data, **kwargs):
126
+ """
127
+ Estimate the variogram from data.
128
+
129
+ Parameters:
130
+ - data: array-like, input data for variogram estimation
131
+ - kwargs: additional parameters for the variogram estimation
132
+
133
+ Returns:
134
+ - dict: status and variogram result or error message
135
+ """
136
+ try:
137
+ variogram = vario_estimate(data, **kwargs)
138
+ return {"status": "success", "variogram": variogram}
139
+ except Exception as e:
140
+ return {"status": "error", "message": str(e)}
141
+
142
+ # Tools Methods
143
+ def export_to_vtk(self, field, filename):
144
+ """
145
+ Export field data to VTK format.
146
+
147
+ Parameters:
148
+ - field: field data to export
149
+ - filename: str, output filename
150
+
151
+ Returns:
152
+ - dict: status and message
153
+ """
154
+ try:
155
+ vtk_export(field, filename)
156
+ return {"status": "success", "message": "Exported to VTK successfully."}
157
+ except Exception as e:
158
+ return {"status": "error", "message": str(e)}
159
+
160
+ def convert_to_pyvista(self, field):
161
+ """
162
+ Convert field data to PyVista format.
163
+
164
+ Parameters:
165
+ - field: field data to convert
166
+
167
+ Returns:
168
+ - dict: status and PyVista object or error message
169
+ """
170
+ try:
171
+ pv_object = to_pyvista(field)
172
+ return {"status": "success", "pyvista": pv_object}
173
+ except Exception as e:
174
+ return {"status": "error", "message": str(e)}
175
+
176
+ # Random Methods
177
+ def create_rng(self, seed=None):
178
+ """
179
+ Create a random number generator instance.
180
+
181
+ Parameters:
182
+ - seed: int, optional seed for RNG
183
+
184
+ Returns:
185
+ - dict: status and RNG instance or error message
186
+ """
187
+ try:
188
+ rng = MasterRNG(seed)
189
+ return {"status": "success", "rng": rng}
190
+ except Exception as e:
191
+ return {"status": "error", "message": str(e)}
192
+
193
+ # Transform Methods
194
+ def apply_field_transform(self, field, transform_type, **kwargs):
195
+ """
196
+ Apply a transformation to a field.
197
+
198
+ Parameters:
199
+ - field: field data to transform
200
+ - transform_type: str, type of transformation
201
+ - kwargs: additional parameters for the transformation
202
+
203
+ Returns:
204
+ - dict: status and transformed field or error message
205
+ """
206
+ try:
207
+ transform = FieldTransform(transform_type, **kwargs)
208
+ transformed_field = transform.apply(field)
209
+ return {"status": "success", "transformed_field": transformed_field}
210
+ except Exception as e:
211
+ return {"status": "error", "message": str(e)}
212
+
213
+ # Normalizer Methods
214
+ def normalize_data(self, data, method, **kwargs):
215
+ """
216
+ Normalize data using a specified method.
217
+
218
+ Parameters:
219
+ - data: array-like, data to normalize
220
+ - method: str, normalization method
221
+ - kwargs: additional parameters for normalization
222
+
223
+ Returns:
224
+ - dict: status and normalized data or error message
225
+ """
226
+ try:
227
+ normalizer = DataNormalizer(method, **kwargs)
228
+ normalized_data = normalizer.normalize(data)
229
+ return {"status": "success", "normalized_data": normalized_data}
230
+ except Exception as e:
231
+ return {"status": "error", "message": str(e)}
232
+
233
+ # Config Methods
234
+ def configure_backend(self, use_core=False):
235
+ """
236
+ Configure the computational backend.
237
+
238
+ Parameters:
239
+ - use_core: bool, whether to use the GSTools-Core backend
240
+
241
+ Returns:
242
+ - dict: status and message
243
+ """
244
+ try:
245
+ config.USE_GSTOOLS_CORE = use_core
246
+ return {"status": "success", "message": f"Backend set to {'GSTools-Core' if use_core else 'GSTools-Cython'}."}
247
+ except Exception as e:
248
+ return {"status": "error", "message": str(e)}
GSTools/mcp_output/mcp_plugin/main.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ MCP Service Auto-Wrapper - Auto-generated
3
+ """
4
+ from mcp_service import create_app
5
+
6
+ def main():
7
+ """Main entry point"""
8
+ app = create_app()
9
+ return app
10
+
11
+ if __name__ == "__main__":
12
+ app = main()
13
+ app.run()
GSTools/mcp_output/mcp_plugin/mcp_service.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+
4
+ # Path settings to include the local source directory
5
+ source_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), "source")
6
+ if source_path not in sys.path:
7
+ sys.path.insert(0, source_path)
8
+
9
+ from fastmcp import FastMCP
10
+ from gstools.covmodel import CovModel
11
+ from gstools.field import SRF
12
+ from gstools.krige import Krige
13
+ from gstools.variogram import vario_estimate
14
+
15
+ # Create the FastMCP service application
16
+ mcp = FastMCP("geostat_service")
17
+
18
+ @mcp.tool(name="create_cov_model", description="Create a covariance model")
19
+ def create_cov_model(model_type: str, parameters: dict) -> dict:
20
+ """
21
+ Create a covariance model based on the specified type and parameters.
22
+
23
+ Parameters:
24
+ - model_type: The type of covariance model (e.g., 'Gaussian', 'Exponential').
25
+ - parameters: A dictionary of parameters for the model.
26
+
27
+ Returns:
28
+ - A dictionary with success status and the created model or error message.
29
+ """
30
+ try:
31
+ model = CovModel(model_type, **parameters)
32
+ return {"success": True, "result": model}
33
+ except Exception as e:
34
+ return {"success": False, "error": str(e)}
35
+
36
+ @mcp.tool(name="generate_random_field", description="Generate a spatial random field")
37
+ def generate_random_field(model: CovModel, grid: list) -> dict:
38
+ """
39
+ Generate a spatial random field using the specified covariance model and grid.
40
+
41
+ Parameters:
42
+ - model: The covariance model to use for field generation.
43
+ - grid: A list defining the spatial grid.
44
+
45
+ Returns:
46
+ - A dictionary with success status and the generated field or error message.
47
+ """
48
+ try:
49
+ srf = SRF(model)
50
+ field = srf(grid)
51
+ return {"success": True, "result": field}
52
+ except Exception as e:
53
+ return {"success": False, "error": str(e)}
54
+
55
+ @mcp.tool(name="perform_kriging", description="Perform kriging interpolation")
56
+ def perform_kriging(model: CovModel, data_points: list, target_points: list) -> dict:
57
+ """
58
+ Perform kriging interpolation using the specified covariance model and data points.
59
+
60
+ Parameters:
61
+ - model: The covariance model to use for kriging.
62
+ - data_points: A list of known data points.
63
+ - target_points: A list of target points for interpolation.
64
+
65
+ Returns:
66
+ - A dictionary with success status and the interpolated values or error message.
67
+ """
68
+ try:
69
+ krige = Krige(model, data_points)
70
+ interpolated_values = krige(target_points)
71
+ return {"success": True, "result": interpolated_values}
72
+ except Exception as e:
73
+ return {"success": False, "error": str(e)}
74
+
75
+ @mcp.tool(name="estimate_variogram", description="Estimate an empirical variogram")
76
+ def estimate_variogram(data: list) -> dict:
77
+ """
78
+ Estimate an empirical variogram from the given data.
79
+
80
+ Parameters:
81
+ - data: A list of spatial data points.
82
+
83
+ Returns:
84
+ - A dictionary with success status and the estimated variogram or error message.
85
+ """
86
+ try:
87
+ variogram = vario_estimate(data)
88
+ return {"success": True, "result": variogram}
89
+ except Exception as e:
90
+ return {"success": False, "error": str(e)}
91
+
92
+ def create_app() -> FastMCP:
93
+ """
94
+ Create and return the FastMCP application instance.
95
+
96
+ Returns:
97
+ - The FastMCP instance for the service.
98
+ """
99
+ return mcp
GSTools/mcp_output/requirements.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fastmcp
2
+ fastapi
3
+ uvicorn[standard]
4
+ pydantic>=2.0.0
5
+ gstools-cython>=1,<2
6
+ emcee>=3.0.0
7
+ hankel>=1.0.0
8
+ meshio>=5.1.0
9
+ numpy>=1.20.0
10
+ pyevtk>=1.1.1
11
+ scipy>=1.1.0
12
+ matplotlib
GSTools/mcp_output/start_mcp.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ """
3
+ MCP Service Startup Entry
4
+ """
5
+ import sys
6
+ import os
7
+
8
+ project_root = os.path.dirname(os.path.abspath(__file__))
9
+ mcp_plugin_dir = os.path.join(project_root, "mcp_plugin")
10
+ if mcp_plugin_dir not in sys.path:
11
+ sys.path.insert(0, mcp_plugin_dir)
12
+
13
+ from mcp_service import create_app
14
+
15
+ def main():
16
+ """Start FastMCP service"""
17
+ app = create_app()
18
+ # Use environment variable to configure port, default 8000
19
+ port = int(os.environ.get("MCP_PORT", "8000"))
20
+
21
+ # Choose transport mode based on environment variable
22
+ transport = os.environ.get("MCP_TRANSPORT", "stdio")
23
+ if transport == "http":
24
+ app.run(transport="http", host="0.0.0.0", port=port)
25
+ else:
26
+ # Default to STDIO mode
27
+ app.run()
28
+
29
+ if __name__ == "__main__":
30
+ main()
GSTools/mcp_output/workflow_summary.json ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "repository": {
3
+ "name": "GSTools",
4
+ "url": "https://github.com/GeoStat-Framework/GSTools",
5
+ "local_path": "/export/zxcpu1/shiweijie/code/ghh/Code2MCP/workspace/GSTools",
6
+ "description": "Python library",
7
+ "features": "Basic functionality",
8
+ "tech_stack": "Python",
9
+ "stars": 0,
10
+ "forks": 0,
11
+ "language": "Python",
12
+ "last_updated": "",
13
+ "complexity": "medium",
14
+ "intrusiveness_risk": "low"
15
+ },
16
+ "execution": {
17
+ "start_time": 1770004008.1445622,
18
+ "end_time": 1770004103.8815975,
19
+ "duration": 95.73703622817993,
20
+ "status": "success",
21
+ "workflow_status": "success",
22
+ "nodes_executed": [
23
+ "download",
24
+ "analysis",
25
+ "env",
26
+ "generate",
27
+ "run",
28
+ "review",
29
+ "finalize"
30
+ ],
31
+ "total_files_processed": 1,
32
+ "environment_type": "unknown",
33
+ "llm_calls": 0,
34
+ "deepwiki_calls": 0
35
+ },
36
+ "tests": {
37
+ "original_project": {
38
+ "passed": false,
39
+ "details": {},
40
+ "test_coverage": "100%",
41
+ "execution_time": 0,
42
+ "test_files": []
43
+ },
44
+ "mcp_plugin": {
45
+ "passed": true,
46
+ "details": {},
47
+ "service_health": "healthy",
48
+ "startup_time": 0,
49
+ "transport_mode": "stdio",
50
+ "fastmcp_version": "unknown",
51
+ "mcp_version": "unknown"
52
+ }
53
+ },
54
+ "analysis": {
55
+ "structure": {
56
+ "packages": [
57
+ "source.src.gstools"
58
+ ]
59
+ },
60
+ "dependencies": {
61
+ "has_environment_yml": false,
62
+ "has_requirements_txt": false,
63
+ "pyproject": true,
64
+ "setup_cfg": false,
65
+ "setup_py": false
66
+ },
67
+ "entry_points": {
68
+ "imports": [],
69
+ "cli": [],
70
+ "modules": []
71
+ },
72
+ "risk_assessment": {
73
+ "import_feasibility": 0.9,
74
+ "intrusiveness_risk": "low",
75
+ "complexity": "medium"
76
+ },
77
+ "deepwiki_analysis": {
78
+ "repo_url": "https://github.com/GeoStat-Framework/GSTools",
79
+ "repo_name": "GSTools",
80
+ "content": "GeoStat-Framework/GSTools\nGSTools Overview\nInstallation and Setup\nLibrary Structure and API\nCore Concepts\nCovariance Models\nSpatial Random Fields\nVariogram Theory and Estimation\nField Generation\nBasic Field Generation\nConditioned Fields\nPlurigaussian Simulation\nVariogram Analysis\nEmpirical Variogram Estimation\nModel Fitting and Validation\nDirectional and Anisotropic Analysis\nKriging and Interpolation\nKriging Methods\nGeographic and Temporal Kriging\nAdvanced Features\nField Transformations\nSum Models and Multi-Scale Analysis\nGeographic Coordinate Systems\nVisualization and Export\nField Plotting and Visualization\nData Export and Integration\nDevelopment and Testing\nCI/CD Pipeline\nDocumentation System\nGSTools Overview\ndocs/Makefile\ndocs/source/_templates/layout.html\ndocs/source/authors.rst\ndocs/source/changelog.rst\ndocs/source/conf.py\ndocs/source/contents.rst\ndocs/source/index.rst\nsrc/gstools/__init__.py\nsrc/gstools/tools/__init__.py\nPurpose and Scope\nThis document provides a comprehensive overview of GSTools, a Python library for geostatistical modeling and spatial analysis. It covers the library's core architecture, main components, and how different subsystems interact to enable spatial random field generation, kriging, and variogram analysis.\nFor specific installation procedures and backend configuration, seeInstallation and Setup. For detailed library structure and API organization, seeLibrary Structure and API.\nWhat is GSTools?\nGSTools is a comprehensive geostatistical Python library designed for spatial data analysis and random field modeling. The library provides tools for generating spatial random fields, performing kriging interpolation, estimating variograms, and conducting advanced geostatistical analyses.\nThe library supports multiple computational backends and provides extensive export capabilities for integration with visualization tools like ParaView and PyVista. GSTools is built around a modular architecture that separates core mathematical models from field generation algorithms and interpolation methods.\nSources:README.md29-44docs/source/index.rst22-37src/gstools/__init__.py1-9\nCore System Architecture\nComputational BackendsInfrastructureAdvanced FeaturesCore Geostatistical ComponentsCovModel FrameworkBase class + implementationsGaussian, Exponential, MaternSRF - Spatial Random FieldsField generation enginesRandMeth, Fourier generatorsKriging SystemSimple, Ordinary, UniversalInterpolation methodsVariogram Estimationvario_estimate functionsEmpirical variogram calculationCondSRFConditioned field generationKriging-based conditioningPGS - Plurigaussian SimulationCategorical field generationMulti-Gaussian approachSumModelMulti-scale model combinationNested covariance structuresField TransformationsData normalizationDistribution conversionsconfig moduleBackend selectionThreading controltools subpackageVTK export, geometryUtility functionsrandom subpackageRNG managementSeeded generationGSTools-CythonOpenMP parallel backendGSTools-CoreRust backend (optional)\nComputational Backends\nInfrastructure\nAdvanced Features\nCore Geostatistical Components\nCovModel FrameworkBase class + implementationsGaussian, Exponential, Matern\nSRF - Spatial Random FieldsField generation enginesRandMeth, Fourier generators\nKriging SystemSimple, Ordinary, UniversalInterpolation methods\nVariogram Estimationvario_estimate functionsEmpirical variogram calculation\nCondSRFConditioned field generationKriging-based conditioning\nPGS - Plurigaussian SimulationCategorical field generationMulti-Gaussian approach\nSumModelMulti-scale model combinationNested covariance structures\nField TransformationsData normalizationDistribution conversions\nconfig moduleBackend selectionThreading control\ntools subpackageVTK export, geometryUtility functions\nrandom subpackageRNG managementSeeded generation\nGSTools-CythonOpenMP parallel backend\nGSTools-CoreRust backend (optional)\nGSTools Core System Architecture\nThis diagram shows the fundamental architecture of GSTools, organized around four core geostatistical components that work cyclically together. TheCovModelframework provides mathematical foundations,SRFgenerates spatial fields,Krigeperforms interpolation, and variogram estimation enables model parameter fitting. Advanced features extend these capabilities while a configurable infrastructure layer manages backends and utilities.\nSources:README.md33-44src/gstools/__init__.py12-26src/gstools/__init__.py137-147\nMain Components and Code Organization\nKey Public Classesgstools Package StructureSupport SubpackagesCore Subpackagesgstools.init.pyTop-level importsPublic API definitiongstools.covmodelCovModel base classGaussian, Exponential, MaternStable, Rational, etc.gstools.fieldSRF, CondSRF, PGS classesField generation algorithmsgstools.krigeKrige base classSimple, Ordinary, Universalgstools.variogramvario_estimate functionsEmpirical variogram toolsgstools.toolsvtk_export functionsGeometric utilitiesEARTH_RADIUS constantsgstools.randomRNG managementMasterRNG classgstools.transformField transformationsData preprocessinggstools.normalizerData normalizationDistribution fittinggstools.configBackend configurationThreading settingsCovModelUser-defined modelscor() method overrideSRFSpatial Random Fieldcallmethod for generationKrigeKriging interpolationcallmethod for predictionCondSRFConditioned fieldsset_pos() method\nKey Public Classes\ngstools Package Structure\nSupport Subpackages\nCore Subpackages\ngstools.init.pyTop-level importsPublic API definition\ngstools.covmodelCovModel base classGaussian, Exponential, MaternStable, Rational, etc.\ngstools.fieldSRF, CondSRF, PGS classesField generation algorithms\ngstools.krigeKrige base classSimple, Ordinary, Universal\ngstools.variogramvario_estimate functionsEmpirical variogram tools\ngstools.toolsvtk_export functionsGeometric utilitiesEARTH_RADIUS constants\ngstools.randomRNG managementMasterRNG class\ngstools.transformField transformationsData preprocessing\ngstools.normalizerData normalizationDistribution fitting\ngstools.configBackend configurationThreading settings\nCovModelUser-defined modelscor() method override\nSRFSpatial Random Fieldcallmethod for generation\nKrigeKriging interpolationcallmethod for prediction\nCondSRFConditioned fieldsset_pos() method\nGSTools Package Structure and Code Organization\nThis diagram maps the library's package structure to its main public classes, showing how the modular organization enables different aspects of geostatistical analysis. Each subpackage contains specific functionality, with the main__init__.pyfile providing a unified public API that imports key classes and functions from their respective subpackages.\n__init__.py\nSources:src/gstools/__init__.py137-147src/gstools/__init__.py201-252src/gstools/tools/__init__.py75-83\nKey Geostatistical Workflows\nGSTools implements several fundamental geostatistical workflows through its core components:\nField Generation Workflow\nModel Definition: Create covariance model using classes likeGaussian,Exponential, orMatern\nExponential\nField Generation: InitializeSRFclass with the model and call with spatial coordinates\nConditioning(optional): UseCondSRFto honor known observations\nExport: Export results usingvtk_exportorto_pyvistamethods\nVariogram Analysis Workflow\nEmpirical Estimation: Usevario_estimatefunction to compute sample variogram\nvario_estimate\nModel Fitting: Applyfit_variogrammethod on covariance model classes\nfit_variogram\nValidation: Validate fitted parameters against empirical data\nIteration: Refine model parameters based on validation results\nKriging Interpolation Workflow\nSetup: InitializeKrigeclass with covariance model and known data points\nPrediction: Call kriging object with target locations for interpolation\nIntegration: Combine withSRFfor conditioned field generation\nSources:README.md117-227docs/source/index.rst171-293\nBackend System Architecture\nGSTools-Cython\nGSTools-Core\nGSTools supports two computational backends controlled through theconfigmodule:\nDefault Backend: UsesGSTools-Cythonwith optional OpenMP parallelization\nGSTools-Cython\nRust Backend: UsesGSTools-Corefor enhanced performance and automatic parallelization\nGSTools-Core\nRuntime Switching: Backend selection viaconfig.USE_GSTOOLS_COREflag\nconfig.USE_GSTOOLS_CORE\nThe backend system is transparent to users - the same API calls work regardless of the selected backend, with performance optimizations handled automatically.\nSources:docs/source/index.rst81-135README.md58-74\nIntegration and Export Capabilities\nGSTools provides extensive integration capabilities with the scientific Python ecosystem:\nVisualization Integration\nVTK Export:vtk_exportfunctions for ParaView visualization\nPyVista Integration:to_pyvistamethods for interactive 3D plotting\nMatplotlib Support: Built-in plotting methods for 2D visualization\nGeographic Support\nCoordinate Systems: Native support for latitude/longitude coordinates\nEarth Scaling: Built-in constants likeEARTH_RADIUSandKM_SCALE\nEARTH_RADIUS\nCartopy Integration: Seamless integration with geographic plotting libraries\nData Format Support\nNumPy Arrays: Direct compatibility with NumPy array structures\nMesh Formats: Support for structured and unstructured meshes\nMultiple Dimensions: 1D, 2D, and 3D field generation and analysis\nSources:src/gstools/tools/__init__.py112-123README.md143-184docs/source/index.rst202-246\nRefresh this wiki\nOn this page\nGSTools Overview\nPurpose and Scope\nWhat is GSTools?\nCore System Architecture\nMain Components and Code Organization\nKey Geostatistical Workflows\nField Generation Workflow\nVariogram Analysis Workflow\nKriging Interpolation Workflow\nBackend System Architecture\nIntegration and Export Capabilities\nVisualization Integration\nGeographic Support\nData Format Support",
81
+ "model": "gpt-4o-2024-08-06",
82
+ "source": "selenium",
83
+ "success": true
84
+ },
85
+ "code_complexity": {
86
+ "cyclomatic_complexity": "medium",
87
+ "cognitive_complexity": "medium",
88
+ "maintainability_index": 75
89
+ },
90
+ "security_analysis": {
91
+ "vulnerabilities_found": 0,
92
+ "security_score": 85,
93
+ "recommendations": []
94
+ }
95
+ },
96
+ "plugin_generation": {
97
+ "files_created": [
98
+ "mcp_output/start_mcp.py",
99
+ "mcp_output/mcp_plugin/__init__.py",
100
+ "mcp_output/mcp_plugin/mcp_service.py",
101
+ "mcp_output/mcp_plugin/adapter.py",
102
+ "mcp_output/mcp_plugin/main.py",
103
+ "mcp_output/requirements.txt",
104
+ "mcp_output/README_MCP.md"
105
+ ],
106
+ "main_entry": "start_mcp.py",
107
+ "requirements": [
108
+ "fastmcp>=0.1.0",
109
+ "pydantic>=2.0.0"
110
+ ],
111
+ "readme_path": "/export/zxcpu1/shiweijie/code/ghh/Code2MCP/workspace/GSTools/mcp_output/README_MCP.md",
112
+ "adapter_mode": "import",
113
+ "total_lines_of_code": 0,
114
+ "generated_files_size": 0,
115
+ "tool_endpoints": 0,
116
+ "supported_features": [
117
+ "Basic functionality"
118
+ ],
119
+ "generated_tools": [
120
+ "Basic tools",
121
+ "Health check tools",
122
+ "Version info tools"
123
+ ]
124
+ },
125
+ "code_review": {},
126
+ "errors": [],
127
+ "warnings": [],
128
+ "recommendations": [
129
+ "Improve test coverage by adding more unit tests",
130
+ "Ensure all dependencies are clearly defined in a requirements.txt or environment.yml file",
131
+ "Optimize large files for better performance",
132
+ "Enhance documentation for better clarity and user guidance",
133
+ "Implement continuous integration to automate testing and deployment",
134
+ "Refactor code to improve readability and maintainability",
135
+ "Consider adding more examples to demonstrate library usage",
136
+ "Evaluate and improve the performance of core functions",
137
+ "Ensure compatibility with the latest versions of dependencies",
138
+ "Conduct a security audit to identify and fix vulnerabilities"
139
+ ],
140
+ "performance_metrics": {
141
+ "memory_usage_mb": 0,
142
+ "cpu_usage_percent": 0,
143
+ "response_time_ms": 0,
144
+ "throughput_requests_per_second": 0
145
+ },
146
+ "deployment_info": {
147
+ "supported_platforms": [
148
+ "Linux",
149
+ "Windows",
150
+ "macOS"
151
+ ],
152
+ "python_versions": [
153
+ "3.8",
154
+ "3.9",
155
+ "3.10",
156
+ "3.11",
157
+ "3.12"
158
+ ],
159
+ "deployment_methods": [
160
+ "Docker",
161
+ "pip",
162
+ "conda"
163
+ ],
164
+ "monitoring_support": true,
165
+ "logging_configuration": "structured"
166
+ },
167
+ "execution_analysis": {
168
+ "success_factors": [
169
+ "Comprehensive analysis and generation nodes executed successfully",
170
+ "Successful integration of MCP plugin with healthy service status"
171
+ ],
172
+ "failure_reasons": [],
173
+ "overall_assessment": "excellent",
174
+ "node_performance": {
175
+ "download_time": "Efficient download with no delays",
176
+ "analysis_time": "Completed within expected duration",
177
+ "generation_time": "Efficient generation with no errors",
178
+ "test_time": "Original project tests failed, but MCP plugin tests passed"
179
+ },
180
+ "resource_usage": {
181
+ "memory_efficiency": "Memory usage data not available",
182
+ "cpu_efficiency": "CPU usage data not available",
183
+ "disk_usage": "Disk usage data not available"
184
+ }
185
+ },
186
+ "technical_quality": {
187
+ "code_quality_score": 75,
188
+ "architecture_score": 80,
189
+ "performance_score": 70,
190
+ "maintainability_score": 75,
191
+ "security_score": 85,
192
+ "scalability_score": 80
193
+ }
194
+ }
GSTools/source/.readthedocs.yml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: 2
2
+
3
+ build:
4
+ os: ubuntu-22.04
5
+ tools:
6
+ python: "3.11"
7
+
8
+ sphinx:
9
+ configuration: docs/source/conf.py
10
+
11
+ formats: [pdf]
12
+
13
+ python:
14
+ install:
15
+ - method: pip
16
+ path: .
17
+ extra_requirements:
18
+ - doc
GSTools/source/.zenodo.json ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "license": "LGPL-3.0-or-later",
3
+ "contributors": [
4
+ {
5
+ "type": "Other",
6
+ "name": "Bane Sullivan"
7
+ },
8
+ {
9
+ "orcid": "0000-0002-2547-8102",
10
+ "affiliation": "Helmholtz Centre for Environmental Research - UFZ",
11
+ "type": "ResearchGroup",
12
+ "name": "Falk He\u00dfe"
13
+ },
14
+ {
15
+ "orcid": "0000-0002-8783-6198",
16
+ "affiliation": "Hydrogeology Group, Department of Earth Science, Utrecht University, Netherlands",
17
+ "type": "ResearchGroup",
18
+ "name": "Alraune Zech"
19
+ },
20
+ {
21
+ "orcid": "0000-0002-7798-7080",
22
+ "affiliation": "Helmholtz Centre for Environmental Research - UFZ",
23
+ "type": "Supervisor",
24
+ "name": "Sabine Attinger"
25
+ }
26
+ ],
27
+ "language": "eng",
28
+ "keywords": [
29
+ "geostatistics",
30
+ "kriging",
31
+ "random fields",
32
+ "covariance models",
33
+ "variogram",
34
+ "Python",
35
+ "GeoStat-Framework"
36
+ ],
37
+ "creators": [
38
+ {
39
+ "orcid": "0000-0001-9060-4008",
40
+ "affiliation": "Helmholtz Centre for Environmental Research - UFZ",
41
+ "name": "Sebastian M\u00fcller"
42
+ },
43
+ {
44
+ "orcid": "0000-0001-9362-1372",
45
+ "affiliation": "Helmholtz Centre for Environmental Research - UFZ",
46
+ "name": "Lennart Sch\u00fcler"
47
+ }
48
+ ]
49
+ }
GSTools/source/AUTHORS.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Authors
2
+
3
+ GSTools is available on [GitHub](https://github.com/GeoStat-Framework/GSTools)
4
+ and was created by following people.
5
+
6
+
7
+ ## Core developers
8
+
9
+ - Sebastian Müller, GitHub: [@MuellerSeb](https://github.com/MuellerSeb), Email: <sebastian@geostat-framework.org>
10
+ - Lennart Schüler, GitHub: [@LSchueler](https://github.com/LSchueler), Email: <lennart@geostat-framework.org>
11
+
12
+
13
+ ## Contributors (in order of contributions)
14
+
15
+ - Falk Heße, GitHub: [@fhesze](https://github.com/fhesze), Email: <falk.hesse@ufz.de>
16
+ - Bane Sullivan, GitHub: [@banesullivan](https://github.com/banesullivan)
17
+ - Tobias Glaubach, GitHub: [@TobiasGlaubach](https://github.com/TobiasGlaubach)
GSTools/source/CHANGELOG.md ADDED
@@ -0,0 +1,538 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Changelog
2
+
3
+ All notable changes to **GSTools** will be documented in this file.
4
+
5
+ ## [Unreleased] - ?
6
+
7
+ ### Changes
8
+
9
+ - replace pylint, black, and isort with ruff [#391](https://github.com/GeoStat-Framework/GSTools/pull/391)
10
+
11
+ ## [1.7.0] - Morphic Mint - 2025-04
12
+
13
+ ### Enhancements
14
+
15
+ - new feature: Plurigaussian simulations (PGS) ([#370](https://github.com/GeoStat-Framework/GSTools/pull/370))
16
+ - they simulate distributions of categorical data, e.g. lithofacies, hydrofacies, soil types, or cementitious materials
17
+ - they naturally extend truncated Gaussian fields, which are already a part of GSTools through the field transformations
18
+ - new feature: support for Sum-Models ([#364](https://github.com/GeoStat-Framework/GSTools/pull/364))
19
+ - added `SumModel` class
20
+ - represents sum of covariance models
21
+ - behaves just as a normal covariance model with kriging and field generation
22
+ - covariance models can be added with overloaded `+` operator: `model = m1 + m2`
23
+ - class is subscriptable to access sub-models by index: `m1 = model[0]`
24
+ - included models will get a nugget of 0 and the nugget is stored separately in the sum-model
25
+ - model variance is the sum of the sub-model variances
26
+ - model length-scale is weighted sum of sub-model len-scales, where the weights are the ratios of the sub-models variance to the sum variance (motivated by the integral scale, which satisfies this relation)
27
+ - anisotropy and rotation need to be the same for all included sub-models
28
+ - parameters of the sub-models can be accessed by name with added index suffix: `model[0].nu == model.nu_0`
29
+ - fitting: if `len_scale` is fixed, none of the `len_scale_<i>` can be fixed since len_scale is calculated from variance ratios
30
+ - added Nugget class (empty SumModel)
31
+ - allow len scale of 0 in CovModel to enable a pure nugget model
32
+ - added `zero_var` and `model` attributes to Generator ABC to shortcut field generation for pure nugget models
33
+
34
+ ### Changes
35
+
36
+ - outsourced cython code to a separate package [GSTools-Cython](https://github.com/GeoStat-Framework/GSTools-Cython) ([#376](https://github.com/GeoStat-Framework/GSTools/pull/376))
37
+ - removed `var_raw` attribute from CovModel (was rarely used and only relevant for the truncated power law models)
38
+ - BREAKING CHANGE (but not to many should be affected)
39
+ - TPLCovModel now has a `intensity` attribute which calculates what `var_raw` was before
40
+ - simplified variogram fitting (`var_raw` was a bad idea in the first place)
41
+ - variogram plotting now handles a len-scale of 0 (to properly plot nugget models)
42
+ - fitting: when sill is given and var and nugget are deselected from fitting, an error is raised if given var+nugget is not equal to sill (before, they were reset under the hood in a strange way)
43
+
44
+ ### Bugfixes
45
+
46
+ - `pnt_cnt` was not recalculated in `vario_estimate` when a mask was applied, together with a given sample size this resulted in an `IndexError` most of the times ([#378](https://github.com/GeoStat-Framework/GSTools/pull/378))
47
+
48
+
49
+ ## [1.6.1] - Periodic Peach - 2025-01
50
+
51
+ see [#375](https://github.com/GeoStat-Framework/GSTools/pull/375)
52
+
53
+ - added wheels for Python 3.13
54
+
55
+ ### Bugfixes
56
+ - fix readthedocs.com problems ([#375](https://github.com/GeoStat-Framework/GSTools/pull/375))
57
+ - remove deprecated scipy dependency ([#375](https://github.com/GeoStat-Framework/GSTools/pull/375))
58
+
59
+
60
+ ## [1.6.0] - Periodic Peach - 2024-07
61
+
62
+ ### Enhancements
63
+ - add a new spatial random field generator called `Fourier` ([#302](https://github.com/GeoStat-Framework/GSTools/pull/302))
64
+ - create periodic spatial random fields with `Fourier`, by setting the period length with the keyword `periodic`
65
+ - add examples to showcase how to use the new generator
66
+
67
+ ### Bugfixes
68
+ - fix some Cython issues ([#354](https://github.com/GeoStat-Framework/GSTools/pull/354))
69
+ - update deprecated conditional compilation for OpenMP support
70
+ - fix changing between Cython and Rust backends
71
+ - improve documentation regarding parallelization
72
+ - fix deprecated license identifier, now Zenodo releases work again ([#356](https://github.com/GeoStat-Framework/GSTools/pull/356))
73
+
74
+ ### Changes
75
+ - require gstools-core v1.0.0 at least ([#361](https://github.com/GeoStat-Framework/GSTools/pull/361))
76
+
77
+
78
+ ## [1.5.2] - Nifty Neon - 2024-05
79
+
80
+ ### Enhancements
81
+
82
+ - added global variable `config.NUM_THREADS` to select number of threads for parallel computation ([#336](https://github.com/GeoStat-Framework/GSTools/pull/336))
83
+ - speed up sampling with emcee by setting `vectorize=True` in `EnsembleSampler` ([#346](https://github.com/GeoStat-Framework/GSTools/pull/346))
84
+ - prepare numpy 2 support ([#340](https://github.com/GeoStat-Framework/GSTools/pull/340))
85
+ - at least numpy 2.0.0rc1 for building extensions (for Python 3.9 and above)
86
+ - check multiple numpy and scipy versions in CI
87
+ - fixed minimal versions for numpy
88
+ - use `np.asarray` everywhere with `np.atleast_(n)d`
89
+ - fix long/longlong integer issue in cython on windows by always using 64bit integers
90
+
91
+ ### Bugfixes
92
+ - build docs with latest sphinx version ([#340](https://github.com/GeoStat-Framework/GSTools/pull/340))
93
+ - fixed zero division error in spectral density of Integral model ([#347](https://github.com/GeoStat-Framework/GSTools/pull/347))
94
+ - minor pylint fixes for used-before-assignment issues ([#350](https://github.com/GeoStat-Framework/GSTools/pull/350))
95
+
96
+ ### Changes
97
+ - require pyvista 0.40 at least ([#340](https://github.com/GeoStat-Framework/GSTools/pull/340))
98
+ - require matplotlib 3.7 at least ([#350](https://github.com/GeoStat-Framework/GSTools/pull/350))
99
+ - remove universal2 wheels for macos (we already provide separate intel and arm64 wheels) ([#350](https://github.com/GeoStat-Framework/GSTools/pull/350))
100
+
101
+
102
+ ## [1.5.1] - Nifty Neon - 2023-11
103
+
104
+ ### Enhancements
105
+
106
+ see [#317](https://github.com/GeoStat-Framework/GSTools/pull/317)
107
+
108
+ - added wheels for Python 3.12
109
+ - dropped support for Python 3.7 (EOL)
110
+ - linted Cython files with cython-lint
111
+ - use Cython 3 to build extensions
112
+
113
+
114
+ ## [1.5.0] - Nifty Neon - 2023-06
115
+
116
+ ### Enhancements
117
+ - added `temporal` flag to `CovModel` to explicitly specify spatio-temporal models [#308](https://github.com/GeoStat-Framework/GSTools/pull/308)
118
+ - rotation between spatial and temporal dimension will be ignored
119
+ - added `spatial_dim` to `CovModel` to explicitly set spatial dimension for spatio-temporal models
120
+ - if not using `spatial_dim`, the provided `dim` needs to include the possible temporal dimension
121
+ - `spatial_dim` is always one less than `field_dim` for spatio-temporal models
122
+ - also works with `latlon=True` to have a spatio-temporal model with geographic coordinates
123
+ - all plotting routines respect this
124
+ - the `Field` class now has a `temporal` attribute which forwards the model attribute
125
+ - automatic variogram fitting in kriging classes for `temporal=True` and `latlon=True` will raise an error
126
+ - added `geo_scale` to `CovModel` to have a more consistent way to set the units of the model length scale for geographic coordinates [#308](https://github.com/GeoStat-Framework/GSTools/pull/308)
127
+ - no need to use `rescale` for this anymore (was rather a hack)
128
+ - added `gs.KM_SCALE` which is the same as `gs.EARTH_RADIUS` for kilometer scaling
129
+ - added `gs.DEGREE_SCALE` for great circle distance in degrees
130
+ - added `gs.RADIAN_SCALE` for great circle distance in radians (default and previous behavior)
131
+ - yadrenko variogram respects this and assumes the great circle distances is given in the respective unit
132
+ - `vario_estimate` also has `geo_scale` now to control the units of the bins
133
+ - `vario_estimate` now forwards additional kwargs to `standard_bins` (`bin_no`, `max_dist`) [#308](https://github.com/GeoStat-Framework/GSTools/pull/308)
134
+ - added `low` and `high` arguments to `uniform` transformation [#310](https://github.com/GeoStat-Framework/GSTools/pull/310)
135
+
136
+ ### Changes
137
+ - `CovModel`s expect special arguments by keyword now [#308](https://github.com/GeoStat-Framework/GSTools/pull/308)
138
+ - always use f-strings internally [#283](https://github.com/GeoStat-Framework/GSTools/pull/283)
139
+ - removed `verbose` attribute from `RandMeth` classes [#309](https://github.com/GeoStat-Framework/GSTools/pull/309)
140
+ - all arguments for `RandMeth` classes key-word-only now except `model` [#309](https://github.com/GeoStat-Framework/GSTools/pull/309)
141
+ - rename "package" to "api" in doc structure [#290](https://github.com/GeoStat-Framework/GSTools/pull/290)
142
+
143
+ ### Bugfixes
144
+ - latex equations were not rendered correctly in docs [#290](https://github.com/GeoStat-Framework/GSTools/pull/290)
145
+
146
+
147
+ ## [1.4.1] - Sassy Sapphire - 2022-11
148
+
149
+ ### Enhancements
150
+ - new (Exponential-) Integral model added [#243](https://github.com/GeoStat-Framework/GSTools/pull/243)
151
+ - added wheels for Python 3.11 [#272](https://github.com/GeoStat-Framework/GSTools/pull/272)
152
+
153
+ ### Changes
154
+ - API documentation is polished and fully auto-generated now [#271](https://github.com/GeoStat-Framework/GSTools/pull/271)
155
+
156
+ ### Bugfixes
157
+ - fixed approximation of `Matern.spectrum` for big `nu` [#243](https://github.com/GeoStat-Framework/GSTools/pull/243)
158
+ - GSTools had wrong version when installed from git archive [#272](https://github.com/GeoStat-Framework/GSTools/pull/272)
159
+ - Field.plot: solve long-standing mpl slider bug [#273](https://github.com/GeoStat-Framework/GSTools/pull/273)
160
+
161
+
162
+ ## [1.4.0] - Sassy Sapphire - 2022-08
163
+
164
+ ### Enhancements
165
+ - added Youtube tutorial to documentation [#239](https://github.com/GeoStat-Framework/GSTools/pull/239)
166
+ - better support for custom generators [#250](https://github.com/GeoStat-Framework/GSTools/pull/250) [#259](https://github.com/GeoStat-Framework/GSTools/pull/259)
167
+ - add `valid_value_types` class variable to all field classes [#250](https://github.com/GeoStat-Framework/GSTools/pull/250)
168
+ - PyKrige: fix passed variogram in case of latlon models [#254](https://github.com/GeoStat-Framework/GSTools/pull/254)
169
+ - add bounds checks for optional arguments of `CovModel` when resetting by class attribute [#255](https://github.com/GeoStat-Framework/GSTools/pull/255)
170
+ - minor coverage improvements [#255](https://github.com/GeoStat-Framework/GSTools/pull/255)
171
+ - documentation: readability improvements [#257](https://github.com/GeoStat-Framework/GSTools/pull/257)
172
+
173
+ ### Changes
174
+ - drop Python 3.6 support (setuptools>60 needs py>3.7) [#241](https://github.com/GeoStat-Framework/GSTools/pull/241)
175
+ - move `setup.cfg` content to `pyproject.toml` ([PEP 621](https://peps.python.org/pep-0621/)) [#241](https://github.com/GeoStat-Framework/GSTools/pull/241)
176
+ - move to `src/` based package structure (better testing, building and structure) [#241](https://github.com/GeoStat-Framework/GSTools/pull/241)
177
+ - use [extension-helpers](https://pypi.org/project/extension-helpers/) for openmp support in `setup.py` [#241](https://github.com/GeoStat-Framework/GSTools/pull/241)
178
+ - increase minimal version of meshio to v5.1 [#241](https://github.com/GeoStat-Framework/GSTools/pull/241)
179
+
180
+ ### Bugfixes
181
+ - Pyvista v0.32 deprecation warning: use point_data instead of point_arrays [#237](https://github.com/GeoStat-Framework/GSTools/pull/237)
182
+ - remove deprecated scipy (v1.9) method pinv2 [#247](https://github.com/GeoStat-Framework/GSTools/pull/247)
183
+ - change float comparison in tests [#248](https://github.com/GeoStat-Framework/GSTools/pull/248)
184
+ - Cython: solve `-Wsometimes-uninitialized` warning [#255](https://github.com/GeoStat-Framework/GSTools/pull/255)
185
+
186
+
187
+ ## [1.3.5] - Pure Pink - 2022-01
188
+
189
+ ### Changes
190
+ - remove caps for dependencies [#229](https://github.com/GeoStat-Framework/GSTools/pull/229)
191
+ - build linux wheels with manylinux2014 for all versions ([CIBW v2.3.1](https://github.com/pypa/cibuildwheel/releases/tag/v2.3.1)) [#227](https://github.com/GeoStat-Framework/GSTools/pull/227)
192
+
193
+ ### Bugfixes
194
+ - `Field.mesh` was not compatible with [meshio](https://github.com/nschloe/meshio) v5.1+ [#227](https://github.com/GeoStat-Framework/GSTools/pull/227)
195
+
196
+
197
+ ## [1.3.4] - Pure Pink - 2021-11
198
+
199
+ ### Enhancements
200
+ - add GStools-Core as optional dependency [#215](https://github.com/GeoStat-Framework/GSTools/pull/215)
201
+ - provide wheels for Python 3.10 [#211](https://github.com/GeoStat-Framework/GSTools/pull/211)
202
+ - provide macOS wheels for Apple Silicon [#211](https://github.com/GeoStat-Framework/GSTools/pull/211)
203
+
204
+ ### Changes
205
+ - remove unnecessary `dim` argument in Cython code [#216](https://github.com/GeoStat-Framework/GSTools/issues/216)
206
+
207
+
208
+ ## [1.3.3] - Pure Pink - 2021-08
209
+
210
+ ### Enhancements
211
+ See: [#197](https://github.com/GeoStat-Framework/GSTools/issues/197)
212
+ - `gstools.transform`:
213
+ - add keywords `field`, `store`, `process` and `keep_mean` to all transformations to control storage and respect `normalizer`
214
+ - added `apply_function` transformation
215
+ - added `apply` as wrapper for all transformations
216
+ - added `transform` method to all `Field` (sub)classes as interface to `transform.apply`
217
+ - added checks for normal fields to work smoothly with recently added `normalizer` submodule
218
+ - `Field`:
219
+ - allow naming fields when generating and control storage with `store` keyword
220
+ - all subclasses now have the `post_process` keyword (apply mean, normalizer, trend)
221
+ - added subscription to access fields by name (`Field["field"]`)
222
+ - added `set_pos` method to set position tuple
223
+ - allow reusing present `pos` tuple
224
+ - added `pos`, `mesh_type`, `field_names`, `field_shape`, `all_fields` properties
225
+ - `CondSRF`:
226
+ - memory optimization by forwarding `pos` from underlying `krige` instance
227
+ - only recalculate kriging field if `pos` tuple changed (optimized ensemble generation)
228
+ - performance improvement by using `np.asarray` instead of `np.array` where possible
229
+ - updated examples to use new features
230
+ - added incomplete lower gamma function `inc_gamma_low` (for TPLGaussian spectral density)
231
+ - filter `nan` values from `cond_val` array in all kriging routines [#201](https://github.com/GeoStat-Framework/GSTools/issues/201)
232
+
233
+ ### Bugfixes
234
+ - `inc_gamma` was defined wrong for integer `s < 0`
235
+
236
+
237
+ ## [1.3.2] - Pure Pink - 2021-07
238
+
239
+ ### Bugfixes
240
+ - `vario_estimate` was altering the input field under certain circumstances [#180](https://github.com/GeoStat-Framework/GSTools/issues/180)
241
+ - `emcee` v3.1 now requires `nsteps` in `run_mcmc()` to be integer (called in `RNG.sample_ln_pdf`) [#184](https://github.com/GeoStat-Framework/GSTools/pull/184)
242
+
243
+
244
+ ## [1.3.1] - Pure Pink - 2021-06
245
+
246
+ ### Enhancements
247
+ - Standalone use of Field class [#166](https://github.com/GeoStat-Framework/GSTools/issues/166)
248
+ - add social badges in README [#169](https://github.com/GeoStat-Framework/GSTools/issues/169), [#170](https://github.com/GeoStat-Framework/GSTools/issues/170)
249
+
250
+ ### Bugfixes
251
+ - use `oldest-supported-numpy` to build cython extensions [#165](https://github.com/GeoStat-Framework/GSTools/pull/165)
252
+
253
+
254
+ ## [1.3.0] - Pure Pink - 2021-04
255
+
256
+ ### Topics
257
+
258
+ #### Geographical Coordinates Support ([#113](https://github.com/GeoStat-Framework/GSTools/issues/113))
259
+ - added boolean init parameter `latlon` to indicate a geographic model. When given, spatial dimension is fixed to `dim=3`, `anis` and `angles` will be ignored, since anisotropy is not well-defined on a sphere.
260
+ - add property `field_dim` to indicate the dimension of the resulting field. Will be 2 if `latlon=True`
261
+ - added yadrenko variogram, covariance and correlation method, since the geographic models are derived from standard models in 3D by plugging in the chordal distance of two points on a sphere derived from there great-circle distance `zeta`:
262
+ - `vario_yadrenko`: given by `variogram(2 * np.sin(zeta / 2))`
263
+ - `cov_yadrenko`: given by `covariance(2 * np.sin(zeta / 2))`
264
+ - `cor_yadrenko`: given by `correlation(2 * np.sin(zeta / 2))`
265
+ - added plotting routines for yadrenko methods described above
266
+ - the `isometrize` and `anisometrize` methods will convert `latlon` tuples (given in degree) to points on the unit-sphere in 3D and vice versa
267
+ - representation of geographical models don't display the `dim`, `anis` and `angles` parameters, but `latlon=True`
268
+ - `fit_variogram` will expect an estimated variogram with great-circle distances given in radians
269
+ - **Variogram estimation**
270
+ - `latlon` switch implemented in `estimate_vario` routine
271
+ - will return a variogram estimated by the great-circle distance (haversine formula) given in radians
272
+ - **Field**
273
+ - added plotting routines for latlon fields
274
+ - no vector fields possible on latlon fields
275
+ - corretly handle pos tuple for latlon fields
276
+
277
+ #### Krige Unification ([#97](https://github.com/GeoStat-Framework/GSTools/issues/97))
278
+ - Swiss Army Knife for kriging: The `Krige` class now provides everything in one place
279
+ - "Kriging the mean" is now possible with the switch `only_mean` in the call routine
280
+ - `Simple`/`Ordinary`/`Universal`/`ExtDrift`/`Detrended` are only shortcuts to `Krige` with limited input parameter list
281
+ - We now use the `covariance` function to build up the kriging matrix (instead of variogram)
282
+ - An `unbiased` switch was added to enable simple kriging (where the unbiased condition is not given)
283
+ - An `exact` switch was added to allow smother results, if a `nugget` is present in the model
284
+ - An `cond_err` parameter was added, where measurement error variances can be given for each conditional point
285
+ - pseudo-inverse matrix is now used to solve the kriging system (can be disabled by the new switch `pseudo_inv`), this is equal to solving the system with least-squares and prevents numerical errors
286
+ - added options `fit_normalizer` and `fit_variogram` to automatically fit normalizer and variogram to given data
287
+
288
+ #### Directional Variograms and Auto-binning ([#87](https://github.com/GeoStat-Framework/GSTools/issues/87), [#106](https://github.com/GeoStat-Framework/GSTools/issues/106), [#131](https://github.com/GeoStat-Framework/GSTools/issues/131))
289
+ - new routine name `vario_estimate` instead of `vario_estimate_unstructured` (old kept for legacy code) for simplicity
290
+ - new routine name `vario_estimate_axis` instead of `vario_estimate_structured` (old kept for legacy code) for simplicity
291
+ - **vario_estimate**
292
+ - added simple automatic binning routine to determine bins from given data (one third of box diameter as max bin distance, sturges rule for number of bins)
293
+ - allow to pass multiple fields for joint variogram estimation (e.g. for daily precipitation) on same mesh
294
+ - `no_data` option added to allow missing values
295
+ - **masked fields**
296
+ - user can now pass a masked array (or a list of masked arrays) to deselect data points.
297
+ - in addition, a `mask` keyword was added to provide an external mask
298
+ - **directional variograms**
299
+ - diretional variograms can now be estimated
300
+ - either provide a list of direction vectors or angles for directions (spherical coordinates)
301
+ - can be controlled by given angle tolerance and (optional) bandwidth
302
+ - prepared for nD
303
+ - structured fields (pos tuple describes axes) can now be passed to estimate an isotropic or directional variogram
304
+ - distance calculation in cython routines in now independent of dimension
305
+ - **vario_estimate_axis**
306
+ - estimation along array axis now possible in arbitrary dimensions
307
+ - `no_data` option added to allow missing values (sovles [#83](https://github.com/GeoStat-Framework/GSTools/issues/83))
308
+ - axis can be given by name (`"x"`, `"y"`, `"z"`) or axis number (`0`, `1`, `2`, `3`, ...)
309
+
310
+ #### Better Variogram fitting ([#78](https://github.com/GeoStat-Framework/GSTools/issues/78), [#145](https://github.com/GeoStat-Framework/GSTools/pull/145))
311
+ - fixing sill possible now
312
+ - `loss` is now selectable for smoother handling of outliers
313
+ - r2 score can now be returned to get an impression of the goodness of fitting
314
+ - weights can be passed
315
+ - instead of deselecting parameters, one can also give fix values for each parameter
316
+ - default init guess for `len_scale` is now mean of given bin-centers
317
+ - default init guess for `var` and `nugget` is now mean of given variogram values
318
+
319
+ #### CovModel update ([#109](https://github.com/GeoStat-Framework/GSTools/issues/109), [#122](https://github.com/GeoStat-Framework/GSTools/issues/122), [#157](https://github.com/GeoStat-Framework/GSTools/pull/157))
320
+ - add new `rescale` argument and attribute to the `CovModel` class to be able to rescale the `len_scale` (usefull for unit conversion or rescaling `len_scale` to coincide with the `integral_scale` like it's the case with the Gaussian model)
321
+ See: [#90](https://github.com/GeoStat-Framework/GSTools/issues/90), [GeoStat-Framework/PyKrige#119](https://github.com/GeoStat-Framework/PyKrige/issues/119)
322
+ - added new `len_rescaled` attribute to the `CovModel` class, which is the rescaled `len_scale`: `len_rescaled = len_scale / rescale`
323
+ - new method `default_rescale` to provide default rescale factor (can be overridden)
324
+ - remove `doctest` calls
325
+ - docstring updates in `CovModel` and derived models
326
+ - updated all models to use the `cor` routine and make use of the `rescale` argument (See: [#90](https://github.com/GeoStat-Framework/GSTools/issues/90))
327
+ - TPL models got a separate base class to not repeat code
328
+ - added **new models** (See: [#88](https://github.com/GeoStat-Framework/GSTools/issues/88)):
329
+ - `HyperSpherical`: (Replaces the old `Intersection` model) Derived from the intersection of hyper-spheres in arbitrary dimensions. Coincides with the linear model in 1D, the circular model in 2D and the classical spherical model in 3D
330
+ - `SuperSpherical`: like the HyperSpherical, but the shape parameter derived from dimension can be set by the user. Coincides with the HyperSpherical model by default
331
+ - `JBessel`: a hole model valid in all dimensions. The shape parameter controls the dimension it was derived from. For `nu=0.5` this model coincides with the well known `wave` hole model.
332
+ - `TPLSimple`: a simple truncated power law controlled by a shape parameter `nu`. Coincides with the truncated linear model for `nu=1`
333
+ - `Cubic`: to be compatible with scikit-gstat in the future
334
+ - all arguments are now stored as float internally ([#157](https://github.com/GeoStat-Framework/GSTools/pull/157))
335
+ - string representation of the `CovModel` class is now using a float precision (`CovModel._prec=3`) to truncate longish output
336
+ - string representation of the `CovModel` class now only shows `anis` and `angles` if model is anisotropic resp. rotated
337
+ - dimension validity check: raise a warning, if given model is not valid in the desired dimension (See: [#86](https://github.com/GeoStat-Framework/GSTools/issues/86))
338
+
339
+ #### Normalizer, Trend and Mean ([#124](https://github.com/GeoStat-Framework/GSTools/issues/124))
340
+
341
+ - new `normalize` submodule containing power-transforms for data to gain normality
342
+ - Base-Class: `Normalizer` providing basic functionality including maximum likelihood fitting
343
+ - added: `LogNormal`, `BoxCox`, `BoxCoxShift`, `YeoJohnson`, `Modulus` and `Manly`
344
+ - normalizer, trend and mean can be passed to SRF, Krige and variogram estimation routines
345
+ - A trend can be a callable function, that represents a trend in input data. For example a linear decrease of temperature with height.
346
+ - The normalizer will be applied after the data was detrended, i.e. the trend was substracted from the data, in order to gain normality.
347
+ - The mean is now interpreted as the mean of the normalized data. The user could also provide a callable mean, but it is mostly meant to be constant.
348
+
349
+ #### Arbitrary dimensions ([#112](https://github.com/GeoStat-Framework/GSTools/issues/112))
350
+ - allow arbitrary dimensions in all routines (CovModel, Krige, SRF, variogram)
351
+ - anisotropy and rotation following a generalization of tait-bryan angles
352
+ - `CovModel` provides `isometrize` and `anisometrize` routines to convert points
353
+
354
+ #### New Class for Conditioned Random Fields ([#130](https://github.com/GeoStat-Framework/GSTools/issues/130))
355
+ - **THIS BREAKS BACKWARD COMPATIBILITY**
356
+ - `CondSRF` replaces the conditioning feature of the SRF class, which was cumbersome and limited to Ordinary and Simple kriging
357
+ - `CondSRF` behaves similar to the `SRF` class, but instead of a covariance model, it takes a kriging class as input. With this kriging class, all conditioning related settings are defined.
358
+
359
+ ### Enhancements
360
+ - Python 3.9 Support [#107](https://github.com/GeoStat-Framework/GSTools/issues/107)
361
+ - add routines to format struct. pos tuple by given `dim` or `shape`
362
+ - add routine to format struct. pos tuple by given `shape` (variogram helper)
363
+ - remove `field.tools` subpackage
364
+ - support `meshio>=4.0` and add as dependency
365
+ - PyVista mesh support [#59](https://github.com/GeoStat-Framework/GSTools/issues/59)
366
+ - added `EARTH_RADIUS` as constant providing earths radius in km (can be used to rescale models)
367
+ - add routines `latlon2pos` and `pos2latlon` to convert lat-lon coordinates to points on unit-sphere and vice versa
368
+ - a lot of new examples and tutorials
369
+ - `RandMeth` class got a switch to select the sampling strategy
370
+ - plotter for n-D fields added [#141](https://github.com/GeoStat-Framework/GSTools/issues/141)
371
+ - antialias for contour plots of 2D fields [#141](https://github.com/GeoStat-Framework/GSTools/issues/141)
372
+ - building from source is now configured with `pyproject.toml` to care about build dependencies, see [#154](https://github.com/GeoStat-Framework/GSTools/issues/154)
373
+
374
+ ### Changes
375
+ - drop support for Python 3.5 [#146](https://github.com/GeoStat-Framework/GSTools/pull/146)
376
+ - added a finit limit for shape-parameters in some `CovModel`s [#147](https://github.com/GeoStat-Framework/GSTools/pull/147)
377
+ - drop usage of `pos2xyz` and `xyz2pos`
378
+ - remove structured option from generators (structured pos need to be converted first)
379
+ - explicitly assert dim=2,3 when generating vector fields
380
+ - simplify `pre_pos` routine to save pos tuple and reformat it an unstructured tuple
381
+ - simplify field shaping
382
+ - simplify plotting routines
383
+ - only the `"unstructured"` keyword is recognized everywhere, everything else is interpreted as `"structured"` (e.g. `"rectilinear"`)
384
+ - use GitHub-Actions instead of TravisCI
385
+ - parallel build now controlled by env-var `GSTOOLS_BUILD_PARALLEL=1`, see [#154](https://github.com/GeoStat-Framework/GSTools/issues/154)
386
+ - install extra target for `[dev]` dropped, can be reproduced by `pip install gstools[test, doc]`, see [#154](https://github.com/GeoStat-Framework/GSTools/issues/154)
387
+
388
+ ### Bugfixes
389
+ - typo in keyword argument for vario_estimate_structured [#80](https://github.com/GeoStat-Framework/GSTools/issues/80)
390
+ - isotropic rotation of SRF was not possible [#100](https://github.com/GeoStat-Framework/GSTools/issues/100)
391
+ - `CovModel.opt_arg` now sorted [#103](https://github.com/GeoStat-Framework/GSTools/issues/103)
392
+ - `CovModel.fit`: check if weights are given as a string (numpy comparison error) [#111](https://github.com/GeoStat-Framework/GSTools/issues/111)
393
+ - several pylint fixes ([#159](https://github.com/GeoStat-Framework/GSTools/pull/159))
394
+
395
+
396
+ ## [1.2.1] - Volatile Violet - 2020-04-14
397
+
398
+ ### Bugfixes
399
+ - `ModuleNotFoundError` is not present in py35
400
+ - Fixing Cressie-Bug #76
401
+ - Adding analytical formula for integral scales of rational and stable model
402
+ - remove prange from IncomprRandMeth summators to prevent errors on Win and macOS
403
+
404
+
405
+ ## [1.2.0] - Volatile Violet - 2020-03-20
406
+
407
+ ### Enhancements
408
+ - different variogram estimator functions can now be used #51
409
+ - the TPLGaussian and TPLExponential now have analytical spectra #67
410
+ - added property `is_isotropic` to `CovModel` #67
411
+ - reworked the whole krige sub-module to provide multiple kriging methods #67
412
+ - Simple
413
+ - Ordinary
414
+ - Universal
415
+ - External Drift Kriging
416
+ - Detrended Kriging
417
+ - a new transformation function for discrete fields has been added #70
418
+ - reworked tutorial section in the documentation #63
419
+ - pyvista interface #29
420
+
421
+ ### Changes
422
+ - Python versions 2.7 and 3.4 are no longer supported #40 #43
423
+ - `CovModel`: in 3D the input of anisotropy is now treated slightly different: #67
424
+ - single given anisotropy value [e] is converted to [1, e] (it was [e, e] before)
425
+ - two given length-scales [l_1, l_2] are converted to [l_1, l_2, l_2] (it was [l_1, l_2, l_1] before)
426
+
427
+ ### Bugfixes
428
+ - a race condition in the structured variogram estimation has been fixed #51
429
+
430
+
431
+ ## [1.1.1] - Reverberating Red - 2019-11-08
432
+
433
+ ### Enhancements
434
+ - added a changelog. See: [commit fbea883](https://github.com/GeoStat-Framework/GSTools/commit/fbea88300d0862393e52f4b7c3d2b15c2039498b)
435
+
436
+ ### Changes
437
+ - deprecation warnings are now printed if Python versions 2.7 or 3.4 are used #40 #41
438
+
439
+ ### Bugfixes
440
+ - define spectral_density instead of spectrum in covariance models since Cov-base derives spectrum. See: [commit 00f2747](https://github.com/GeoStat-Framework/GSTools/commit/00f2747fd0503ff8806f2eebfba36acff813416b)
441
+ - better boundaries for `CovModel` parameters. See: https://github.com/GeoStat-Framework/GSTools/issues/37
442
+
443
+
444
+ ## [1.1.0] - Reverberating Red - 2019-10-01
445
+
446
+ ### Enhancements
447
+ - by using Cython for all the heavy computations, we could achieve quite some speed ups and reduce the memory consumption significantly #16
448
+ - parallel computation in Cython is now supported with the help of OpenMP and the performance increase is nearly linear with increasing cores #16
449
+ - new submodule `krige` providing simple (known mean) and ordinary (estimated mean) kriging working analogous to the srf class
450
+ - interface to pykrige to use the gstools `CovModel` with the pykrige routines (https://github.com/bsmurphy/PyKrige/issues/124)
451
+ - the srf class now provides a `plot` and a `vtk_export` routine
452
+ - incompressible flow fields can now be generated #14
453
+ - new submodule providing several field transformations like: Zinn&Harvey, log-normal, bimodal, ... #13
454
+ - Python 3.4 and 3.7 wheel support #19
455
+ - field can now be generated directly on meshes from [meshio](https://github.com/nschloe/meshio) and [ogs5py](https://github.com/GeoStat-Framework/ogs5py), see: [commit f4a3439](https://github.com/GeoStat-Framework/GSTools/commit/f4a3439400b81d8d9db81a5f7fbf6435f603cf05)
456
+ - the srf and kriging classes now store the last `pos`, `mesh_type` and `field` values to keep them accessible, see: [commit 29f7f1b](https://github.com/GeoStat-Framework/GSTools/commit/29f7f1b029866379ce881f44765f72534d757fae)
457
+ - tutorials on all important features of GSTools have been written for you guys #20
458
+ - a new interface to pyvista is provided to export fields to python vtk representation, which can be used for plotting, exploring and exporting fields #29
459
+
460
+ ### Changes
461
+ - the license was changed from GPL to LGPL in order to promote the use of this library #25
462
+ - the rotation angles are now interpreted in positive direction (counter clock wise)
463
+ - the `force_moments` keyword was removed from the SRF call method, it is now in provided as a field transformation #13
464
+ - drop support of python implementations of the variogram estimators #18
465
+ - the `variogram_normed` method was removed from the `CovModel` class due to redundance [commit 25b1647](https://github.com/GeoStat-Framework/GSTools/commit/25b164722ac6744ebc7e03f3c0bf1c30be1eba89)
466
+ - the position vector of 1D fields does not have to be provided in a list-like object with length 1 [commit a6f5be8](https://github.com/GeoStat-Framework/GSTools/commit/a6f5be8bfd2db1f002e7889ecb8e9a037ea08886)
467
+
468
+ ### Bugfixes
469
+ - several minor bugfixes
470
+
471
+
472
+ ## [1.0.1] - Bouncy Blue - 2019-01-18
473
+
474
+ ### Bugfixes
475
+ - fixed Numpy and Cython version during build process
476
+
477
+
478
+ ## [1.0.0] - Bouncy Blue - 2019-01-16
479
+
480
+ ### Enhancements
481
+ - added a new covariance class, which allows the easy usage of arbitrary covariance models
482
+ - added many predefined covariance models, including truncated power law models
483
+ - added [tutorials](https://geostat-framework.readthedocs.io/projects/gstools/en/latest/tutorials.html) and examples, showing and explaining the main features of GSTools
484
+ - variogram models can be fitted to data
485
+ - prebuilt binaries for many Linux distributions, Mac OS and Windows, making the installation, especially of the Cython code, much easier
486
+ - the generated fields can now easily be exported to vtk files
487
+ - variance scaling is supported for coarser grids
488
+ - added pure Python versions of the variogram estimators, in case somebody has problems compiling Cython code
489
+ - the [documentation](https://geostat-framework.readthedocs.io/projects/gstools/en/latest/) is now a lot cleaner and easier to use
490
+ - the code is a lot cleaner and more consistent now
491
+ - unit tests are now automatically tested when new code is pushed
492
+ - test coverage of code is shown
493
+ - GeoStat Framework now has a website, visit us: https://geostat-framework.github.io/
494
+
495
+ ### Changes
496
+ - release is not downwards compatible with release v0.4.0
497
+ - SRF creation has been adapted for the `CovModel`
498
+ - a tuple `pos` is now used instead of `x`, `y`, and `z` for the axes
499
+ - renamed `estimate_unstructured` and `estimate_structured` to `vario_estimate_unstructured` and `vario_estimate_structured` for less ambiguity
500
+
501
+ ### Bugfixes
502
+ - several minor bugfixes
503
+
504
+
505
+ ## [0.4.0] - Glorious Green - 2018-07-17
506
+
507
+ ### Bugfixes
508
+ - import of cython functions put into a try-block
509
+
510
+
511
+ ## [0.3.6] - Original Orange - 2018-07-17
512
+
513
+ First release of GSTools.
514
+
515
+
516
+ [Unreleased]: https://github.com/GeoStat-Framework/gstools/compare/v1.7.0...HEAD
517
+ [1.7.0]: https://github.com/GeoStat-Framework/gstools/compare/v1.6.1...v1.7.0
518
+ [1.6.1]: https://github.com/GeoStat-Framework/gstools/compare/v1.6.0...v1.6.1
519
+ [1.6.0]: https://github.com/GeoStat-Framework/gstools/compare/v1.5.2...v1.6.0
520
+ [1.5.2]: https://github.com/GeoStat-Framework/gstools/compare/v1.5.1...v1.5.2
521
+ [1.5.1]: https://github.com/GeoStat-Framework/gstools/compare/v1.5.0...v1.5.1
522
+ [1.5.0]: https://github.com/GeoStat-Framework/gstools/compare/v1.4.1...v1.5.0
523
+ [1.4.1]: https://github.com/GeoStat-Framework/gstools/compare/v1.4.0...v1.4.1
524
+ [1.4.0]: https://github.com/GeoStat-Framework/gstools/compare/v1.3.5...v1.4.0
525
+ [1.3.5]: https://github.com/GeoStat-Framework/gstools/compare/v1.3.4...v1.3.5
526
+ [1.3.4]: https://github.com/GeoStat-Framework/gstools/compare/v1.3.3...v1.3.4
527
+ [1.3.3]: https://github.com/GeoStat-Framework/gstools/compare/v1.3.2...v1.3.3
528
+ [1.3.2]: https://github.com/GeoStat-Framework/gstools/compare/v1.3.1...v1.3.2
529
+ [1.3.1]: https://github.com/GeoStat-Framework/gstools/compare/v1.3.0...v1.3.1
530
+ [1.3.0]: https://github.com/GeoStat-Framework/gstools/compare/v1.2.1...v1.3.0
531
+ [1.2.1]: https://github.com/GeoStat-Framework/gstools/compare/v1.2.0...v1.2.1
532
+ [1.2.0]: https://github.com/GeoStat-Framework/gstools/compare/v1.1.1...v1.2.0
533
+ [1.1.1]: https://github.com/GeoStat-Framework/gstools/compare/v1.1.0...v1.1.1
534
+ [1.1.0]: https://github.com/GeoStat-Framework/gstools/compare/v1.0.1...v1.1.0
535
+ [1.0.1]: https://github.com/GeoStat-Framework/gstools/compare/v1.0.0...v1.0.1
536
+ [1.0.0]: https://github.com/GeoStat-Framework/gstools/compare/0.4.0...v1.0.0
537
+ [0.4.0]: https://github.com/GeoStat-Framework/gstools/compare/0.3.6...0.4.0
538
+ [0.3.6]: https://github.com/GeoStat-Framework/gstools/releases/tag/0.3.6
GSTools/source/CITATION.bib ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @Article{gmd-15-3161-2022,
2
+ AUTHOR = {M\"uller, S. and Sch\"uler, L. and Zech, A. and He{\ss}e, F.},
3
+ TITLE = {\texttt{GSTools} v1.3: a toolbox for geostatistical modelling in Python},
4
+ JOURNAL = {Geoscientific Model Development},
5
+ VOLUME = {15},
6
+ YEAR = {2022},
7
+ NUMBER = {7},
8
+ PAGES = {3161--3182},
9
+ URL = {https://gmd.copernicus.org/articles/15/3161/2022/},
10
+ DOI = {10.5194/gmd-15-3161-2022}
11
+ }
GSTools/source/CONTRIBUTING.md ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # How to Contribute to GSTools
2
+
3
+ We are happy about all contributions! :thumbsup:
4
+
5
+
6
+ ## Did you find a bug?
7
+
8
+ - Ensure that the bug was not already reported under
9
+ [GitHub issues](https://github.com/GeoStat-Framework/GSTools/issues)
10
+ - If the bug wasn't already reported, open a
11
+ [new issue](https://github.com/GeoStat-Framework/GSTools/issues) with a clear
12
+ description of the problem and if possible with a
13
+ [minimal working example](https://en.wikipedia.org/wiki/Minimal_working_example).
14
+ - please add the version number to the issue:
15
+
16
+ ```python
17
+ import gstools
18
+ print(gstools.__version__)
19
+ ```
20
+
21
+
22
+ ## Do you have suggestions for new features?
23
+
24
+ Open a [new issue](https://github.com/GeoStat-Framework/GSTools/issues)
25
+ with your idea or suggestion and we'd love to discuss about it.
26
+
27
+
28
+ ## Do you want to enhance GSTools or fix something?
29
+
30
+ - Fork the repo on [GitHub](https://github.com/GeoStat-Framework/GSTools)
31
+ - Add yourself to AUTHORS.md (if you want to).
32
+ - We use [Ruff](https://github.com/psf/black) to check and format the code.
33
+ Please use the scripts `ruff check src/gstools` and
34
+ `ruff format --diff src/gstools/` after you have written your code.
35
+ - Add some tests if possible.
36
+ - Add an example showing your new feature in one of the examples sub-folders if possible.
37
+ Follow this [Sphinx-Gallary guide](https://sphinx-gallery.github.io/stable/syntax.html#embed-rst-in-your-example-python-files).
38
+ - Push to your fork and submit a pull request.
GSTools/source/LICENSE ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
GSTools/source/README.md ADDED
@@ -0,0 +1,443 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Welcome to GSTools
2
+ [![GMD](https://img.shields.io/badge/GMD-10.5194%2Fgmd--15--3161--2022-orange)](https://doi.org/10.5194/gmd-15-3161-2022)
3
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1313628.svg)](https://doi.org/10.5281/zenodo.1313628)
4
+ [![PyPI version](https://badge.fury.io/py/gstools.svg)](https://badge.fury.io/py/gstools)
5
+ [![Conda Version](https://img.shields.io/conda/vn/conda-forge/gstools.svg)](https://anaconda.org/conda-forge/gstools)
6
+ [![Build Status](https://github.com/GeoStat-Framework/GSTools/workflows/Continuous%20Integration/badge.svg?branch=main)](https://github.com/GeoStat-Framework/GSTools/actions)
7
+ [![Coverage Status](https://coveralls.io/repos/github/GeoStat-Framework/GSTools/badge.svg?branch=main)](https://coveralls.io/github/GeoStat-Framework/GSTools?branch=main)
8
+ [![Documentation Status](https://readthedocs.org/projects/gstools/badge/?version=latest)](https://geostat-framework.readthedocs.io/projects/gstools/en/stable/?badge=stable)
9
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
10
+
11
+ <p align="center">
12
+ <img src="https://raw.githubusercontent.com/GeoStat-Framework/GSTools/main/docs/source/pics/gstools.png" alt="GSTools-LOGO" width="251px"/>
13
+ </p>
14
+
15
+ <p align="center"><b>Get in Touch!</b></p>
16
+ <p align="center">
17
+ <a href="https://github.com/GeoStat-Framework/GSTools/discussions"><img src="https://img.shields.io/badge/GitHub-Discussions-f6f8fa?logo=github&style=flat" alt="GH-Discussions"/></a>
18
+ <a href="mailto:info@geostat-framework.org"><img src="https://img.shields.io/badge/Email-GeoStat--Framework-468a88?style=flat&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbDpzcGFjZT0icHJlc2VydmUiIHdpZHRoPSI1MDAiIGhlaWdodD0iNTAwIj48cGF0aCBkPSJNNDQ4IDg4SDUyYy0yNyAwLTQ5IDIyLTQ5IDQ5djIyNmMwIDI3IDIyIDQ5IDQ5IDQ5aDM5NmMyNyAwIDQ5LTIyIDQ5LTQ5VjEzN2MwLTI3LTIyLTQ5LTQ5LTQ5em0xNiA0OXYyMjZsLTIgNy0xMTUtMTE2IDExNy0xMTd6TTM2IDM2M1YxMzdsMTE3IDExN0wzOCAzNzBsLTItN3ptMjE5LTYzYy0zIDMtNyAzLTEwIDBMNjYgMTIxaDM2OHptLTc5LTIzIDQ2IDQ2YTM5IDM5IDAgMCAwIDU2IDBsNDYtNDYgMTAxIDEwMkg3NXoiIHN0eWxlPSJmaWxsOiNmNWY1ZjU7ZmlsbC1vcGFjaXR5OjEiLz48L3N2Zz4=" alt="Email"/></a>
19
+ </p>
20
+
21
+ <p align="center"><b>Youtube Tutorial on GSTools</b><br></p>
22
+
23
+ <p align="center">
24
+ <a href="http://www.youtube.com/watch?feature=player_embedded&v=qZBJ-AZXq6Q" target="_blank">
25
+ <img src="http://img.youtube.com/vi/qZBJ-AZXq6Q/0.jpg" alt="GSTools Transform 22 tutorial" width="480" height="360" border="0" />
26
+ </a>
27
+ </p>
28
+
29
+ ## Purpose
30
+
31
+ <img align="right" width="450" src="https://raw.githubusercontent.com/GeoStat-Framework/GSTools/main/docs/source/pics/demonstrator.png" alt="">
32
+
33
+ GSTools provides geostatistical tools for various purposes:
34
+ - random field generation, including periodic boundaries
35
+ - simple, ordinary, universal and external drift kriging
36
+ - conditioned field generation
37
+ - incompressible random vector field generation
38
+ - (automated) variogram estimation and fitting
39
+ - directional variogram estimation and modelling
40
+ - data normalization and transformation
41
+ - many readily provided and even user-defined covariance models
42
+ - metric spatio-temporal modelling
43
+ - plurigaussian field simulations (PGS)
44
+ - plotting and exporting routines
45
+
46
+
47
+ ## Installation
48
+
49
+
50
+ ### conda
51
+
52
+ GSTools can be installed via [conda][conda_link] on Linux, Mac, and Windows.
53
+ Install the package by typing the following command in a command terminal:
54
+
55
+ conda install gstools
56
+
57
+ In case conda forge is not set up for your system yet, see the easy to follow
58
+ instructions on [conda forge][conda_forge_link]. Using conda, the parallelized
59
+ version of GSTools should be installed.
60
+
61
+
62
+ ### pip
63
+
64
+ GSTools can be installed via [pip][pip_link] on Linux, Mac, and Windows.
65
+ On Windows you can install [WinPython][winpy_link] to get Python and pip
66
+ running. Install the package by typing the following command in a command terminal:
67
+
68
+ pip install gstools
69
+
70
+ To install the latest development version via pip, see the
71
+ [documentation][doc_install_link].
72
+ One thing to point out is that this way, the non-parallel version of GSTools
73
+ is installed. In case you want the parallel version, follow these easy
74
+ [steps][doc_install_link].
75
+
76
+
77
+ ## Citation
78
+
79
+ If you are using GSTools in your publication please cite our paper:
80
+
81
+ > Müller, S., Schüler, L., Zech, A., and Heße, F.:
82
+ > GSTools v1.3: a toolbox for geostatistical modelling in Python,
83
+ > Geosci. Model Dev., 15, 3161–3182, https://doi.org/10.5194/gmd-15-3161-2022, 2022.
84
+
85
+ You can cite the Zenodo code publication of GSTools by:
86
+
87
+ > Sebastian Müller & Lennart Schüler. GeoStat-Framework/GSTools. Zenodo. https://doi.org/10.5281/zenodo.1313628
88
+
89
+ If you want to cite a specific version, have a look at the [Zenodo site](https://doi.org/10.5281/zenodo.1313628).
90
+
91
+
92
+ ## Documentation for GSTools
93
+
94
+ You can find the documentation under [geostat-framework.readthedocs.io][doc_link].
95
+
96
+
97
+ ### Tutorials and Examples
98
+
99
+ The documentation also includes some [tutorials][tut_link], showing the most important use cases of GSTools, which are
100
+
101
+ - [Random Field Generation][tut1_link]
102
+ - [The Covariance Model][tut2_link]
103
+ - [Variogram Estimation][tut3_link]
104
+ - [Random Vector Field Generation][tut4_link]
105
+ - [Kriging][tut5_link]
106
+ - [Conditioned random field generation][tut6_link]
107
+ - [Field transformations][tut7_link]
108
+ - [Geographic Coordinates][tut8_link]
109
+ - [Spatio-Temporal Modelling][tut9_link]
110
+ - [Normalizing Data][tut10_link]
111
+ - [Plurigaussian Field Generation (PGS)][tut11_link]
112
+ - [Miscellaneous examples][tut0_link]
113
+
114
+ The associated python scripts are provided in the `examples` folder.
115
+
116
+
117
+ ## Spatial Random Field Generation
118
+
119
+ The core of this library is the generation of spatial random fields. These fields are generated using the randomisation method, described by [Heße et al. 2014][rand_link].
120
+
121
+ [rand_link]: https://doi.org/10.1016/j.envsoft.2014.01.013
122
+
123
+
124
+ ### Examples
125
+
126
+ #### Gaussian Covariance Model
127
+
128
+ This is an example of how to generate a 2 dimensional spatial random field with a gaussian covariance model.
129
+
130
+ ```python
131
+ import gstools as gs
132
+ # structured field with a size 100x100 and a grid-size of 1x1
133
+ x = y = range(100)
134
+ model = gs.Gaussian(dim=2, var=1, len_scale=10)
135
+ srf = gs.SRF(model)
136
+ srf((x, y), mesh_type='structured')
137
+ srf.plot()
138
+ ```
139
+ <p align="center">
140
+ <img src="https://raw.githubusercontent.com/GeoStat-Framework/GSTools/main/docs/source/pics/gau_field.png" alt="Random field" width="600px"/>
141
+ </p>
142
+
143
+ GSTools also provides support for [geographic coordinates](https://en.wikipedia.org/wiki/Geographic_coordinate_system).
144
+ This works perfectly well with [cartopy](https://scitools.org.uk/cartopy/docs/latest/index.html).
145
+
146
+ ```python
147
+ import matplotlib.pyplot as plt
148
+ import cartopy.crs as ccrs
149
+ import gstools as gs
150
+ # define a structured field by latitude and longitude
151
+ lat = lon = range(-80, 81)
152
+ model = gs.Gaussian(latlon=True, len_scale=777, geo_scale=gs.KM_SCALE)
153
+ srf = gs.SRF(model, seed=12345)
154
+ field = srf.structured((lat, lon))
155
+ # Orthographic plotting with cartopy
156
+ ax = plt.subplot(projection=ccrs.Orthographic(-45, 45))
157
+ cont = ax.contourf(lon, lat, field, transform=ccrs.PlateCarree())
158
+ ax.coastlines()
159
+ ax.set_global()
160
+ plt.colorbar(cont)
161
+ ```
162
+
163
+ <p align="center">
164
+ <img src="https://github.com/GeoStat-Framework/GeoStat-Framework.github.io/raw/master/img/GS_globe.png" alt="lat-lon random field" width="600px"/>
165
+ </p>
166
+
167
+ A similar example but for a three dimensional field is exported to a [VTK](https://vtk.org/) file, which can be visualized with [ParaView](https://www.paraview.org/) or [PyVista](https://docs.pyvista.org) in Python:
168
+
169
+ ```python
170
+ import gstools as gs
171
+ # structured field with a size 100x100x100 and a grid-size of 1x1x1
172
+ x = y = z = range(100)
173
+ model = gs.Gaussian(dim=3, len_scale=[16, 8, 4], angles=(0.8, 0.4, 0.2))
174
+ srf = gs.SRF(model)
175
+ srf((x, y, z), mesh_type='structured')
176
+ srf.vtk_export('3d_field') # Save to a VTK file for ParaView
177
+
178
+ mesh = srf.to_pyvista() # Create a PyVista mesh for plotting in Python
179
+ mesh.contour(isosurfaces=8).plot()
180
+ ```
181
+
182
+ <p align="center">
183
+ <img src="https://github.com/GeoStat-Framework/GeoStat-Framework.github.io/raw/master/img/GS_pyvista.png" alt="3d Random field" width="600px"/>
184
+ </p>
185
+
186
+
187
+ ## Estimating and Fitting Variograms
188
+
189
+ The spatial structure of a field can be analyzed with the variogram, which contains the same information as the covariance function.
190
+
191
+ All covariance models can be used to fit given variogram data by a simple interface.
192
+
193
+ ### Example
194
+
195
+ This is an example of how to estimate the variogram of a 2 dimensional unstructured field and estimate the parameters of the covariance
196
+ model again.
197
+
198
+ ```python
199
+ import numpy as np
200
+ import gstools as gs
201
+ # generate a synthetic field with an exponential model
202
+ x = np.random.RandomState(19970221).rand(1000) * 100.
203
+ y = np.random.RandomState(20011012).rand(1000) * 100.
204
+ model = gs.Exponential(dim=2, var=2, len_scale=8)
205
+ srf = gs.SRF(model, mean=0, seed=19970221)
206
+ field = srf((x, y))
207
+ # estimate the variogram of the field
208
+ bin_center, gamma = gs.vario_estimate((x, y), field)
209
+ # fit the variogram with a stable model. (no nugget fitted)
210
+ fit_model = gs.Stable(dim=2)
211
+ fit_model.fit_variogram(bin_center, gamma, nugget=False)
212
+ # output
213
+ ax = fit_model.plot(x_max=max(bin_center))
214
+ ax.scatter(bin_center, gamma)
215
+ print(fit_model)
216
+ ```
217
+
218
+ Which gives:
219
+
220
+ ```python
221
+ Stable(dim=2, var=1.85, len_scale=7.42, nugget=0.0, anis=[1.0], angles=[0.0], alpha=1.09)
222
+ ```
223
+
224
+ <p align="center">
225
+ <img src="https://github.com/GeoStat-Framework/GeoStat-Framework.github.io/raw/master/img/GS_vario_est.png" alt="Variogram" width="600px"/>
226
+ </p>
227
+
228
+
229
+ ## Kriging and Conditioned Random Fields
230
+
231
+ An important part of geostatistics is Kriging and conditioning spatial random
232
+ fields to measurements. With conditioned random fields, an ensemble of field realizations with their variability depending on the proximity of the measurements can be generated.
233
+
234
+ ### Example
235
+ For better visualization, we will condition a 1d field to a few "measurements", generate 100 realizations and plot them:
236
+
237
+ ```python
238
+ import numpy as np
239
+ import matplotlib.pyplot as plt
240
+ import gstools as gs
241
+
242
+ # conditions
243
+ cond_pos = [0.3, 1.9, 1.1, 3.3, 4.7]
244
+ cond_val = [0.47, 0.56, 0.74, 1.47, 1.74]
245
+
246
+ # conditioned spatial random field class
247
+ model = gs.Gaussian(dim=1, var=0.5, len_scale=2)
248
+ krige = gs.krige.Ordinary(model, cond_pos, cond_val)
249
+ cond_srf = gs.CondSRF(krige)
250
+ # same output positions for all ensemble members
251
+ grid_pos = np.linspace(0.0, 15.0, 151)
252
+ cond_srf.set_pos(grid_pos)
253
+
254
+ # seeded ensemble generation
255
+ seed = gs.random.MasterRNG(20170519)
256
+ for i in range(100):
257
+ field = cond_srf(seed=seed(), store=f"field_{i}")
258
+ plt.plot(grid_pos, field, color="k", alpha=0.1)
259
+ plt.scatter(cond_pos, cond_val, color="k")
260
+ plt.show()
261
+ ```
262
+
263
+ <p align="center">
264
+ <img src="https://raw.githubusercontent.com/GeoStat-Framework/GSTools/main/docs/source/pics/cond_ens.png" alt="Conditioned" width="600px"/>
265
+ </p>
266
+
267
+ ## User Defined Covariance Models
268
+
269
+ One of the core-features of GSTools is the powerful
270
+ [CovModel][cov_link]
271
+ class, which allows to easy define covariance models by the user.
272
+
273
+ ### Example
274
+
275
+ Here we re-implement the Gaussian covariance model by defining just a
276
+ [correlation][cor_link] function, which takes a non-dimensional distance ``h = r/l``:
277
+
278
+ ```python
279
+ import numpy as np
280
+ import gstools as gs
281
+ # use CovModel as the base-class
282
+ class Gau(gs.CovModel):
283
+ def cor(self, h):
284
+ return np.exp(-h**2)
285
+ ```
286
+
287
+ And that's it! With ``Gau`` you now have a fully working covariance model,
288
+ which you could use for field generation or variogram fitting as shown above.
289
+
290
+ Have a look at the [documentation ][doc_link] for further information on incorporating
291
+ optional parameters and optimizations.
292
+
293
+
294
+ ## Incompressible Vector Field Generation
295
+
296
+ Using the original [Kraichnan method][kraichnan_link], incompressible random
297
+ spatial vector fields can be generated.
298
+
299
+
300
+ ### Example
301
+
302
+ ```python
303
+ import numpy as np
304
+ import gstools as gs
305
+ x = np.arange(100)
306
+ y = np.arange(100)
307
+ model = gs.Gaussian(dim=2, var=1, len_scale=10)
308
+ srf = gs.SRF(model, generator='VectorField', seed=19841203)
309
+ srf((x, y), mesh_type='structured')
310
+ srf.plot()
311
+ ```
312
+
313
+ yielding
314
+
315
+ <p align="center">
316
+ <img src="https://raw.githubusercontent.com/GeoStat-Framework/GSTools/main/docs/source/pics/vec_srf_tut_gau.png" alt="vector field" width="600px"/>
317
+ </p>
318
+
319
+
320
+ [kraichnan_link]: https://doi.org/10.1063/1.1692799
321
+
322
+
323
+ ## Plurigaussian Field Simulation (PGS)
324
+
325
+ With PGS, more complex categorical (or discrete) fields can be created.
326
+
327
+
328
+ ### Example
329
+
330
+ ```python
331
+ import gstools as gs
332
+ import numpy as np
333
+ import matplotlib.pyplot as plt
334
+
335
+ N = [180, 140]
336
+
337
+ x, y = range(N[0]), range(N[1])
338
+
339
+ # we need 2 SRFs
340
+ model = gs.Gaussian(dim=2, var=1, len_scale=5)
341
+ srf = gs.SRF(model)
342
+ field1 = srf.structured([x, y], seed=20170519)
343
+ field2 = srf.structured([x, y], seed=19970221)
344
+
345
+ # with `lithotypes`, we prescribe the categorical data and its relations
346
+ # here, we use 2 categories separated by a rectangle.
347
+ rect = [40, 32]
348
+ lithotypes = np.zeros(N)
349
+ lithotypes[
350
+ N[0] // 2 - rect[0] // 2 : N[0] // 2 + rect[0] // 2,
351
+ N[1] // 2 - rect[1] // 2 : N[1] // 2 + rect[1] // 2,
352
+ ] = 1
353
+
354
+ pgs = gs.PGS(2, [field1, field2])
355
+ P = pgs(lithotypes)
356
+
357
+ fig, axs = plt.subplots(1, 2)
358
+ axs[0].imshow(lithotypes, cmap="copper")
359
+ axs[1].imshow(P, cmap="copper")
360
+ plt.show()
361
+ ```
362
+
363
+ <p align="center">
364
+ <img src="https://raw.githubusercontent.com/GeoStat-Framework/GSTools/main/docs/source/pics/2d_pgs.png" alt="PGS" width="600px"/>
365
+ </p>
366
+
367
+
368
+ ## VTK/PyVista Export
369
+
370
+ After you have created a field, you may want to save it to file, so we provide
371
+ a handy [VTK][vtk_link] export routine using the `.vtk_export()` or you could
372
+ create a VTK/PyVista dataset for use in Python with to `.to_pyvista()` method:
373
+
374
+ ```python
375
+ import gstools as gs
376
+ x = y = range(100)
377
+ model = gs.Gaussian(dim=2, var=1, len_scale=10)
378
+ srf = gs.SRF(model)
379
+ srf((x, y), mesh_type='structured')
380
+ srf.vtk_export("field") # Saves to a VTK file
381
+ mesh = srf.to_pyvista() # Create a VTK/PyVista dataset in memory
382
+ mesh.plot()
383
+ ```
384
+
385
+ Which gives a RectilinearGrid VTK file ``field.vtr`` or creates a PyVista mesh
386
+ in memory for immediate 3D plotting in Python.
387
+
388
+ <p align="center">
389
+ <img src="https://raw.githubusercontent.com/GeoStat-Framework/GSTools/main/docs/source/pics/pyvista_export.png" alt="pyvista export" width="600px"/>
390
+ </p>
391
+
392
+
393
+ ## Requirements:
394
+
395
+ - [NumPy >= 1.20.0](https://www.numpy.org)
396
+ - [SciPy >= 1.1.0](https://www.scipy.org/scipylib)
397
+ - [hankel >= 1.0.0](https://github.com/steven-murray/hankel)
398
+ - [emcee >= 3.0.0](https://github.com/dfm/emcee)
399
+ - [pyevtk >= 1.1.1](https://github.com/pyscience-projects/pyevtk)
400
+ - [meshio >= 5.1.0](https://github.com/nschloe/meshio)
401
+
402
+ ### Optional
403
+
404
+ - [GSTools-Core >= 0.2.0](https://github.com/GeoStat-Framework/GSTools-Core)
405
+ - [matplotlib](https://matplotlib.org)
406
+ - [pyvista](https://docs.pyvista.org/)
407
+
408
+
409
+ ## Contact
410
+
411
+ You can contact us via <info@geostat-framework.org>.
412
+
413
+
414
+ ## License
415
+
416
+ [LGPLv3][license_link] © 2018-2025
417
+
418
+ [pip_link]: https://pypi.org/project/gstools
419
+ [conda_link]: https://docs.conda.io/en/latest/miniconda.html
420
+ [conda_forge_link]: https://github.com/conda-forge/gstools-feedstock#installing-gstools
421
+ [conda_pip]: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-pkgs.html#installing-non-conda-packages
422
+ [pipiflag]: https://pip-python3.readthedocs.io/en/latest/reference/pip_install.html?highlight=i#cmdoption-i
423
+ [winpy_link]: https://winpython.github.io/
424
+ [license_link]: https://github.com/GeoStat-Framework/GSTools/blob/main/LICENSE
425
+ [cov_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/generated/gstools.covmodel.CovModel.html#gstools.covmodel.CovModel
426
+ [stable_link]: https://en.wikipedia.org/wiki/Stable_distribution
427
+ [doc_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/
428
+ [doc_install_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/#pip
429
+ [tut_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/tutorials.html
430
+ [tut1_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/examples/01_random_field/index.html
431
+ [tut2_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/examples/02_cov_model/index.html
432
+ [tut3_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/examples/03_variogram/index.html
433
+ [tut4_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/examples/04_vector_field/index.html
434
+ [tut5_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/examples/05_kriging/index.html
435
+ [tut6_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/examples/06_conditioned_fields/index.html
436
+ [tut7_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/examples/07_transformations/index.html
437
+ [tut8_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/examples/08_geo_coordinates/index.html
438
+ [tut9_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/examples/09_spatio_temporal/index.html
439
+ [tut10_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/examples/10_normalizer/index.html
440
+ [tut11_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/examples/11_plurigaussian/index.html
441
+ [tut0_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/examples/00_misc/index.html
442
+ [cor_link]: https://en.wikipedia.org/wiki/Autocovariance#Normalization
443
+ [vtk_link]: https://www.vtk.org/
GSTools/source/__init__.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ GSTools Project Package Initialization File
4
+ """
GSTools/source/docs/Makefile ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Minimal makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line.
5
+ SPHINXOPTS =
6
+ SPHINXBUILD = python3 -msphinx
7
+ SPHINXPROJ = GSTools
8
+ SOURCEDIR = source
9
+ BUILDDIR = build
10
+
11
+ # Put it first so that "make" without argument is like "make help".
12
+ help:
13
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
+
15
+ .PHONY: help Makefile
16
+
17
+ # Catch-all target: route all unknown targets to Sphinx using the new
18
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19
+ %: Makefile
20
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
GSTools/source/docs/source/_static/custom.css ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ dl.py.property {
2
+ display: block !important;
3
+ }
GSTools/source/docs/source/_templates/autosummary/class.rst ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{ fullname | escape | underline}}
2
+
3
+ .. currentmodule:: {{ module }}
4
+
5
+ .. autoclass:: {{ objname }}
6
+ :members:
7
+ :undoc-members:
8
+ :inherited-members:
9
+ :show-inheritance:
10
+
11
+ .. raw:: latex
12
+
13
+ \clearpage
GSTools/source/docs/source/_templates/autosummary/module.rst ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {{ fullname | escape | underline}}
2
+
3
+ .. currentmodule:: {{ fullname }}
4
+
5
+ .. automodule:: {{ fullname }}
6
+
7
+ .. raw:: latex
8
+
9
+ \clearpage
GSTools/source/docs/source/_templates/layout.html ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends "!layout.html" %}
2
+ {% block menu %}
3
+ <p class="link caption"><span class="link caption-text">Documentation</span></p>
4
+ {{ super() }}
5
+ <br />
6
+ <p class="link caption"><span class="link caption-text">GSTools Links</span></p>
7
+ <ul>
8
+ <Li><a href="https://github.com/GeoStat-Framework/GSTools">GSTools GitHub</a></Li>
9
+ <Li><a href="https://zenodo.org/badge/latestdoi/117534635">GSTools Zenodo DOI</a></Li>
10
+ <Li><a href="https://pypi.org/project/gstools/">GSTools PyPI</a></Li>
11
+ </ul>
12
+ <br />
13
+ <p class="link caption"><span class="link caption-text">GeoStat Framework</span></p>
14
+ <ul>
15
+ <Li><a href="https://geostat-framework.org">GeoStat Website</a></Li>
16
+ <Li><a href="https://github.com/GeoStat-Framework">GeoStat Github</a></Li>
17
+ <Li><a href="https://github.com/GeoStat-Examples">GeoStat Examples</a></Li>
18
+ <Li><a href="https://geostat-framework.readthedocs.io">GeoStat ReadTheDocs</a></Li>
19
+ <Li><a href="https://pypi.org/user/geostatframework/">GeoStat PyPI</a></Li>
20
+ </ul>
21
+ <br />
22
+ <br />
23
+ <ul>
24
+ <Li><a href="{{ pathto('genindex') }}">Index</a></Li>
25
+ <Li><a href="{{ pathto(master_doc) }}">Sitemap</a></Li>
26
+ </ul>
27
+ {% endblock %}
GSTools/source/docs/source/api.rst ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ ===========
2
+ GSTools API
3
+ ===========
4
+
5
+ .. automodule:: gstools
6
+
7
+ .. raw:: latex
8
+
9
+ \clearpage
GSTools/source/docs/source/authors.rst ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ .. include:: ../../AUTHORS.md
2
+ :parser: myst_parser.docutils_
GSTools/source/docs/source/changelog.rst ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ .. include:: ../../CHANGELOG.md
2
+ :parser: myst_parser.docutils_
GSTools/source/docs/source/conf.py ADDED
@@ -0,0 +1,338 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ #
3
+ # GSTools documentation build configuration file, created by
4
+ # sphinx-quickstart on Fri Jan 5 14:20:43 2018.
5
+ #
6
+ # This file is execfile()d with the current directory set to its
7
+ # containing dir.
8
+ #
9
+ # Note that not all possible configuration values are present in this
10
+ # autogenerated file.
11
+ #
12
+ # All configuration values have a default; values that are commented out
13
+ # serve to show the default.
14
+
15
+ # If extensions (or modules to document with autodoc) are in another directory,
16
+ # add these directories to sys.path here. If the directory is relative to the
17
+ # documentation root, use os.path.abspath to make it absolute, like shown here.
18
+ #
19
+ # NOTE:
20
+ # pip install sphinx_rtd_theme
21
+ # is needed in order to build the documentation
22
+ # import os
23
+ # import sys
24
+ import datetime
25
+ import warnings
26
+
27
+ warnings.filterwarnings(
28
+ "ignore",
29
+ category=UserWarning,
30
+ message="Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.",
31
+ )
32
+
33
+ # local module should not be added to sys path if it's installed on RTFD
34
+ # see: https://stackoverflow.com/a/31882049/6696397
35
+ # sys.path.insert(0, os.path.abspath("../../"))
36
+ from gstools import __version__ as ver
37
+
38
+
39
+ def skip(app, what, name, obj, skip, options):
40
+ if name in ["__call__"]:
41
+ return False
42
+ return skip
43
+
44
+
45
+ def setup(app):
46
+ app.connect("autodoc-skip-member", skip)
47
+
48
+
49
+ # -- General configuration ------------------------------------------------
50
+
51
+ # If your documentation needs a minimal Sphinx version, state it here.
52
+ #
53
+ # needs_sphinx = '1.0'
54
+
55
+ # Add any Sphinx extension module names here, as strings. They can be
56
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
57
+ # ones.
58
+ extensions = [
59
+ "sphinx.ext.autodoc",
60
+ "sphinx.ext.doctest",
61
+ "sphinx.ext.intersphinx",
62
+ "sphinx.ext.coverage",
63
+ "sphinx.ext.mathjax",
64
+ "sphinx.ext.ifconfig",
65
+ "sphinx.ext.viewcode",
66
+ "sphinx.ext.autosummary",
67
+ "sphinx.ext.napoleon", # parameters look better than with numpydoc only
68
+ "numpydoc",
69
+ "sphinx_gallery.gen_gallery",
70
+ "myst_parser",
71
+ "sphinxcontrib.youtube",
72
+ ]
73
+
74
+ # autosummaries from source-files
75
+ autosummary_generate = True
76
+ # dont show __init__ docstring
77
+ autoclass_content = "class"
78
+ # sort class members
79
+ autodoc_member_order = "groupwise"
80
+ # autodoc_member_order = 'bysource'
81
+
82
+ # Notes in boxes
83
+ napoleon_use_admonition_for_notes = True
84
+ # Attributes like parameters
85
+ napoleon_use_ivar = True
86
+ # keep "Other Parameters" section
87
+ # https://github.com/sphinx-doc/sphinx/issues/10330
88
+ napoleon_use_param = False
89
+ # this is a nice class-doc layout
90
+ numpydoc_show_class_members = True
91
+ # class members have no separate file, so they are not in a toctree
92
+ numpydoc_class_members_toctree = False
93
+ # for the covmodels alot of classmembers show up...
94
+ # maybe switch off with: :no-inherited-members:
95
+ numpydoc_show_inherited_class_members = True
96
+ # Add any paths that contain templates here, relative to this directory.
97
+ templates_path = ["_templates"]
98
+
99
+ # The suffix(es) of source filenames.
100
+ # You can specify multiple suffix as a list of string:
101
+ source_suffix = {
102
+ ".rst": "restructuredtext",
103
+ ".md": "markdown",
104
+ }
105
+ # source_suffix = [".rst", ".md"]
106
+ # source_suffix = ".rst"
107
+
108
+ # The master toctree document.
109
+ # --> this is the sitemap (or content-list in latex -> needs a heading)
110
+ # for html: the quickstart (in index.rst)
111
+ # gets the "index.html" and is therefore opened first
112
+ master_doc = "contents"
113
+
114
+ # General information about the project.
115
+ curr_year = datetime.datetime.now().year
116
+ project = "GSTools"
117
+ copyright = f"2018 - {curr_year}, Sebastian Müller, Lennart Schüler"
118
+ author = "Sebastian Müller, Lennart Schüler"
119
+
120
+ # The version info for the project you're documenting, acts as replacement for
121
+ # |version| and |release|, also used in various other places throughout the
122
+ # built documents.
123
+ #
124
+ # The short X.Y version.
125
+ version = ver
126
+ # The full version, including alpha/beta/rc tags.
127
+ release = ver
128
+
129
+ # The language for content autogenerated by Sphinx. Refer to documentation
130
+ # for a list of supported languages.
131
+ #
132
+ # This is also used if you do content translation via gettext catalogs.
133
+ # Usually you set "language" from the command line for these cases.
134
+ language = "en"
135
+
136
+ # List of patterns, relative to source directory, that match files and
137
+ # directories to ignore when looking for source files.
138
+ # This patterns also effect to html_static_path and html_extra_path
139
+ exclude_patterns = []
140
+
141
+ # The name of the Pygments (syntax highlighting) style to use.
142
+ pygments_style = "sphinx"
143
+
144
+ # -- Options for HTML output ----------------------------------------------
145
+
146
+ # The theme to use for HTML and HTML Help pages. See the documentation for
147
+ # a list of builtin themes.
148
+ #
149
+ html_theme = "sphinx_rtd_theme"
150
+
151
+ # Theme options are theme-specific and customize the look and feel of a theme
152
+ # further. For a list of options available for each theme, see the
153
+ # documentation.
154
+ #
155
+ html_theme_options = {
156
+ # 'canonical_url': '',
157
+ # 'analytics_id': '',
158
+ "logo_only": False,
159
+ "version_selector": True,
160
+ "prev_next_buttons_location": "top",
161
+ # 'style_external_links': False,
162
+ # 'vcs_pageview_mode': '',
163
+ # Toc options
164
+ "collapse_navigation": False,
165
+ "sticky_navigation": True,
166
+ "navigation_depth": 6,
167
+ "includehidden": True,
168
+ "titles_only": False,
169
+ }
170
+ # Add any paths that contain custom static files (such as style sheets) here,
171
+ # relative to this directory. They are copied after the builtin static files,
172
+ # so a file named "default.css" will overwrite the builtin "default.css".
173
+ html_static_path = ["_static"]
174
+
175
+ # These paths are either relative to html_static_path
176
+ # or fully qualified paths (eg. https://...)
177
+ html_css_files = ["custom.css"]
178
+
179
+ # Custom sidebar templates, must be a dictionary that maps document names
180
+ # to template names.
181
+ #
182
+ # This is required for the alabaster theme
183
+ # refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
184
+ html_sidebars = {
185
+ "**": [
186
+ "relations.html", # needs 'show_related': True theme option to display
187
+ "searchbox.html",
188
+ ]
189
+ }
190
+
191
+
192
+ # -- Options for HTMLHelp output ------------------------------------------
193
+
194
+ # Output file base name for HTML help builder.
195
+ htmlhelp_basename = "GSToolsdoc"
196
+ # logos for the page
197
+ html_logo = "pics/gstools_150.png"
198
+ html_favicon = "pics/gstools.ico"
199
+
200
+ # -- Options for LaTeX output ---------------------------------------------
201
+ # latex_engine = 'lualatex'
202
+ # logo too big
203
+ latex_logo = "pics/gstools_150.png"
204
+
205
+ # latex_show_urls = 'footnote'
206
+ # http://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-latex-output
207
+ latex_elements = {
208
+ "preamble": r"""
209
+ \setcounter{secnumdepth}{1}
210
+ \setcounter{tocdepth}{2}
211
+ \pagestyle{fancy}
212
+ """,
213
+ "pointsize": "10pt",
214
+ "papersize": "a4paper",
215
+ "fncychap": "\\usepackage[Glenn]{fncychap}",
216
+ # 'inputenc': r'\usepackage[utf8]{inputenc}',
217
+ }
218
+ # Grouping the document tree into LaTeX files. List of tuples
219
+ # (source start file, target name, title,
220
+ # author, documentclass [howto, manual, or own class]).
221
+ latex_documents = [
222
+ (
223
+ master_doc,
224
+ "GSTools.tex",
225
+ "GSTools Documentation",
226
+ "Sebastian Müller, Lennart Schüler",
227
+ "manual",
228
+ )
229
+ ]
230
+ # latex_use_parts = True
231
+
232
+ # -- Options for manual page output ---------------------------------------
233
+
234
+ # One entry per manual page. List of tuples
235
+ # (source start file, name, description, authors, manual section).
236
+ man_pages = [(master_doc, "GSTools", "GSTools Documentation", [author], 1)]
237
+
238
+
239
+ # -- Options for Texinfo output -------------------------------------------
240
+
241
+ # Grouping the document tree into Texinfo files. List of tuples
242
+ # (source start file, target name, title, author,
243
+ # dir menu entry, description, category)
244
+ texinfo_documents = [
245
+ (
246
+ master_doc,
247
+ "GSTools",
248
+ "GSTools Documentation",
249
+ author,
250
+ "GSTools",
251
+ "Geo-statistical toolbox.",
252
+ "Miscellaneous",
253
+ )
254
+ ]
255
+
256
+ suppress_warnings = [
257
+ "image.nonlocal_uri",
258
+ # 'app.add_directive', # this evtl. suppresses the numpydoc induced warning
259
+ ]
260
+
261
+ # Example configuration for intersphinx: refer to the Python standard library.
262
+ intersphinx_mapping = {
263
+ "Python": ("https://docs.python.org/", None),
264
+ "NumPy": ("https://numpy.org/doc/stable/", None),
265
+ "SciPy": ("https://docs.scipy.org/doc/scipy/", None),
266
+ "matplotlib": ("https://matplotlib.org/stable/", None),
267
+ "hankel": ("https://hankel.readthedocs.io/en/latest/", None),
268
+ "emcee": ("https://emcee.readthedocs.io/en/latest/", None),
269
+ }
270
+
271
+ # -- Sphinx Gallery Options
272
+ from sphinx_gallery.sorting import FileNameSortKey
273
+
274
+ # Use pyvista's image scraper for example gallery
275
+ # import pyvista
276
+ # https://github.com/tkoyama010/pyvista-doc-translations/blob/85c835a3ada3a2adefac06ba70e15a101ffa9162/conf.py#L21
277
+ # https://github.com/simpeg/discretize/blob/f414dd7ee7c5ba9a141cb2c37d4b71fdc531eae8/docs/conf.py#L334
278
+ # Make sure off screen is set to true when building locally
279
+ # pyvista.OFF_SCREEN = True
280
+ # # necessary when building the sphinx gallery
281
+ # pyvista.BUILDING_GALLERY = True
282
+ # # Optional - set parameters like theme or window size
283
+ # pyvista.set_plot_theme("document")
284
+
285
+ sphinx_gallery_conf = {
286
+ # "image_scrapers": ("pyvista", "matplotlib"),
287
+ "remove_config_comments": True,
288
+ # only show "print" output as output
289
+ "capture_repr": (),
290
+ # path to your examples scripts
291
+ "examples_dirs": [
292
+ "../../examples/00_misc/",
293
+ "../../examples/01_random_field/",
294
+ "../../examples/02_cov_model/",
295
+ "../../examples/03_variogram/",
296
+ "../../examples/04_vector_field/",
297
+ "../../examples/05_kriging/",
298
+ "../../examples/06_conditioned_fields/",
299
+ "../../examples/07_transformations/",
300
+ "../../examples/08_geo_coordinates/",
301
+ "../../examples/09_spatio_temporal/",
302
+ "../../examples/10_normalizer/",
303
+ "../../examples/11_plurigaussian/",
304
+ "../../examples/12_sum_model/",
305
+ ],
306
+ # path where to save gallery generated examples
307
+ "gallery_dirs": [
308
+ "examples/00_misc/",
309
+ "examples/01_random_field/",
310
+ "examples/02_cov_model/",
311
+ "examples/03_variogram/",
312
+ "examples/04_vector_field/",
313
+ "examples/05_kriging/",
314
+ "examples/06_conditioned_fields/",
315
+ "examples/07_transformations/",
316
+ "examples/08_geo_coordinates/",
317
+ "examples/09_spatio_temporal/",
318
+ "examples/10_normalizer/",
319
+ "examples/11_plurigaussian/",
320
+ "examples/12_sum_model/",
321
+ ],
322
+ # Pattern to search for example files
323
+ "filename_pattern": r"\.py",
324
+ # Remove the "Download all examples" button from the top level gallery
325
+ "download_all_examples": False,
326
+ # Sort gallery example by file name instead of number of lines (default)
327
+ "within_subsection_order": FileNameSortKey,
328
+ # directory where function granular galleries are stored
329
+ "backreferences_dir": "examples/backreferences",
330
+ # Modules for which function level galleries are created. In
331
+ "doc_module": "gstools",
332
+ # "first_notebook_cell": (
333
+ # "%matplotlib inline\n"
334
+ # "from pyvista import set_plot_theme\n"
335
+ # "set_plot_theme('document')"
336
+ # ),
337
+ "matplotlib_animations": True,
338
+ }
GSTools/source/docs/source/contents.rst ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ========
2
+ Contents
3
+ ========
4
+
5
+ .. toctree::
6
+ :includehidden:
7
+ :maxdepth: 3
8
+
9
+ index
10
+ tutorials
11
+ api
12
+ authors
13
+ changelog
GSTools/source/docs/source/index.rst ADDED
@@ -0,0 +1,504 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ==================
2
+ GSTools Quickstart
3
+ ==================
4
+
5
+ .. image:: https://raw.githubusercontent.com/GeoStat-Framework/GSTools/main/docs/source/pics/gstools.png
6
+ :width: 150px
7
+ :align: center
8
+
9
+ .. only:: html
10
+
11
+ **Get in Touch!**
12
+
13
+ |GH-Discussions| |Email|
14
+
15
+ **Youtube Tutorial on GSTools**
16
+
17
+ .. youtube:: qZBJ-AZXq6Q
18
+ :width: 100%
19
+
20
+ |
21
+
22
+ Purpose
23
+ =======
24
+
25
+ GSTools provides geostatistical tools for various purposes:
26
+
27
+ - random field generation, including periodic boundaries
28
+ - simple, ordinary, universal and external drift kriging
29
+ - conditioned field generation
30
+ - incompressible random vector field generation
31
+ - (automated) variogram estimation and fitting
32
+ - directional variogram estimation and modelling
33
+ - data normalization and transformation
34
+ - many readily provided and even user-defined covariance models
35
+ - metric spatio-temporal modelling
36
+ - plurigaussian field simulations (PGS)
37
+ - plotting and exporting routines
38
+
39
+
40
+ Installation
41
+ ============
42
+
43
+ conda
44
+ -----
45
+
46
+ GSTools can be installed via
47
+ `conda <https://docs.conda.io/en/latest/miniconda.html>`_ on Linux, Mac, and
48
+ Windows.
49
+ Install the package by typing the following command in a command terminal:
50
+
51
+ .. code-block:: none
52
+
53
+ conda install gstools
54
+
55
+ In case conda forge is not set up for your system yet, see the easy to follow
56
+ instructions on `conda forge <https://github.com/conda-forge/gstools-feedstock#installing-gstools>`_.
57
+ Using conda, the parallelized version of GSTools should be installed.
58
+
59
+
60
+ pip
61
+ ---
62
+
63
+ GSTools can be installed via `pip <https://pypi.org/project/gstools/>`_
64
+ on Linux, Mac, and Windows.
65
+ On Windows you can install `WinPython <https://winpython.github.io/>`_ to get
66
+ Python and pip running.
67
+ Install the package by typing the following into command in a command terminal:
68
+
69
+ .. code-block:: none
70
+
71
+ pip install gstools
72
+
73
+ To get the latest development version you can install it directly from GitHub:
74
+
75
+ .. code-block:: none
76
+
77
+ pip install git+git://github.com/GeoStat-Framework/GSTools.git@main
78
+
79
+ If something went wrong during installation, try the :code:`-I` `flag from pip <https://pip-python3.readthedocs.io/en/latest/reference/pip_install.html?highlight=i#cmdoption-i>`_.
80
+
81
+ **Speeding up GSTools by parallelization**
82
+
83
+ We provide two possibilities to run GSTools in parallel, often causing a
84
+ massive improvement in runtime. In either case, the number of parallel
85
+ threads can be set with the global variable `config.NUM_THREADS`. If not set,
86
+ all cores are used.
87
+ When using conda, the parallel version of GSTools is installed per default.
88
+
89
+ ***Parallelizing Cython***
90
+
91
+ For parallel support, the `GSTools-Cython <https://github.com/GeoStat-Framework/GSTools-Cython>`_
92
+ backend needs to be compiled from source the following way:
93
+
94
+ .. code-block:: none
95
+
96
+ export GSTOOLS_BUILD_PARALLEL=1
97
+ pip install --no-binary=gstools-cython gstools
98
+
99
+ You have to provide a C compiler and OpenMP to compile GSTools-Cython with parallel support.
100
+ The feature is controlled by the environment variable
101
+ ``GSTOOLS_BUILD_PARALLEL``, that can be ``0`` or ``1`` (interpreted as ``0`` if not present).
102
+ Note, that the ``--no-binary=gstools-cython`` option forces pip to not use a wheel
103
+ for the GSTools-Cython backend.
104
+
105
+ For the development version, you can do almost the same:
106
+
107
+ .. code-block:: none
108
+
109
+ export GSTOOLS_BUILD_PARALLEL=1
110
+ pip install git+git://github.com/GeoStat-Framework/GSTools-Cython.git@main
111
+ pip install git+git://github.com/GeoStat-Framework/GSTools.git@main
112
+
113
+
114
+ ***Using GSTools-Core for parallelization and even more speed***
115
+
116
+ You can install the optional dependency `GSTools-Core <https://github.com/GeoStat-Framework/GSTools-Core>`_,
117
+ which is a re-implementation of GSTools-Cython:
118
+
119
+ .. code-block:: none
120
+
121
+ pip install gstools[rust]
122
+
123
+ or by manually installing the package
124
+
125
+ .. code-block:: none
126
+
127
+ pip install gstools-core
128
+
129
+ The new package uses the language Rust and it should be safer and faster (in some cases by orders of magnitude).
130
+ Once the package GSTools-Core is available on your machine, it will be used by default.
131
+ In case you want to switch back to the Cython implementation, you can set
132
+ :code:`gstools.config.USE_GSTOOLS_CORE=False` in your code. This also works at runtime.
133
+
134
+ GSTools-Core will automatically run in parallel, without having to provide OpenMP or a local C compiler.
135
+
136
+
137
+ Citation
138
+ ========
139
+
140
+ If you are using GSTools in your publication please cite our paper:
141
+
142
+ Müller, S., Schüler, L., Zech, A., and Heße, F.: GSTools v1.3: a toolbox for geostatistical modelling in Python, Geosci. Model Dev., 15, 3161–3182, https://doi.org/10.5194/gmd-15-3161-2022, 2022.
143
+
144
+ You can cite the Zenodo code publication of GSTools by:
145
+
146
+ Sebastian Müller & Lennart Schüler. GeoStat-Framework/GSTools. Zenodo. https://doi.org/10.5281/zenodo.1313628
147
+
148
+ If you want to cite a specific version, have a look at the `Zenodo site <https://doi.org/10.5281/zenodo.1313628>`__.
149
+
150
+
151
+ Tutorials and Examples
152
+ ======================
153
+
154
+ The documentation also includes some `tutorials <tutorials.html>`__,
155
+ showing the most important use cases of GSTools, which are
156
+
157
+ - `Random Field Generation <examples/01_random_field/index.html>`__
158
+ - `The Covariance Model <examples/02_cov_model/index.html>`__
159
+ - `Variogram Estimation <examples/03_variogram/index.html>`__
160
+ - `Random Vector Field Generation <examples/04_vector_field/index.html>`__
161
+ - `Kriging <examples/05_kriging/index.html>`__
162
+ - `Conditioned random field generation <examples/06_conditioned_fields/index.html>`__
163
+ - `Field transformations <examples/07_transformations/index.html>`__
164
+ - `Geographic Coordinates <examples/08_geo_coordinates/index.html>`__
165
+ - `Spatio-Temporal Modelling <examples/09_spatio_temporal/index.html>`__
166
+ - `Normalizing Data <examples/10_normalizer/index.html>`__
167
+ - `Plurigaussian Field Generation (PGS) <examples/11_plurigaussian/index.html>`__
168
+ - `Miscellaneous examples <examples/00_misc/index.html>`__
169
+
170
+
171
+ Spatial Random Field Generation
172
+ ===============================
173
+
174
+ The core of this library is the generation of spatial random fields.
175
+ These fields are generated using the randomisation method, described by
176
+ `Heße et al. 2014 <https://doi.org/10.1016/j.envsoft.2014.01.013>`_.
177
+
178
+
179
+ Examples
180
+ --------
181
+
182
+ Gaussian Covariance Model
183
+ ^^^^^^^^^^^^^^^^^^^^^^^^^
184
+
185
+ This is an example of how to generate a 2 dimensional spatial random field (:any:`SRF`)
186
+ with a :any:`Gaussian` covariance model.
187
+
188
+ .. code-block:: python
189
+
190
+ import gstools as gs
191
+ # structured field with a size 100x100 and a grid-size of 1x1
192
+ x = y = range(100)
193
+ model = gs.Gaussian(dim=2, var=1, len_scale=10)
194
+ srf = gs.SRF(model)
195
+ srf((x, y), mesh_type='structured')
196
+ srf.plot()
197
+
198
+ .. image:: https://raw.githubusercontent.com/GeoStat-Framework/GSTools/main/docs/source/pics/gau_field.png
199
+ :width: 400px
200
+ :align: center
201
+
202
+ GSTools also provides support for `geographic coordinates <https://en.wikipedia.org/wiki/Geographic_coordinate_system>`_.
203
+ This works perfectly well with `cartopy <https://scitools.org.uk/cartopy/docs/latest/index.html>`_.
204
+
205
+ .. code-block:: python
206
+
207
+ import matplotlib.pyplot as plt
208
+ import cartopy.crs as ccrs
209
+ import gstools as gs
210
+ # define a structured field by latitude and longitude
211
+ lat = lon = range(-80, 81)
212
+ model = gs.Gaussian(latlon=True, len_scale=777, geo_scale=gs.KM_SCALE)
213
+ srf = gs.SRF(model, seed=12345)
214
+ field = srf.structured((lat, lon))
215
+ # Orthographic plotting with cartopy
216
+ ax = plt.subplot(projection=ccrs.Orthographic(-45, 45))
217
+ cont = ax.contourf(lon, lat, field, transform=ccrs.PlateCarree())
218
+ ax.coastlines()
219
+ ax.set_global()
220
+ plt.colorbar(cont)
221
+
222
+ .. image:: https://github.com/GeoStat-Framework/GeoStat-Framework.github.io/raw/master/img/GS_globe.png
223
+ :width: 400px
224
+ :align: center
225
+
226
+ A similar example but for a three dimensional field is exported to a
227
+ `VTK <https://vtk.org/>`__ file, which can be visualized with
228
+ `ParaView <https://www.paraview.org/>`_ or
229
+ `PyVista <https://docs.pyvista.org>`__ in Python:
230
+
231
+ .. code-block:: python
232
+
233
+ import gstools as gs
234
+ # structured field with a size 100x100x100 and a grid-size of 1x1x1
235
+ x = y = z = range(100)
236
+ model = gs.Gaussian(dim=3, len_scale=[16, 8, 4], angles=(0.8, 0.4, 0.2))
237
+ srf = gs.SRF(model)
238
+ srf((x, y, z), mesh_type='structured')
239
+ srf.vtk_export('3d_field') # Save to a VTK file for ParaView
240
+
241
+ mesh = srf.to_pyvista() # Create a PyVista mesh for plotting in Python
242
+ mesh.contour(isosurfaces=8).plot()
243
+
244
+ .. image:: https://github.com/GeoStat-Framework/GeoStat-Framework.github.io/raw/master/img/GS_pyvista.png
245
+ :width: 400px
246
+ :align: center
247
+
248
+
249
+ Estimating and fitting variograms
250
+ =================================
251
+
252
+ The spatial structure of a field can be analyzed with the variogram, which contains the same information as the covariance function.
253
+
254
+ All covariance models can be used to fit given variogram data by a simple interface.
255
+
256
+
257
+ Examples
258
+ --------
259
+
260
+ This is an example of how to estimate the variogram of a 2 dimensional unstructured field and estimate the parameters of the covariance
261
+ model again.
262
+
263
+ .. code-block:: python
264
+
265
+ import numpy as np
266
+ import gstools as gs
267
+ # generate a synthetic field with an exponential model
268
+ x = np.random.RandomState(19970221).rand(1000) * 100.
269
+ y = np.random.RandomState(20011012).rand(1000) * 100.
270
+ model = gs.Exponential(dim=2, var=2, len_scale=8)
271
+ srf = gs.SRF(model, mean=0, seed=19970221)
272
+ field = srf((x, y))
273
+ # estimate the variogram of the field
274
+ bin_center, gamma = gs.vario_estimate((x, y), field)
275
+ # fit the variogram with a stable model. (no nugget fitted)
276
+ fit_model = gs.Stable(dim=2)
277
+ fit_model.fit_variogram(bin_center, gamma, nugget=False)
278
+ # output
279
+ ax = fit_model.plot(x_max=max(bin_center))
280
+ ax.scatter(bin_center, gamma)
281
+ print(fit_model)
282
+
283
+ Which gives:
284
+
285
+ .. code-block:: python
286
+
287
+ Stable(dim=2, var=1.85, len_scale=7.42, nugget=0.0, anis=[1.0], angles=[0.0], alpha=1.09)
288
+
289
+ .. image:: https://raw.githubusercontent.com/GeoStat-Framework/GeoStat-Framework.github.io/master/img/GS_vario_est.png
290
+ :width: 400px
291
+ :align: center
292
+
293
+
294
+ Kriging and Conditioned Random Fields
295
+ =====================================
296
+
297
+ An important part of geostatistics is Kriging and conditioning spatial random
298
+ fields to measurements. With conditioned random fields, an ensemble of field realizations
299
+ with their variability depending on the proximity of the measurements can be generated.
300
+
301
+
302
+ Example
303
+ -------
304
+
305
+ For better visualization, we will condition a 1d field to a few "measurements",
306
+ generate 100 realizations and plot them:
307
+
308
+ .. code-block:: python
309
+
310
+ import numpy as np
311
+ import matplotlib.pyplot as plt
312
+ import gstools as gs
313
+
314
+ # conditions
315
+ cond_pos = [0.3, 1.9, 1.1, 3.3, 4.7]
316
+ cond_val = [0.47, 0.56, 0.74, 1.47, 1.74]
317
+
318
+ # conditioned spatial random field class
319
+ model = gs.Gaussian(dim=1, var=0.5, len_scale=2)
320
+ krige = gs.krige.Ordinary(model, cond_pos, cond_val)
321
+ cond_srf = gs.CondSRF(krige)
322
+ # same output positions for all ensemble members
323
+ grid_pos = np.linspace(0.0, 15.0, 151)
324
+ cond_srf.set_pos(grid_pos)
325
+
326
+ # seeded ensemble generation
327
+ seed = gs.random.MasterRNG(20170519)
328
+ for i in range(100):
329
+ field = cond_srf(seed=seed(), store=f"field_{i}")
330
+ plt.plot(grid_pos, field, color="k", alpha=0.1)
331
+ plt.scatter(cond_pos, cond_val, color="k")
332
+ plt.show()
333
+
334
+ .. image:: https://raw.githubusercontent.com/GeoStat-Framework/GSTools/main/docs/source/pics/cond_ens.png
335
+ :width: 600px
336
+ :align: center
337
+
338
+
339
+ User defined covariance models
340
+ ==============================
341
+
342
+ One of the core-features of GSTools is the powerful
343
+ :any:`CovModel`
344
+ class, which allows to easy define covariance models by the user.
345
+
346
+
347
+ Example
348
+ -------
349
+
350
+ Here we re-implement the Gaussian covariance model by defining just the
351
+ `correlation <https://en.wikipedia.org/wiki/Autocovariance#Normalization>`_ function,
352
+ which takes a non-dimensional distance :class:`h = r/l`
353
+
354
+ .. code-block:: python
355
+
356
+ import numpy as np
357
+ import gstools as gs
358
+ # use CovModel as the base-class
359
+ class Gau(gs.CovModel):
360
+ def cor(self, h):
361
+ return np.exp(-h**2)
362
+
363
+ And that's it! With :class:`Gau` you now have a fully working covariance model,
364
+ which you could use for field generation or variogram fitting as shown above.
365
+
366
+
367
+ Incompressible Vector Field Generation
368
+ ======================================
369
+
370
+ Using the original `Kraichnan method <https://doi.org/10.1063/1.1692799>`_, incompressible random
371
+ spatial vector fields can be generated.
372
+
373
+
374
+ Example
375
+ -------
376
+
377
+ .. code-block:: python
378
+
379
+ import numpy as np
380
+ import gstools as gs
381
+ x = np.arange(100)
382
+ y = np.arange(100)
383
+ model = gs.Gaussian(dim=2, var=1, len_scale=10)
384
+ srf = gs.SRF(model, generator='VectorField', seed=19841203)
385
+ srf((x, y), mesh_type='structured')
386
+ srf.plot()
387
+
388
+ yielding
389
+
390
+ .. image:: https://raw.githubusercontent.com/GeoStat-Framework/GSTools/main/docs/source/pics/vec_srf_tut_gau.png
391
+ :width: 600px
392
+ :align: center
393
+
394
+
395
+ Plurigaussian Field Simulation (PGS)
396
+ ====================================
397
+
398
+ With PGS, more complex categorical (or discrete) fields can be created.
399
+
400
+
401
+ Example
402
+ -------
403
+
404
+ .. code-block:: python
405
+
406
+ import gstools as gs
407
+ import numpy as np
408
+ import matplotlib.pyplot as plt
409
+
410
+ N = [180, 140]
411
+
412
+ x, y = range(N[0]), range(N[1])
413
+
414
+ # we need 2 SRFs
415
+ model = gs.Gaussian(dim=2, var=1, len_scale=5)
416
+ srf = gs.SRF(model)
417
+ field1 = srf.structured([x, y], seed=20170519)
418
+ field2 = srf.structured([x, y], seed=19970221)
419
+
420
+ # with `lithotypes`, we prescribe the categorical data and its relations
421
+ # here, we use 2 categories separated by a rectangle.
422
+ rect = [40, 32]
423
+ lithotypes = np.zeros(N)
424
+ lithotypes[
425
+ N[0] // 2 - rect[0] // 2 : N[0] // 2 + rect[0] // 2,
426
+ N[1] // 2 - rect[1] // 2 : N[1] // 2 + rect[1] // 2,
427
+ ] = 1
428
+
429
+ pgs = gs.PGS(2, [field1, field2])
430
+ P = pgs(lithotypes)
431
+
432
+ fig, axs = plt.subplots(1, 2)
433
+ axs[0].imshow(lithotypes, cmap="copper")
434
+ axs[1].imshow(P, cmap="copper")
435
+ plt.show()
436
+
437
+ .. image:: https://raw.githubusercontent.com/GeoStat-Framework/GSTools/main/docs/source/pics/2d_pgs.png
438
+ :width: 600px
439
+ :align: center
440
+
441
+
442
+ VTK/PyVista Export
443
+ ==================
444
+
445
+ After you have created a field, you may want to save it to file, so we provide
446
+ a handy `VTK <https://www.vtk.org/>`_ export routine using the :class:`.vtk_export()` or you could
447
+ create a VTK/PyVista dataset for use in Python with to :class:`.to_pyvista()` method:
448
+
449
+ .. code-block:: python
450
+
451
+ import gstools as gs
452
+ x = y = range(100)
453
+ model = gs.Gaussian(dim=2, var=1, len_scale=10)
454
+ srf = gs.SRF(model)
455
+ srf((x, y), mesh_type='structured')
456
+ srf.vtk_export("field") # Saves to a VTK file
457
+ mesh = srf.to_pyvista() # Create a VTK/PyVista dataset in memory
458
+ mesh.plot()
459
+
460
+ Which gives a RectilinearGrid VTK file :file:`field.vtr` or creates a PyVista mesh
461
+ in memory for immediate 3D plotting in Python.
462
+
463
+ .. image:: https://raw.githubusercontent.com/GeoStat-Framework/GSTools/main/docs/source/pics/pyvista_export.png
464
+ :width: 600px
465
+ :align: center
466
+
467
+
468
+ Requirements
469
+ ============
470
+
471
+ - `NumPy >= 1.20.0 <http://www.numpy.org>`_
472
+ - `SciPy >= 1.1.0 <http://www.scipy.org>`_
473
+ - `hankel >= 1.0.0 <https://github.com/steven-murray/hankel>`_
474
+ - `emcee >= 3.0.0 <https://github.com/dfm/emcee>`_
475
+ - `pyevtk >= 1.1.1 <https://github.com/pyscience-projects/pyevtk>`_
476
+ - `meshio >= 5.1.0 <https://github.com/nschloe/meshio>`_
477
+
478
+
479
+ Optional
480
+ --------
481
+
482
+ - `GSTools-Core >= 0.2.0 <https://github.com/GeoStat-Framework/GSTools-Core>`_
483
+ - `matplotlib <https://matplotlib.org>`_
484
+ - `pyvista <https://docs.pyvista.org>`_
485
+
486
+
487
+ Contact
488
+ -------
489
+
490
+ You can contact us via `info@geostat-framework.org <mailto:info@geostat-framework.org>`_.
491
+
492
+
493
+ License
494
+ =======
495
+
496
+ `LGPLv3 <https://github.com/GeoStat-Framework/GSTools/blob/main/LICENSE>`_
497
+
498
+
499
+ .. |GH-Discussions| image:: https://img.shields.io/badge/GitHub-Discussions-f6f8fa?logo=github&style=flat
500
+ :alt: GH-Discussions
501
+ :target: https://github.com/GeoStat-Framework/GSTools/discussions
502
+ .. |Email| image:: https://img.shields.io/badge/Email-GeoStat--Framework-468a88?style=flat&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbDpzcGFjZT0icHJlc2VydmUiIHdpZHRoPSI1MDAiIGhlaWdodD0iNTAwIj48cGF0aCBkPSJNNDQ4IDg4SDUyYy0yNyAwLTQ5IDIyLTQ5IDQ5djIyNmMwIDI3IDIyIDQ5IDQ5IDQ5aDM5NmMyNyAwIDQ5LTIyIDQ5LTQ5VjEzN2MwLTI3LTIyLTQ5LTQ5LTQ5em0xNiA0OXYyMjZsLTIgNy0xMTUtMTE2IDExNy0xMTd6TTM2IDM2M1YxMzdsMTE3IDExN0wzOCAzNzBsLTItN3ptMjE5LTYzYy0zIDMtNyAzLTEwIDBMNjYgMTIxaDM2OHptLTc5LTIzIDQ2IDQ2YTM5IDM5IDAgMCAwIDU2IDBsNDYtNDYgMTAxIDEwMkg3NXoiIHN0eWxlPSJmaWxsOiNmNWY1ZjU7ZmlsbC1vcGFjaXR5OjEiLz48L3N2Zz4=
503
+ :alt: Email
504
+ :target: mailto:info@geostat-framework.org
GSTools/source/docs/source/pics/05_ordinary.png ADDED
GSTools/source/docs/source/pics/05_simple.png ADDED
GSTools/source/docs/source/pics/06_ensemble.png ADDED

Git LFS Details

  • SHA256: e4c00c0835fe2385dfa97514a6b2e02875f38c01c337c43fbde5b7540c3f3df6
  • Pointer size: 131 Bytes
  • Size of remote file: 247 kB
GSTools/source/docs/source/pics/07_00_std.png ADDED

Git LFS Details

  • SHA256: a81c3a07ec10a5efca9a16c804904fab1c6f9bad84bd1acfb6edb0394caed0ac
  • Pointer size: 131 Bytes
  • Size of remote file: 116 kB
GSTools/source/docs/source/pics/07_01_lognormal.png ADDED
GSTools/source/docs/source/pics/07_02_binary.png ADDED
GSTools/source/docs/source/pics/07_03_zinnharvey.png ADDED

Git LFS Details

  • SHA256: a4dbc33ee528858a37b27e5f7aaeb3cf65a0f47246baed12b9787c17848f2576
  • Pointer size: 131 Bytes
  • Size of remote file: 158 kB
GSTools/source/docs/source/pics/07_04_arcsin.png ADDED

Git LFS Details

  • SHA256: b8c175a272e71dd8eefc84d942f036578cfa7271b439721f431dbaf41345a27e
  • Pointer size: 131 Bytes
  • Size of remote file: 150 kB
GSTools/source/docs/source/pics/07_05_combine.png ADDED
GSTools/source/docs/source/pics/09_cond_ens.png ADDED

Git LFS Details

  • SHA256: 5528cbf44e890306259539b2602e7e24df470929cc5c163bc9bc022ed7514c2f
  • Pointer size: 131 Bytes
  • Size of remote file: 176 kB
GSTools/source/docs/source/pics/20_gstools.png ADDED
GSTools/source/docs/source/pics/20_pykrige.png ADDED
GSTools/source/docs/source/pics/2d_pgs.png ADDED
GSTools/source/docs/source/pics/3d_gau_field.png ADDED

Git LFS Details

  • SHA256: d60a80aec34ac7c1e45ffd0be9c0dde414d10af9469e9ed116d572c51938007a
  • Pointer size: 131 Bytes
  • Size of remote file: 375 kB
GSTools/source/docs/source/pics/3d_pgs.png ADDED

Git LFS Details

  • SHA256: 11abc212d8947e775043553efce569a79455344baf6922e1d76844adf3d804c3
  • Pointer size: 131 Bytes
  • Size of remote file: 140 kB
GSTools/source/docs/source/pics/GS_3d_vector_field.png ADDED

Git LFS Details

  • SHA256: 1caf236fedfe6d8d006be9c6aa168fcdf1172f68b2a90f38254fcd44e85b748f
  • Pointer size: 132 Bytes
  • Size of remote file: 1.06 MB
GSTools/source/docs/source/pics/GS_pyvista_cut.png ADDED

Git LFS Details

  • SHA256: 50dc31acc19648cf95a9206328b83f263e414cbc71a62aad7fabf1c23b15cb3c
  • Pointer size: 131 Bytes
  • Size of remote file: 368 kB
GSTools/source/docs/source/pics/cond_ens.png ADDED

Git LFS Details

  • SHA256: bc7ad2082ff7d60ae90bbab31e87f52e49d9be39246f105769ce81b2d56189ce
  • Pointer size: 131 Bytes
  • Size of remote file: 105 kB