我想从 netcdf 文件写一个二进制文件
library(ncdf)
download.file("http://gswp/Fixed/SoilDepth.nc", destfile="SoilDepth.nc")
soil <- open.ncdf("SoilDepth.nc")
soil$var[[3]] -> var3
get.var.ncdf(soil, var3) -> SoilDepth
download.file("http://gswp/Fixed/landmask_gswp.nc", destfile="landmask.nc")
landmask <- open.ncdf("landmask.nc")
landmask$var[[3]] -> varland
get.var.ncdf(landmask, varland) -> land
land = t(land)
land[land==1] <- SoilDepth
land[land==0] <- NA
land = t(land)
image(land)
此代码的结果将如下所示:![map of soil][1]
现在我想将它写入一个二进制文件:
结果是图像颠倒了。