[R-sig-Geo] raster brick from netcdf - specify range
Tom Hilinski
Tom.Hilinski at colostate.edu
Sat Feb 25 20:03:18 CET 2017
Want to read part of a netcdf file into a raster brick. The file (in
ncdf4 order) contains a variable
pre[lon, lat, time]
and those dimensions are: 720, 360, 1356
The following reads in all time layers:
rb <- brick( filename, varname=varname, nl=2 )
> rb
class : RasterBrick
dimensions : 360, 720, 259200, 1356 (nrow, ncol, ncell, nlayers)
resolution : 0.5, 0.5 (x, y)
extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
z-value : 12, 1367 (min, max)
varname : pre
Likewise, I've had no success limiting the read using xmn, xmx, ymn,
ymx, or template. The help page for brick suggests that all these should
work, or at least, it does not seem say that they don't work for netcdf
files.
My workaround requires directly reading the netcdf file, then making a
brick from that array, but when reading finer resolution data, the
memory use and speed could be an issue due to creating 2 objects instead
of 1.
raster version = 2.5-8
I'd appreciate any suggestions about this.
More information about the R-sig-Geo
mailing list