Skip to content

Instantly share code, notes, and snippets.

View mdsumner's full-sized avatar

Michael Sumner mdsumner

  • Integrated Digital East Antarctica, Australian Antarctic Division
  • Hobart, Australia
View GitHub Profile

IBCSO digital chart textured across a wide meriodional range to Mercator.

library(anglr)  ## hypertidy/anglr

library(raster)
library(curl)
library(rgl)
## download IBCSO
ibcso_url <- "https://github.com/mdsumner/ibcso-cog/raw/refs/heads/main/IBCSO_v2_digital_chart.tif"

In these CMEMs ZARR there's evidence of the dummy "crs" var used via "grid_mapping" in NetCDF, but there's no such var.

https://data.marine.copernicus.eu/product/SEALEVEL_GLO_PHY_L4_MY_008_047/description

curl -s "https://s3.waw3-1.cloudferro.com/mdl-arco-time-045/arco/SEALEVEL_GLO_PHY_L4_MY_008_047/cmems_obs-sl_glo_phy-ssh_my_allsat-demo-l4-duacs-0.125deg_P1D-i_202511/timeChunked.zarr/.zmetadata" | grep -i "grid_mapping\|crs\|spatial_ref"
      "grid_mapping": "crs",
      "grid_mapping": "crs",
      "grid_mapping": "crs",
  xx <- seq(100, 220, by = 5)
yy <- seq(-60, -30, by = 10)
x <- cbind(expand.grid(xmin = head(xx, -1), ymax = tail(yy, -1)), 
  expand.grid(xmax = tail(xx, -1), ymin = head(yy, -1)))

library(wk)
library(PROJ)
library(geos)
## source, then target

a plumber2 function to get imagery for a website from a URI (/vsizip//vsicurl/ vsiaz, WMTS: etc etc)

#* @get /tile
#* @serializer image/png
function(query) {

Sys.setenv(
  GDAL_CACHEMAX = "2048",           # MB for block cache
  VSI_CACHE = "TRUE",              # Cache remote reads
# test_minimal_mesh.R
# Run this locally where wk/vctrs are available

library(wk)
library(vctrs)

# Source our wkpool code
source("R/wkpool.R")
#> Warning in file(filename, "r", encoding = encoding): cannot open file
library(terra)
## crs changes where it is longitudinally, this is southern hemi range for UTM
r <- rast(ext(c(1e+05, 9e+05, 11e+05, 1e+07)), res = 1e5, crs = "EPSG:32755")
plot(project(densify(as.polygons(r), 5000), "EPSG:4326"))
maps::map(add= TRUE)
library(measoshapes)
library(dplyr)
library(sf)

## join on the names
measo_regions <- measo_regions05  |>  inner_join(measo_names, by = "name", relationship = "many-to-many")
## here we dissolve by name (remove the antimeridian split)
measo &lt;- measo_regions |&gt; group_by(name, zone, fill) |&gt; summarize()