Skip to content

Instantly share code, notes, and snippets.

View mdsumner's full-sized avatar

Michael Sumner mdsumner

View GitHub Profile
ds = xr.open_zarr(
     session.store,
     group="goes19_goes18/10m/C08/2026-03-10",
    zarr_format=3,
)
ds
code for https://rstats.me/@mdsumner/117059558926596079
run on Pawsey, packages are on CRAN or gh:hypertidy
```R
#!/usr/bin/env Rscript
## Pacific mean SST from GHRSST COGs, one value per date.
## File-per-date cache: rerun any time, only missing dates are computed,
## failures write nothing and are picked up on the next run.

https://github.com/hypertidy/bigcurve

{bigcurve} provides D3-level adaptive densifications at shape-segment level with bisecting line segments if required by the coordinate transformation, on a solid C++ basis, with {wk} for format wrangling and CRS transform, {wkpool} provides segments (with topology, future proof)

p <- geos::as_geos_geometry(terra::as.polygons(terra::rast(terra::ext(-150, 150, -85, 85), res = 15)))

tgt <- "+proj=laea"
tr &lt;- PROJ::proj_trans_create(wk::wk_crs(p)$wkt, tgt)
# dsn <- sds::nsidc_seaice()
# library(terra)
# plot(rast(dsn))
#e <- draw()
#dput(round(as.vector(e)))
## pole inside extent, south polar steregraphic
e <- c(xmin = -1094338, xmax = 1230070, ymin = -699223, ymax = 997424)
xyedge <- vaster::vaster_boundary(c(64, 64), e)
## reproj_extent infills the source extent to not miss the pole
xarray.open_dataset("https://www.ncei.noaa.gov/data/sea-surface-temperature-optimum-interpolation/v2.1/access/avhrr/198109/oisst-avhrr-v02r01.19810901.nc")
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: <!DOCTYPE^ HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL was not found on this server.</p></body></html>
Traceback (most recent call last):
  File "/opt/gdal-py/lib/python3.12/site-packages/xarray/backends/file_manager.py", line 219, in _acquire_with_cache_info
    file = self._cache[self._key]
           ~~~~~~~~~~~^^^^^^^^^^^
  File "/opt/gdal-py/lib/python3.12/site-packages/xarray/backends/lru_cache.py", line 56, in __getitem__

small example using a docker image from https://github.com/hypertidy/gdal-r-ci, I'm using dev because the mdim print output is human readable (by default, json by option)

docker pull ghcr.io/hypertidy/gdal-system:dev
docker run --rm -ti ghcr.io/hypertidy/gdal-system:dev

#── ghcr.io/hypertidy/gdal-system ──
#GDAL 3.14.0dev   PROJ 9.8.1   GEOS 3.15.0beta1
#Py   3.12.3   numpy 2.5.1
@mdsumner
mdsumner / omerc_triangle.md
Last active July 11, 2026 13:15
a rough stab at the triangle map going around
xy <- do.call(cbind, maps::map(plot = F)[1:2])

mm <- matrix(c(8L, -95L, -50L, 59L, -47L, -62L), ncol = 2)
mm <- rbind(mm, mm[1, ])
n <- nrow(mm)
x <- 1:n
idx <- seq(1, n, length.out = 200 )
par(mfrow = c(2, 1))
maps::map()

redirect_storage panics (PanicException, not IcechunkError) resolving an http+icechunk:// Location

Following the storage guide's Redirect Storage section: a 302 whose Location uses the documented http+icechunk:// scheme causes a Rust panic that escapes to Python as pyo3_runtime.PanicException rather than an IcechunkError.

Reprex:

import http.server, threading, icechunk as ic
  1. List all of OISST netcdf files from object storage and derive date from path
  2. Remove duplicates that are 'preliminary' files replaced by final, and sort by date
  3. Stack into MDIM VRT with xml and templating from the first few files
### 1. 
Sys.setenv("AWS_NO_SIGN_REQUEST" = "YES")
root <- "/vsis3/noaa-cdr-sea-surface-temp-optimum-interpolation-pds/data/v2.1/avhrr"
#run --rm -ti -v $HOME/Git/gdalxarray:/gdalxarray  ghcr.io/hypertidy/gdal-r-python:dev


import os
os.environ["AWS_NO_SIGN_REQUEST"] = "YES"
os.environ["AWS_REGION"] = "us-west-2"

# 1. confirm register() is active and chunk manager is happy
from dask_array.xarray import register; register()