Skip to content

Instantly share code, notes, and snippets.

View mdsumner's full-sized avatar

Michael Sumner mdsumner

View GitHub Profile

+1 to "one table, one tensor" with keyed chunks. I think rows keep the view pruning that the per-band list is trying to protect, because choosing chunks becomes a filter the engine already knows how to push down.

With one row per chunk keyed by grid index:

-- chunks(raster_id, band, i0, i1, uri, offset, size, inline)
-- view: rows 1000..2999, cols 0..1499; chunk_shape 512 x 512
SELECT * FROM chunks
WHERE raster_id = ? AND band = ?
 AND i0 BETWEEN 1000 / 512 AND 2999 / 512

Valgrind notes: PR #1031 (GDALAlg output leak) and the R-hub nanoarrow failure

PR #1031

Ran valgrind locally in ghcr.io/r-hub/containers/valgrind:latest (Fedora 44, R-devel r90939 valgrind build, valgrind 3.27.1, GDAL 3.12.4).

  • $output() loop (5x raster convert, 1x vector convert):
    • main: 1,112 bytes definitely lost in 5 blocks, from make_unique<GDALRaster> (gdalalg.cpp:2057) and make_unique (gdalalg.cpp:2081) in GDALAlg::getArgValue_()

terra extract points in time efficiently from (xy-regular) zarr.

## Point-in-time (x, y, t) lookup from a cloud Zarr with terra's
## multidimensional reader (GDAL Zarr driver), grouped by chunk.
##
## Each point wants one value: the cell containing (x, y) at the time step
## nearest t. The cost is set by how many distinct Zarr chunks those values
## live in, not by the number of points. So:
##
@mdsumner
mdsumner / vrtcon-reformat.md
Last active November 6, 2026 16:13
breakdown.md

Changes in substance compared with the current text (rewording, reordering and layout not listed):

**New behaviour documented **

  • Per-band scaling is written scale_<n>=... and exponent_<n>=... in the URL (previously only named as scale_bn / exponent_bn).
  • Multiple GCPs are given by repeating gcp=, one GCP each.
  • if and oo may each be given only once; extra values go comma-separated inside that one option, and repeating either is an error.
  • An unknown option is an error.
  • ovr also accepts AUTO, AUTO-<n> and NONE (the value is passed unchanged to -ovr).
  • expand lists gray as an allowed value (the value is passed through to -expand).
  • The source dataset can be any name GDAL can open, including /vsicurl/ paths.

portolan-sdi/portolan-spec#234

Comments on the draft, roughly in priority order:

  1. CRS and grid in the store: zarr-conventions already defines both. https://github.com/zarr-conventions/spatial (spatial:transform, spatial:shape, spatial:registration) and the proj convention (proj:code | proj:wkt2 | proj:projjson, at least one required). The FTW store follows these. Suggest the Grid and CRS sections require these conventions, alongside the multiscales convention the draft already names, rather than a CF variable named
```python
xarray.open_dataset("/vsicurl/https://data.source.coop/ausantarctic/ghrsst-mur-v2/ghrsst-mur-v2.vrt", engine = "gdalxarray")
<xarray.Dataset> Size: 208TB
Dimensions: (time: 8914, y: 17999, x: 36000)
Coordinates:
* time (time) datetime64[ns] 71kB 2002-06-01 ... 2026-10-26
* y (y) float64 144kB 89.99 89.98 89.97 ... -89.98 -89.99
* x (x) float64 288kB -180.0 -180.0 -180.0 ... 180.0 180.0
Data variables:
analysed_sst (time, y, x) float64 46TB ...
Conversation with Gemini
Can gridlook render a projected COG
No, GridLook cannot natively render a Cloud Optimized GeoTIFF (COG).
GridLook (d70-t/gridlook) is built specifically for visualizing Earth System Model (ESM) output directly in the browser via WebGL, targeting chunked multidimensional array formats like Zarr and Icechunk. It does not have built-in decoders or HTTP range-request drivers for GeoTIFF/COG structures.
GitHub
If you need to render a projected COG in GridLook or a similar client-side WebGL stack, your primary options are: