.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/3Dvispy/18-display_range.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_gallery_3Dvispy_18-display_range.py: Limit slices to a useful display range ====================================== ``display_range`` restricts the visible data range along x/y/z axes. The range is also pushed into slice reads, so lazy sources do not need to load the hidden part of a slice. This is useful for large volumes such as ``600 x 500 x 1500`` when the bottom time/depth samples contain mostly unused information. The bundled demo data is smaller, so we keep only the upper part of the z axis to show the workflow. .. image:: ../../_static/cigvis/3Dvispy/18.png :alt: image :align: center .. GENERATED FROM PYTHON SOURCE LINES 23-62 .. code-block:: Python # sphinx_gallery_thumbnail_path = '_static/cigvis/3Dvispy/18.png' import numpy as np import cigvis from pathlib import Path root = Path(__file__).resolve().parent.parent.parent sxp = root / 'data/rgt/sx.dat' ni, nx, nt = 128, 128, 128 sx = np.memmap(sxp, np.float32, 'r', shape=(ni, nx, nt)) # Use original data coordinates and Python half-open ranges: [start, stop). # Here x/y slices only read z samples 0..89 instead of the full 0..127 range. display_range = {'z': (0, 90)} nodes = cigvis.create_slices( sx, pos={'x': [36], 'y': [28], 'z': [70]}, cmap='Petrel', clim=[-2.5, 2.5], display_range=display_range, ) nodes += cigvis.create_axis( (ni, nx, display_range['z'][1] - display_range['z'][0]), 'box', axis_pos='auto', axis_labels=['Inline', 'Xline', 'Time sample'], ) nodes += cigvis.create_colorbar_from_nodes(nodes, 'Amplitude', select='slices') cigvis.plot3D( nodes, view=cigvis.Plot3DView(size=(750, 600)), save=cigvis.Plot3DSave(path='example.png', transparent_bg=False), ) .. _sphx_glr_download_gallery_3Dvispy_18-display_range.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 18-display_range.ipynb <18-display_range.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 18-display_range.py <18-display_range.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 18-display_range.zip <18-display_range.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_