|
13 | 13 |
|
14 | 14 | from gempy_engine.core.data.raw_arrays_solution import RawArraysSolution
|
15 | 15 |
|
| 16 | +from gempy_viewer.modules.plot_2d.visualization_2d import Plot2D |
| 17 | +from gempy_viewer.modules.plot_2d.drawer_regular_grid_2d import plot_regular_grid_area |
| 18 | + |
16 | 19 | try:
|
17 | 20 | from scipy.spatial.distance import cdist
|
18 | 21 | except ImportError:
|
@@ -221,7 +224,7 @@ def plot(self, type_='variogram', show_parameters=True):
|
221 | 224 | plt.xlim(0, self.range_ * 4)
|
222 | 225 |
|
223 | 226 |
|
224 |
| -class field_solution(object): |
| 227 | +class KrigingFieldSolution(object): |
225 | 228 |
|
226 | 229 | def __init__(self, domain, variogram_model, results, field_type):
|
227 | 230 |
|
@@ -307,6 +310,27 @@ def plot_results(self, geo_data, prop='val', direction='y', result='interpolatio
|
307 | 310 | plt.tight_layout()
|
308 | 311 |
|
309 | 312 |
|
| 313 | +def plot_kriging_results(geo_data: gp.data.GeoModel, kriging_solution: KrigingFieldSolution, plot_2d: Plot2D, |
| 314 | + title: str, result_column: list[str]): |
| 315 | + for e, ax in enumerate(plot_2d.axes): |
| 316 | + a = np.full_like(kriging_solution.domain.mask, np.nan, dtype=np.double) |
| 317 | + vals = kriging_solution.results_df[result_column[e]].values |
| 318 | + a[np.where(kriging_solution.domain.mask == True)] = vals |
| 319 | + |
| 320 | + im = plot_regular_grid_area( |
| 321 | + ax=ax, |
| 322 | + slicer_data=plot_2d.section_data_list[0].slicer_data, |
| 323 | + block=a, |
| 324 | + resolution=geo_data.grid.regular_grid.resolution, |
| 325 | + cmap='viridis', |
| 326 | + norm=None, |
| 327 | + ) |
| 328 | + |
| 329 | + ax.set_title(title) |
| 330 | + plot_2d.fig.colorbar(im, label='Property value') |
| 331 | + plot_2d.fig.show() |
| 332 | + |
| 333 | + |
310 | 334 | # TODO: check with new ordianry kriging and nugget effect
|
311 | 335 | def simple_kriging(a, b, prop, var_mod, inp_mean):
|
312 | 336 | '''
|
@@ -463,7 +487,7 @@ def create_kriged_field(domain, variogram_model, distance_type='euclidian',
|
463 | 487 |
|
464 | 488 | results_df = pd.DataFrame(data=d)
|
465 | 489 |
|
466 |
| - return field_solution(domain, variogram_model, results_df, field_type='interpolation') |
| 490 | + return KrigingFieldSolution(domain, variogram_model, results_df, field_type='interpolation') |
467 | 491 |
|
468 | 492 |
|
469 | 493 | def create_gaussian_field(domain, variogram_model, distance_type='euclidian',
|
@@ -578,4 +602,4 @@ def create_gaussian_field(domain, variogram_model, distance_type='euclidian',
|
578 | 602 | results_df = pd.DataFrame(data=d)
|
579 | 603 | results_df = results_df.sort_values(['X', 'Y', 'Z'])
|
580 | 604 |
|
581 |
| - return field_solution(domain, variogram_model, results_df, field_type='simulation') |
| 605 | + return KrigingFieldSolution(domain, variogram_model, results_df, field_type='simulation') |
0 commit comments