Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bash-$ ncdump -h .nc
- bash-$ R
- R> library(ncdf4)
- R> print(nc_open("test.nc")
- my.nc <- nc_open("test.nc")
- ncvar_get(my.nc, "lwdown", start = c(5, 1, 1), count = c(10, 1, 1))
- my.nc$var$lwdown$dim[[1]]$name
- [1] "time"
- my.nc$var$lwdown$dim[[2]]$name
- [1] "lon"
- my.nc$var$lwdown$dim[[3]]$name
- [1] "lat"
- start <- c(lat = 1, lon = 1, time = 5)
- count <- c(lat = 1, lon = 1, time = 10)
- dim.order <- sapply(my.nc$var$lwdown$dim, function(x) x$name)
- ncvar_get(my.nc, "lwdown", start = start[dim.order], count = count[dim.order])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement