library(ncdf)
download.file("http://dods.ipsl.jussieu.fr/gswp/Fixed/SoilDepth.nc", destfile="SoilDepth.nc")
soil <- open.ncdf("SoilDepth.nc")
soil$var[[3]] -> var3
get.var.ncdf(soil, var3) -> SoilDepth
dim(SoilDepth)
[1] 15238
As mentioned in the summary for your netcdf file, the variable SoilDepthdepends only on the dimension land, not on xand y, so I'm not sure where it stays for you when it comes to build this dataset.
Edit
It turns out there is a key that binds x, yand land:
download.file("http://dods.ipsl.jussieu.fr/gswp/Fixed/landmask_gswp.nc", destfile="landmask.nc")
landmask <- open.ncdf("landmask.nc")
landmask$var[[3]] -> varland
get.var.ncdf(landmask, varland) -> land
sum(land==1)
[1] 15238
So, to build a graph:
land = t(land)
land[land==1] <- SoilDepth
land[land==0] <- NA
land = t(land)
image(land)
