Skip to content

Commit

Permalink
prevent error when no vars
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsumner committed Oct 22, 2024
1 parent 5f569a6 commit 78919d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ncmeta
Title: Straightforward 'NetCDF' Metadata
Version: 0.4.0.9001
Version: 0.4.0.9002
Authors@R: c(person("Michael", "Sumner", email = "[email protected]", role = c("aut", "cre")),
person("Tomas", "Remenyi", role = "ctb"),
person("Ben", "Raymond", role = "ctb"),
Expand Down
5 changes: 4 additions & 1 deletion R/nc_meta.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ nc_meta <- function(x, ...) {
nc_meta.NetCDF <- function(x, ...) {
inq <- nc_inq(x)
dims <- nc_dims_internal(x, inq$ndims)

if (inq$nvars > 0) {
vars <- nc_vars_internal(x, inq$nvars)
} else {
vars <- tibble::tibble()
}
if (nrow(vars) > 1) axis <- nc_axes(x, vars$name) else axis <- nc_axes(x)

## does a dimension have dim-vals?
Expand Down

0 comments on commit 78919d6

Please sign in to comment.