README.md

volumr

Interactive volume rendering of gridded three-dimensional fields, from R.

volumr turns a field on a longitude, latitude and depth grid into a volume. A browser renders it on the GPU by ray marching a pair of 8-bit textures.

The payload is one image per level plus a manifest, about 1.5 MB for a grid of 1016 by 380 by 21. Serve it from a directory, or carry it inside a single HTML file that opens with no server. An htmlwidget exposes the renderer to shiny and to R Markdown. shinyVolumr() puts the whole workflow in a dashboard that also accepts a field uploaded by the reader.

Installation

# install.packages("remotes")
remotes::install_github("datalab-icman/volumr")

A C++ compiler and the zlib headers are needed, because one short source file holds the PNG compressor. On Debian and Ubuntu that is build-essential and zlib1g-dev.

The workflow

library(volumr)
data(med_mhw)

p <- vol_payload(med_mhw, "payload")          # images plus a manifest
vol_standalone(p, path = "volume.html")       # one file, opens by double-click

vol_payload() resamples the depth axis onto a uniform grid. It carries the values into 8 bits through a monotone transfer, and reports what that costs.

library(volumr)
e <- vol_encode(vol_resample(med_mhw))
e
#> ℹ Transfer into 8 bits: sqrt
#> Range = 4.209 to 580.7 over 254 codes, 0 reserved for no data
#> Error = 0.271 rms, 1.657 at worst °C·days
#> Cells = 294510 carrying a value of 904113

The application

shinyVolumr()

Eight tabs:

A field of your own

f <- vol_field(values, lon = lon, lat = lat, depth = depth,
               name = "temperature", unit = "degC")
vol_standalone(vol_payload(f, "payload"), path = "temperature.html")

values is an array indexed by depth, then latitude, then longitude. vol_field_from_df() builds one from a long data frame. vol_read_netcdf() reads one variable of a NetCDF file and infers the axes from their names. vol_read_npy() reads a NumPy array without calling Python.

The case study

Marine heatwave cumulative intensity in the Mediterranean Sea, over the 0 to 250 m layer. It is computed against a 1993 to 2022 reference period, following Hobday et al. (2016).

The temperature fields come from the Copernicus Marine Service Mediterranean Sea physical reanalysis, product MEDSEA_MULTIYEAR_PHY_006_004, doi:10.25423/CMCC/MEDSEA_MULTIYEAR_PHY_006_004_E3R1, described by Escudier et al. (2021).

med_mhw keeps every third point of the native twenty-fourth of a degree of the study, 339 by 127 by 15 at an eighth of a degree, in 1.6 MB. The field at the native grid, 1016 by 380, ships already written as a payload, so the picture at full resolution takes one line and no build:

vol_standalone(vol_example_payload(), path = "med.html")

Package contents

18 exported functions and 12 S3 methods. vignette("volumr") runs the whole path with the numbers it produces.

Authors

Pablo Almaraz (ORCID 0000-0003-1416-2695), Manuel Fernandez-Barba (ORCID 0000-0001-8953-2481) and DataLab ICMAN, at the Instituto de Ciencias Marinas de Andalucia, CSIC.

Cite the package as Almaraz, P., Fernandez-Barba, M., & DataLab ICMAN (2026). volumr: interactive volume rendering of gridded three-dimensional fields. R package version 0.1.0., or run citation("volumr").

Licence

GNU General Public License version 3 or later.



Try the volumr package in your browser

Any scripts or data that you put into this service are public.

volumr documentation built on Dec. 2, 2026, 5:07 p.m.