Commit f201a407 authored by Blodgett, David L.'s avatar Blodgett, David L.

file handling on multiple platforms is hard

parent 0dbc97f9
......@@ -112,10 +112,7 @@ write_timeseries_dsg = function(nc_file, instance_names, lats, lons, times, data
if(add_to_existing) {
temp_file <- tempfile()
file.copy(nc_file, temp_file)
nc<-open.nc(temp_file, write = TRUE)
nc<-open.nc(nc_file, write = TRUE)
data_vars = list()
add_var(nc, data_name, c(pkg.env$time_dim_name, pkg.env$instance_dim_name),
......@@ -123,14 +120,12 @@ write_timeseries_dsg = function(nc_file, instance_names, lats, lons, times, data
long_name = data_metadata[['long_name']], data = data)
close.nc(nc)
nc<-open.nc(temp_file, write = TRUE)
nc<-open.nc(nc_file, write = TRUE)
put_data_in_nc(nc,nt,n,data_name,data, alts)
close.nc(nc)
file.rename(temp_file, nc_file)
return(nc_file)
} else {
......
......@@ -196,7 +196,7 @@ test_that("Create basic DSG file", {
attributes=global_attributes,
add_to_existing = TRUE)
testnc<-nc_open(testnc)
testnc<-nc_open(nc_file)
expect("character" %in% names(testnc$var), failure_message = names(testnc$var))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment