knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

test for GloFAS

library(wmts)
outdir <- tempfile()
dir.create(outdir)
fn <- system.file("extdata","glofas.nc",package="wmts",mustWork=TRUE)
fcolour <- function(x){
  brk <- c(-Inf,0.000000e+00,2.656250e-01,2.453125e+00,2.239063e+05,Inf)
  crp <- colorRampPalette(c("lightblue", "blue"),alpha=TRUE)
  col <- c("#00000000",crp(length(brk)-2),NA)
  col[ cut(as.numeric(x),brk) ]
}

tmp <- scaleImage(fcolour, c(-Inf,0.000000e+00,2.656250e-01,2.453125e+00,2.239063e+05,Inf),1)

tmp <- singleTile(terra::rast(fn),fcolour,0,0,0)

## plotPalette(pal,file.path(outdir,"legend.svg"))

tidy up

unlink(outdir)


waternumbers/wmts documentation built on Dec. 23, 2021, 5:08 p.m.