--- pretty_name: HHDC HyperHeight LiDAR Cubes in Lance license: cc-by-4.0 task_categories: - image-to-image language: - en tags: - lance - lidar - geospatial - remote-sensing - neon - canopy - information-retrieval size_categories: - 10K 0 footprints = present.any(axis=1) top = 127 - present[:, ::-1, :].argmax(axis=1) density = array.sum(axis=1, dtype=np.float64) def distribution(matrix): total = matrix.sum(axis=1, keepdims=True) normalized = np.divide(matrix, total, out=np.zeros(matrix.shape, dtype=np.float64), where=total > 0) return np.sqrt(normalized) def histogram(values, valid): block = np.arange(count, dtype=np.int64)[:, None] * 16 return np.bincount((values + block)[valid], minlength=count * 16).reshape(count, 16) return_profile = profiles.reshape(count, 64, 2).sum(axis=2) footprint_profile = present.reshape(count, 32, 4, -1).any(axis=2).sum(axis=2) top_histogram = histogram(top // 8, footprints) density_band = np.minimum(np.floor(np.log2(1 + density)).astype(np.int64), 15) density_histogram = histogram(density_band, np.ones_like(footprints)) descriptor = np.concatenate([distribution(part) for part in (return_profile, footprint_profile, top_histogram, density_histogram)], axis=1) cumulative = profiles.cumsum(axis=1) total = cumulative[:, -1] p95_bin = (cumulative >= total[:, None] * 0.95).argmax(axis=1) upper_fraction = (footprints & (top >= 4)).mean(axis=1) mean_returns = density.mean(axis=1) return descriptor.astype(np.float32), np.column_stack((p95_bin, upper_fraction, mean_returns)).astype(np.float32) def embed(descriptor, model): """Apply the saved training-only scaler and PCA and normalize for cosine search.""" features = (descriptor - model['mean']) / model['scale'] projected = (features - model['pca_mean']) @ model['components'].T norm = np.linalg.norm(projected, axis=-1, keepdims=True) return np.divide(projected, norm, out=np.zeros_like(projected), where=norm > 0).astype(np.float32) repo = "lance-format/hhdc-lance" root = f"hf://datasets/{repo}" held_out = lance.dataset(root + "/data/test.lance") sample = held_out.take([0], columns=["filename", "cube"]) cube = sample["cube"].combine_chunks().flatten().to_numpy().reshape(128, 48, 48) print("Held-out test tile:", sample["filename"][0].as_py()) descriptor, _ = morphology(cube) model_path = hf_hub_download(repo, "model/morphology-pca64.npz", repo_type="dataset") with np.load(model_path, allow_pickle=False) as model: query = embed(descriptor, model)[0] search = lance.dataset(root + "/search/cubes.lance") hits = search.to_table( columns=["filename", "split", "cube_index", "return_p95_bin", "_distance"], filter="split = 'train'", prefilter=True, nearest={"column": "embedding", "q": query, "k": 5, "metric": "cosine"}, ).to_pylist() for row in hits: score = 1.0 - row["_distance"] print(f"{score:.4f} {row['split']}/{row['filename']} row={row['cube_index']} p95 bin={row['return_p95_bin']}") ``` ## Read original NPZ archives The source repository also contains one legacy NPZ file per canonical cube. `legacy/cubes.lance` exposes every original archive as a Blob v2 reference. The archive retains the source dtype and its extra coordinates, bin edges, footprint counts, and metadata. Pin the external base separately so the archive bytes resolve against the audited source revision. The example reads the exact legacy archive for the search query above. ```python import io import lance import numpy as np source = "hf://datasets/anfera236/HHDC" pin = "d0c7dc6a218f0e2c2afdfcb05afdb31b25d11263" legacy = lance.dataset( "hf://datasets/lance-format/hhdc-lance/legacy/cubes.lance", base_store_params={source: {"hf_revision": pin}}, ) row, = legacy.to_table( columns=["source_path"], filter="split = 'test' AND cube_index = 0", with_row_id=True, limit=1, ).to_pylist() with legacy.take_blobs("npz", ids=[row["_rowid"]])[0] as blob: with np.load(io.BytesIO(blob.read()), allow_pickle=False) as archive: original_cube = archive["cube"] print(row["source_path"], original_cube.shape, original_cube.dtype) ``` ## Source, license, and attribution Andres Ramirez-Jaime released the HHDC dataset under CC BY 4.0. This conversion uses source commit `d0c7dc6a218f0e2c2afdfcb05afdb31b25d11263`. The changes are the lossless Lance representation, source asset references, and a morphology search with Parquet previews. The original card and the publisher’s larger replication sample are included for reference. Cite HHDC and its original NEON data product, retaining survey site and month identifiers wherever available in source provenance. [Pinned HHDC source](https://huggingface.co/datasets/anfera236/HHDC/tree/d0c7dc6a218f0e2c2afdfcb05afdb31b25d11263) · [Original dataset card](source/HHDC-README.md) · [Publisher’s replication cube](source/SampleCube/gt2.npz) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) - National Ecological Observatory Network (NEON). *Discrete return LiDAR point cloud* (DP1.30003.001). [NEON data product](https://data.neonscience.org/data-products/DP1.30003.001) · [NEON usage and citation policy](https://www.neonscience.org/usage-policies) - Ramirez-Jaime, A., Pena-Pena, K., Arce, G. R., Harding, D., Stephen, M., and MacKinnon, J. (2024). *HyperHeight LiDAR Compressive Sampling and Machine Learning Reconstruction of Forested Landscapes*. IEEE Transactions on Geoscience and Remote Sensing. [Article](https://doi.org/10.1109/TGRS.2024.3356389) - Ramirez-Jaime, A., Porras-Diaz, N., Arce, G. R., and Stephen, M. (2025). *Super-Resolved 3-D Satellite Lidar Imaging of Earth via Generative Diffusion Models*. IEEE Transactions on Geoscience and Remote Sensing. [Article](https://doi.org/10.1109/TGRS.2025.3543670)