Notice: Undefined index: CraftSessionId in /var/www/html/web/forums/qa-external/qa-external-users.php on line 193
Has anyone merged .nc output files together in R? - Hydronumerics Q&A
0 votes
in AEM3D by 3drazorb@gmail.com (360 points)
Wrote a script in R to merge two .nc output files together, but received an error,

"Error in as.data.frame.default(x) :
  cannot coerce class ""ncdf4"" to a data.frame"

Wondering how I might get around this?  

Below is the R script.

# install.packages ('ncdf4', 'ncdf.tools)
library(ncdf4)
library(ncdf.tools)

#set working directory
setwd("D:/..........")

# gather files
data1 = nc_open('sheet_max_run_1.nc')
data2 = nc_open('sheet_max_restart_1.nc')

# create new file
combined= merge(data1,data2,all=TRUE)

1 Answer

0 votes
by mhmmd.madani@gmail.com (920 points)
I have done it in MATLAB. But with the new NetCDF version, there is no size limit. Let me know if my MATLAB code would be helpful for you so I can send it to you.

Mohammad
Welcome to Hydronumerics Q&A, where you can ask questions and receive answers about the software we develop and distribute

Categories

Hydronumerics

...