.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/07_transformations/01_binary.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_01_binary.py: binary fields ------------- Here we transform a field to a binary field with only two values. The dividing value is the mean by default and the upper and lower values are derived to preserve the variance. See :any:`transform.binary` .. GENERATED FROM PYTHON SOURCE LINES 11-21 .. image-sg:: /examples/07_transformations/images/sphx_glr_01_binary_001.png :alt: Field 2D structured: (100, 100) :srcset: /examples/07_transformations/images/sphx_glr_01_binary_001.png :class: sphx-glr-single-img .. 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, seed=20170519) srf.structured([x, y]) srf.transform("binary") srf.plot() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.412 seconds) .. _sphx_glr_download_examples_07_transformations_01_binary.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 01_binary.ipynb <01_binary.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 01_binary.py <01_binary.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 01_binary.zip <01_binary.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_