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
library(shiny)
library(shinyglide)
ui <- fluidPage(
glide(
screen(
h2("Image 1"),
img(src = "image1.png", width = "100%")
),
screen(

this appears to be working (on setonix I just had to uv venv .venv and install virtual-tiff and it runs)

import obstore
from virtualizarr.registry import ObjectStoreRegistry
from virtual_tiff import VirtualTIFF
import xarray as xr

# Configuration
endpoint = "https://projects.pawsey.org.au/"

You should update your understanding

don't need anything client side to read a single polygon or field from within a shape file at a URL (or in a zip at a URL). Same goes for parquet

I think you're confused about tools you use.

accuracy matters as does not spreading bullshit

https://bsky.app/profile/postholer.com/post/3lmb6nxh7fs2x

minute check on this PR in GDAL for GetRawBlockInfo

OSGeo/gdal#13260

from osgeo import gdal
gdal.UseExceptions()
ds = gdal.OpenEx("/vsicurl/https://thredds.nci.org.au/thredds/fileServer/gb6/BRAN/BRAN2023/daily/ocean_temp_2010_01.nc", gdal.OF_MULTIDIM_RASTER)
info  = temp.GetRawBlockInfo([0,0,0,0])
info.GetOffset()
<VRTDataset>
<Group name="/">
<Dimension name="Time" type="TEMPORAL" size="5479" indexingVariable="Time" />
<Dimension name="st_ocean" type="VERTICAL" direction="DOWN" size="51" indexingVariable="st_ocean" />
<Dimension name="xt_ocean" type="HORIZONTAL_X" size="3600" indexingVariable="xt_ocean" />
<Dimension name="yt_ocean" type="HORIZONTAL_Y" size="1500" indexingVariable="yt_ocean" />
<Array name="Time">
<DataType>Float64</DataType>
<DimensionRef ref="Time" />
<RegularlySpacedValues start="11323.5" increment="1" />
#that for me needs env vars set: 
#COPERNICUSMARINE_SERVICE_USERNAME 
#COPERNICUSMARINE_SERVICE_PASSWORD

#that is able to obtain the "Authorization Bearer: <token>", which fwiw can be used directly with any GDAL tool 
## via GDAL_HTTP_HEADERS or GDAL_HTTP_HEADER_FILE (and we can use multidim, coming soon to R)
## so you don't have to use the packages stars' interface (lots of options): 
#https://github.com/pepijn-devries/CopernicusMarine/blob/a006052d343b09a52e0b9ff8e7aadd998ad9000f/R/cms_login.r#L25-L33

maybe fix for terra::stretch(histeq = TRUE)

stretch_hist <- function(x, ...) {
  ## stretch as if all the pixels were in the same band (not memory safe)
  rv <- terra::stretch(terra::rast(matrix(terra::values(x))), histeq = TRUE)
  ## set the values to the input, then stretch to 0,255
  terra::stretch(terra::setValues(x, c(terra::values(rv))), histeq = FALSE)
}

Just an example that was mentioned, I've been playing with vrtility today looking at other parts of the world too and learning how it works.

A lot to say, this is a pretty big area for Sentinel (~180x220km), which is 5561, 4483 pixels at 40m resolution (so reduce the size of extend_x, extend_y (in degrees), and move the POINT for where you want the centre. Can go as fine as 10m resolution.

You don't really need median calc done if there isn't a lot of cloud, and we don't necessarily need mask either, date can be as fine as a two-day window (but there's only imagery every few days, depending).

library(vrtility)
# La Pampa
x0 <- c(xmin = -65.5, ymin = -39.5, xmax = -62, ymax = -34)