From 04c1bbb670a3314d11716fdacc189afbcc4f9a01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Sun, 8 Aug 2021 13:23:44 +0200 Subject: [PATCH] Update readme example --- CHANGELOG.md | 2 +- README.md | 13 +++++++------ docs/source/index.rst | 13 +++++++------ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f96b14d..06c7b670 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to **GSTools** will be documented in this file. -## [1.3.3] - Pure Pink - ? +## [1.3.3] - Pure Pink - 2021-08 ### Enhancements See: [#197](https://github.com/GeoStat-Framework/GSTools/issues/197) diff --git a/README.md b/README.md index 57a7e65b..9f6f87eb 100644 --- a/README.md +++ b/README.md @@ -228,18 +228,19 @@ import gstools as gs cond_pos = [0.3, 1.9, 1.1, 3.3, 4.7] cond_val = [0.47, 0.56, 0.74, 1.47, 1.74] -gridx = np.linspace(0.0, 15.0, 151) - # conditioned spatial random field class model = gs.Gaussian(dim=1, var=0.5, len_scale=2) krige = gs.krige.Ordinary(model, cond_pos, cond_val) cond_srf = gs.CondSRF(krige) +# same output positions for all ensemble members +grid_pos = np.linspace(0.0, 15.0, 151) +cond_srf.set_pos(grid_pos) -# generate the ensemble of field realizations -fields = [] +# seeded ensemble generation +seed = gs.random.MasterRNG(20170519) for i in range(100): - fields.append(cond_srf(gridx, seed=i)) - plt.plot(gridx, fields[i], color="k", alpha=0.1) + field = cond_srf(seed=seed(), store=f"field_{i}") + plt.plot(grid_pos, field, color="k", alpha=0.1) plt.scatter(cond_pos, cond_val, color="k") plt.show() ``` diff --git a/docs/source/index.rst b/docs/source/index.rst index 310acfec..ff7108f8 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -268,18 +268,19 @@ generate 100 realizations and plot them: cond_pos = [0.3, 1.9, 1.1, 3.3, 4.7] cond_val = [0.47, 0.56, 0.74, 1.47, 1.74] - gridx = np.linspace(0.0, 15.0, 151) - # conditioned spatial random field class model = gs.Gaussian(dim=1, var=0.5, len_scale=2) krige = gs.krige.Ordinary(model, cond_pos, cond_val) cond_srf = gs.CondSRF(krige) + # same output positions for all ensemble members + grid_pos = np.linspace(0.0, 15.0, 151) + cond_srf.set_pos(grid_pos) - # generate the ensemble of field realizations - fields = [] + # seeded ensemble generation + seed = gs.random.MasterRNG(20170519) for i in range(100): - fields.append(cond_srf(gridx, seed=i)) - plt.plot(gridx, fields[i], color="k", alpha=0.1) + field = cond_srf(seed=seed(), store=f"field_{i}") + plt.plot(grid_pos, field, color="k", alpha=0.1) plt.scatter(cond_pos, cond_val, color="k") plt.show()