我正在尝试使用 R 包ncdf创建多维 NetCDF 文件。我正在对一组 1500 个点进行气候日常观测,每个点的观测数约为 18250。问题是 NetCDF 文件(create.ncdf)的结构占用 4Gb,每个点使文件的大小增加超过 3Gb(put.var.ncdf)
这是我正在使用的代码:
# Make a few dimensions we can use
dimX <- dim.def.ncdf( "Long", "degrees", Longvector )
dimY <- dim.def.ncdf( "LAT", "degrees", Latvector )
dimT <- dim.def.ncdf( "Time", "days", 1:18250, unlim=FALSE )
# Make varables of various dimensionality, for illustration purposes
mv <- -9999 # missing value to use
var1d <- var.def.ncdf( "var1d", "units", dimX, mv,prec="double" )
var2d <- var.def.ncdf( "var2d", "units", list(dimX,dimY), mv,prec="double" )
var3d <- var.def.ncdf( "var3d", "units", list(dimX,dimY,dimT), mv,prec="double" )
# Create the test file
nc <- create.ncdf( "writevals.nc", list(var1d,var2d,var3d) )
# !!Creates a nc file with + 4 Gb
# Adding the complete time series for one point (the first point in the list of the dataset)
put.var.ncdf( nc, var3d,dataset[[1]], start=c(Longvector[1],Latvector[1],1), count=c(1,1,-1))
Longvector 和 Latvector 是从每个点的 Long 和 Lat 矩阵中获取的向量。数据集是一个列表格式,对于每个点,我都有一个数值列表。
dataset[[1]]=c(0,0,0,9.7,0,7.5,3.6,2.9,0,0.5,....)
我错过了什么还是应该尝试其他包?