You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The terra:::.write_cdf function accepts dots, and checks to see whether force_v4 is included among them, passing it on to ncdf4::nc_create. However, force_v4 is also passed on to ncdf4::ncvar_def, which throws an error. I'm not sure about the appropriate solution, but perhaps force_v4 should be an explicit parameter of the terra::writeCDF (and terra:::.write_cdf) function?
Reprex below. Thanks for all you do!
f<- system.file("ex/elev.tif", package="terra")
r<-terra::rast(f)
fname<- paste0(tempfile(), ".nc")
# Worksrr<-terra::writeCDF(r, fname, overwrite=TRUE, varname="alt",
longname="elevation in m above sea level", unit="m")
# Error because ncdf4::ncvar_def doesn't accept dotsrr<-terra::writeCDF(r, fname, overwrite=TRUE, varname="alt",
longname="elevation in m above sea level", unit="m", force_v4=TRUE)
#> Error in ncdf4::ncvar_def(name = vars[i], units = units[i], dim = list(xdim, : unused argument (force_v4 = TRUE)
Hi there,
The
terra:::.write_cdf
function accepts dots, and checks to see whetherforce_v4
is included among them, passing it on toncdf4::nc_create
. However,force_v4
is also passed on toncdf4::ncvar_def
, which throws an error. I'm not sure about the appropriate solution, but perhapsforce_v4
should be an explicit parameter of theterra::writeCDF
(andterra:::.write_cdf
) function?Reprex below. Thanks for all you do!
Created on 2023-02-09 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: