.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/02_cov_model/04_different_scales.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_02_cov_model_04_different_scales.py: Different scales ================ Besides the length-scale, there are many other ways of characterizing a certain scale of a covariance model. We provide two common scales with the covariance model. Integral scale -------------- The `integral scale `_ of a covariance model is calculated by: .. math:: I = \int_0^\infty \rho(r) dr You can access it by: .. GENERATED FROM PYTHON SOURCE LINES 19-27 .. code-block:: Python import gstools as gs model = gs.Stable(dim=3, var=2.0, len_scale=10) print("Main integral scale:", model.integral_scale) print("All integral scales:", model.integral_scale_vec) .. rst-class:: sphx-glr-script-out .. code-block:: none Main integral scale: 9.027452929509336 All integral scales: [9.02745293 9.02745293 9.02745293] .. GENERATED FROM PYTHON SOURCE LINES 28-30 You can also specify integral length scales like the ordinary length scale, and len_scale/anis will be recalculated: .. GENERATED FROM PYTHON SOURCE LINES 30-39 .. code-block:: Python model = gs.Stable(dim=3, var=2.0, integral_scale=[10, 4, 2]) print("Anisotropy ratios:", model.anis) print("Main length scale:", model.len_scale) print("All length scales:", model.len_scale_vec) print("Main integral scale:", model.integral_scale) print("All integral scales:", model.integral_scale_vec) .. rst-class:: sphx-glr-script-out .. code-block:: none Anisotropy ratios: [0.4 0.2] Main length scale: 11.077321674324725 All length scales: [11.07732167 4.43092867 2.21546433] Main integral scale: 10.0 All integral scales: [10. 4. 2.] .. GENERATED FROM PYTHON SOURCE LINES 40-46 Percentile scale ---------------- Another scale characterizing the covariance model, is the percentile scale. It is the distance, where the normalized variogram reaches a certain percentage of its sill. .. GENERATED FROM PYTHON SOURCE LINES 46-55 .. code-block:: Python model = gs.Stable(dim=3, var=2.0, len_scale=10) per_scale = model.percentile_scale(0.9) int_scale = model.integral_scale len_scale = model.len_scale print("90% Percentile scale:", per_scale) print("Integral scale:", int_scale) print("Length scale:", len_scale) .. rst-class:: sphx-glr-script-out .. code-block:: none 90% Percentile scale: 17.437215135964117 Integral scale: 9.027452929509336 Length scale: 10.0 .. GENERATED FROM PYTHON SOURCE LINES 56-63 .. note:: The nugget is neglected by the percentile scale. Comparison ---------- .. GENERATED FROM PYTHON SOURCE LINES 63-70 .. code-block:: Python ax = model.plot() ax.axhline(1.8, color="k", label=r"90% percentile") ax.axvline(per_scale, color="k", linestyle="--", label=r"90% percentile scale") ax.axvline(int_scale, color="k", linestyle="-.", label=r"integral scale") ax.axvline(len_scale, color="k", linestyle=":", label=r"length scale") ax.legend() .. image-sg:: /examples/02_cov_model/images/sphx_glr_04_different_scales_001.png :alt: 04 different scales :srcset: /examples/02_cov_model/images/sphx_glr_04_different_scales_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.054 seconds) .. _sphx_glr_download_examples_02_cov_model_04_different_scales.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 04_different_scales.ipynb <04_different_scales.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 04_different_scales.py <04_different_scales.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 04_different_scales.zip <04_different_scales.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_