Geographic Neural Data Cube - Read and analyze .gndc compressed geospatial time-series data
Project description
pygndc
Geographic Neural Data Cube - A Python SDK for reading and analyzing .gndc compressed geospatial time-series data.
What is GeoNDC?
GeoNDC is a neural network-based compression format for multi-dimensional geospatial raster data. A single .gndc file stores 4D spatiotemporal data (Time x Height x Width x Bands) with up to 300:1 compression ratios.
Key capabilities:
- Arbitrary time reconstruction - reconstruct data at any time point, not just original observation times
- Fast random access - query any pixel at any timestamp instantly
- Analytic gradients - compute spatial/temporal derivatives directly from the neural network
- Multi-sensor support - Sentinel-2, Landsat, MODIS, HiGLASS, and more
Online Viewer & Data
- Web Viewer: Browse
.gndcfiles directly in the browser via WebGPU at geondc.org/viewer — no installation required, GPU-accelerated, runs entirely client-side. - Sample Data: Download
.gndcdatasets from Hugging Face.
Installation
pip install pygndc
Or from source:
git clone https://github.com/jianboqi/pygndc.git
cd pygndc
pip install .
GPU support (recommended)
pip install pygndc installs CPU-only PyTorch by default. For GPU acceleration, install CUDA-enabled PyTorch first:
# Example for CUDA 12.1 (check https://pytorch.org for your CUDA version)
pip install torch --index-url https://download.pytorch.org/whl/cu121
# Then install pygndc
pip install pygndc
tiny-cuda-nn (fastest)
For best performance, install tiny-cuda-nn. This provides the optimized TCNN backend with significantly faster inference and lower memory usage.
pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
Note: tiny-cuda-nn requires an NVIDIA GPU with CUDA support and a C++ compiler. If you cannot install it, pygndc will automatically fall back to pure PyTorch (
torch_gpuortorch_cpu).
Optional dependencies
pip install pygndc[all] # xarray + geopandas + scipy
pip install pygndc[xarray] # xarray support
pip install pygndc[geo] # geopandas + shapely
Inference modes
pygndc uses a single mode parameter to control both the backend and device:
| Mode | Backend | Device | Description |
|---|---|---|---|
auto |
auto-detect | auto-detect | Default. Best available mode |
tcnn_cuda |
tiny-cuda-nn | GPU | Fastest. Requires tinycudann + CUDA |
torch_gpu |
PyTorch | GPU | No extra dependencies, requires CUDA |
torch_cpu |
PyTorch | CPU | Works everywhere, slowest |
Quick Start
import pygndc
# Open a .gndc file (auto-detects best mode)
with pygndc.open("samples/S2_sample_2022_to_2025.gndc") as ds:
print(ds) # Shows mode, shape, CRS, etc.
# Read a frame
frame = ds.read(t=0) # (H, W, C) by index
frame = ds.read(t="2024-06-15") # by date string
frame = ds.read_at_time("2024-06-15 12:00:00") # continuous interpolation
# Point query (coordinates within the sample's bounds)
series = ds.sample(lon=116.825, lat=40.486) # (T, C) full time series
values = ds.sample(lon=116.825, lat=40.486, t=0) # (C,) single time
# Pixel time series
series = ds.pixel_series(row=140, col=140) # (T, C)
# Analysis
ndvi = ds.ndvi(t=0, red_band=2, nir_band=3) # (H, W)
dx, dy = ds.gradient(t=0, mode="spatial") # analytic gradients
# Export
arr = ds.to_numpy(t=0) # (H, W, C) numpy array
ds.to_tif("frame_0.tif", t=0) # single frame to GeoTIFF
ds.to_tifs("output_dir/") # all frames
xds = ds.to_xarray() # xarray Dataset
# Specify mode explicitly
with pygndc.open("samples/S2_sample_2022_to_2025.gndc", mode="torch_cpu") as ds:
frame = ds.read(t=0)
CLI Commands
# Show model info
pygndc info model.gndc
pygndc info model.gndc --json
# Decompress to GeoTIFF files
pygndc decompress -i model.gndc -o ./output
pygndc decompress -i model.gndc -o ./output --timestamp 2024-06-15
pygndc decompress -i model.gndc -o ./output --start 2024-01-01 --end 2024-12-31 --interval 5
# Compute NDVI
pygndc ndvi -i model.gndc -o ndvi.tif --red-band 0 --nir-band 1
# Compute spatial gradient
pygndc derivative -i model.gndc -o gradient.tif --grad-mode mag
# Point query
pygndc sample -i model.gndc --lon 116.5 --lat 39.9
# Export pixel time series to CSV
pygndc timeseries -i model.gndc --row 100 --col 200 -o series.csv
# Launch interactive viewer
pygndc viewer -i model.gndc
# All commands support --mode (auto, tcnn_cuda, torch_gpu, torch_cpu)
pygndc decompress -i model.gndc -o ./output --mode torch_cpu
Interactive Viewer
A GUI tool for visualizing .gndc files with multiple display modes, time navigation, and pixel inspection.
from pygndc import start_viewer
start_viewer()
Features:
- RGB, NDVI, temporal gradient, and spatial gradient display modes
- Time slider with date navigation
- Click-to-inspect pixel time series
- Region selection and zoom
- Export current frame or entire time series
File Format
A .gndc file is a zstandard-compressed archive containing:
| Component | Description |
|---|---|
| Header | JSON metadata (dimensions, timestamps, CRS, band info) |
| Model Weights | Compressed neural network parameters |
| Mask Data | Optional validity mask (static or dynamic) |
| Residuals | Optional correction data for higher accuracy |
API Reference
See API_Reference.md for the full API documentation.
License
MIT License
Citation
@software{pygndc,
author = {Jianbo Qi},
title = {pygndc: Geographic Neural Data Cube},
year = {2024},
url = {https://github.com/jianboqi/pygndc},
license = {MIT}
}
Contact
- Author: Jianbo Qi
- Email: jianboqi@126.com
- Issues: GitHub Issues
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pygndc-1.0.0.tar.gz.
File metadata
- Download URL: pygndc-1.0.0.tar.gz
- Upload date:
- Size: 56.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c12d410408d1e5da5d9973ab4315eb7dbaf719808ca444837fb0880bb9e3e104
|
|
| MD5 |
d39e58cbf6bd9328d6687760ba6451fa
|
|
| BLAKE2b-256 |
cd86a5fa0af222b72a322086efc7ef16c2397c166bec2a594b44ac73eea63cb7
|
Provenance
The following attestation bundles were made for pygndc-1.0.0.tar.gz:
Publisher:
publish.yml on jianboqi/pygndc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygndc-1.0.0.tar.gz -
Subject digest:
c12d410408d1e5da5d9973ab4315eb7dbaf719808ca444837fb0880bb9e3e104 - Sigstore transparency entry: 1185098486
- Sigstore integration time:
-
Permalink:
jianboqi/pygndc@dd2a9e04ae842ac8a9433035194fdebf163e0a28 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/jianboqi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dd2a9e04ae842ac8a9433035194fdebf163e0a28 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pygndc-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pygndc-1.0.0-py3-none-any.whl
- Upload date:
- Size: 59.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d45806003717ce0e8ff4b11571ea8999f445efc5551894d3256e05ad5ac9749
|
|
| MD5 |
28008a47668d18a438d8a3896d3dcdfb
|
|
| BLAKE2b-256 |
0c82fc3b20e888aa46ada91b8f3f81918023ea0efa9e4635df3b6aa8fb1bb2ad
|
Provenance
The following attestation bundles were made for pygndc-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on jianboqi/pygndc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygndc-1.0.0-py3-none-any.whl -
Subject digest:
3d45806003717ce0e8ff4b11571ea8999f445efc5551894d3256e05ad5ac9749 - Sigstore transparency entry: 1185098489
- Sigstore integration time:
-
Permalink:
jianboqi/pygndc@dd2a9e04ae842ac8a9433035194fdebf163e0a28 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/jianboqi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dd2a9e04ae842ac8a9433035194fdebf163e0a28 -
Trigger Event:
push
-
Statement type: