# This file was extracted from the HV SDK Docusaurus examples. # It is intended as a downloadable, runnable companion to the documentation. # Set HSI_EXAMPLE_BASE_DIR and related env vars to use your own data. # Source page: /hsi/hv_sdk/examples/basics#open-and-inspect-a-datacube # region: setup import os from pathlib import Path import qtec_hv_sdk as hs BASE_DIR = Path(os.environ.get("HSI_EXAMPLE_BASE_DIR", "/path/to/HSI_data/nuts")) if not BASE_DIR.exists(): raise SystemExit( "Run: 'export HSI_EXAMPLE_BASE_DIR=/path/to/HSI_data/' to setup the " "folder containing the example datacubes." ) CUBE = os.environ.get("HSI_EXAMPLE_CUBE", "mix1.pam") # end region # region: example cube = hs.open(str(BASE_DIR / CUBE)) print(f"Shape: {cube.shape}") print(f"Lines: {cube.shape.lines}") print(f"Samples: {cube.shape.samples}") print(f"Bands: {cube.shape.bands}") print(f"Metadata: {cube.meta}") # end region