我正在尝试将具有时间(作为记录),lat,lon和tmp的数据帧转换为具有3个维度的nc文件。这是我到目前为止的代码。
lon1 <- ncdim_def( "Lon", "degrees_east", unique(DB$lon))
lat1 <- ncdim_def( "Lat", "degrees_north", unique(DB$lat))
record <- ncdim_def( "record", "files", list_obs$record_uid,unlim=T)
mv <- -999 # missing value to use
tmpmean_ <- ncvar_def( "tmpmean_", "degrees", list(lon1,lat1,record),mv)
time<-list_obs$record_uid
ncnew <- nc_create( "tmpmean_.nc",tmpmean_)
for( i in 1:length(record))
ncvar_put( ncnew, tmpmean_, DB$tmpmean_, start=c(1,1,i),
count=c(-1,-1,1))
我收到此错误消息: “ncvar_put:警告:你要求写入3128个值,但传递的数据数组有103224个条目!”