Skip to contents

cube_validate() diagnoses the logical header, physical backend, metadata, and coordinate contract of an ocean cube. Unlike cube_inspect(), it returns one row per validation check and never reads a complete NetCDF data payload.

Usage

cube_validate(x, strict = FALSE)

Arguments

x

An object to validate as an <ocean_cube>.

strict

A non-missing logical scalar. If TRUE, any failed check raises an error of class oceancube_validation_error; this includes duplicate or non-increasing time, non-UTC stored POSIXct, unsupported calendar metadata, and inconsistent temporal provenance. The condition includes the complete report in its report field.

Value

A data frame with class oceancube_validation and columns check, status, severity, component, message, repairable, and suggested_action.

Details

Both modes diagnose temporal class, missing/non-finite values, uniqueness, strict ordering, canonical UTC, supported calendar metadata, and provenance consistency. strict = FALSE returns those failures as rows; strict = TRUE raises after assembling the complete report. No validation path sorts, deduplicates, or otherwise repairs scientific data.

Examples

values <- array(1:4, dim = c(2, 2, 1, 1, 1))
cube <- ocean_cube(
  lon = c(-80, -79), lat = c(-12, -11), depth = 0,
  time = as.Date("2020-01-01"), data = values, vars = "temperature"
)
cube_validate(cube)
#> <oceancube_validation>
#> PASS: 31
#> WARN: 0
#> FAIL: 0