.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/07_transformations/05_combinations.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_07_transformations_05_combinations.py: Combinations ------------ You can combine different transformations simply by successively applying them. Here, we first force the single field realization to hold the given moments, namely mean and variance. Then we apply the Zinn & Harvey transformation to connect the low values. Afterwards the field is transformed to a binary field and last but not least, we transform it to log-values. We can select the desired field by its name and we can define an output name to store the field. If you don't specify `field` and `store` everything happens inplace. .. GENERATED FROM PYTHON SOURCE LINES 18-32 .. code-block:: Python import gstools as gs # structured field with a size of 100x100 and a grid-size of 1x1 x = y = range(100) model = gs.Gaussian(dim=2, var=1, len_scale=10) srf = gs.SRF(model, mean=-9, seed=20170519) srf.structured([x, y]) srf.transform("force_moments", field="field", store="f_forced") srf.transform("zinnharvey", field="f_forced", store="f_zinnharvey", conn="low") srf.transform("binary", field="f_zinnharvey", store="f_binary") srf.transform("lognormal", field="f_binary", store="f_result") srf.plot(field="f_result") .. image-sg:: /examples/07_transformations/images/sphx_glr_05_combinations_001.png :alt: Field 2D structured: (100, 100) :srcset: /examples/07_transformations/images/sphx_glr_05_combinations_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 34-39 The resulting field could be interpreted as a transmissivity field, where the values of low permeability are the ones being the most connected and only two kinds of soil exist. All stored fields can be accessed and plotted by name: .. GENERATED FROM PYTHON SOURCE LINES 39-42 .. code-block:: Python print("Max binary value:", srf.f_binary.max()) srf.plot(field="f_zinnharvey") .. image-sg:: /examples/07_transformations/images/sphx_glr_05_combinations_002.png :alt: Field 2D structured: (100, 100) :srcset: /examples/07_transformations/images/sphx_glr_05_combinations_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Max binary value: -8.0 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.591 seconds) .. _sphx_glr_download_examples_07_transformations_05_combinations.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 05_combinations.ipynb <05_combinations.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 05_combinations.py <05_combinations.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 05_combinations.zip <05_combinations.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_