A lazyraster is a metadata-only shell around a raster file source. Only metadata is read and and used for extent and resolution logic. A lazyraster may be cropped lazily and if plotted or converted to in-memory raster only a reasonable level-of-detail is actually used.
lazyraster(gdalsource, band = 1, sds = NULL, ...)
gdalsource | a file name or other source string |
---|---|
band | which band to use, defaults to 1 |
sds | which subdataset to use, set to 1 if in doubt (see |
... | ignored for now |
a lazyraster object, a simple shell around a GDAL raster source
See crop()
for cropping - it works the same but returns a lazyraster,
and as_raster()
for converting to an in-memory raster.
If the inferred Y extents appear to be reversed (ymax > ymin) then they are reversed, with a warning. This occurs for any GDAL data source that does not have a geotransform and so is required for use with raster. This might not be the right interpretation, geotransforms are very general and it might mean the data is meant to be oriented that way. (I don't know why GDAL sets a positive Y pixel height as the default, it's a bit of a pain - should the data be flipped, or should Y be interpreted negative - no way to know!).
#> class : LazyRaster #> dimensions : 286, 143 (nrow, ncol) #> resolution : 0.07000000, 0.07000389 (x, y) #> extent : 140.00000, 150.01000, -60.01833, -39.99722 (xmin, xmax, ymin, ymax) #> crs : <placeholder> #> values : NA, NA (min, max - range from entire extent) #> window extent : <whole extent> #> window index : <-> #> window dimension : (full) (ncol, nrow)#> class : RasterLayer #> dimensions : 504, 504, 254016 (nrow, ncol, ncell) #> resolution : 0.01986111, 0.03972443 (x, y) #> extent : 140, 150.01, -60.01833, -39.99722 (xmin, xmax, ymin, ymax) #> crs : NA #> source : memory #> names : layer #> values : -3.4e+38, 289.859 (min, max) #>#> class : LazyRaster #> dimensions : 286, 143 (nrow, ncol) #> resolution : 0.07000000, 0.07000389 (x, y) #> extent : 140.00000, 150.01000, -60.01833, -39.99722 (xmin, xmax, ymin, ymax) #> crs : <placeholder> #> values : NA, NA (min, max - range from entire extent) #> window extent : 141.96000, 143.01000, -50.00778, -44.96750 #> window index : 27, 42, 71, 143 #> window dimension : 16, 73 (ncol, nrow)## crop and convert to raster as_raster(crop(lazyraster(sstfile), raster::extent(142, 143, -50, -45)))#> class : RasterLayer #> dimensions : 504, 504, 254016 (nrow, ncol, ncell) #> resolution : 0.002083333, 0.01000056 (x, y) #> extent : 141.96, 143.01, -50.00778, -44.9675 (xmin, xmax, ymin, ymax) #> crs : NA #> source : memory #> names : layer #> values : 280.418, 284.397 (min, max) #>