where is my raster stack? filename="" and inMemory=FALSE

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

where is my raster stack? filename="" and inMemory=FALSE

Hugo Costa
Dear list,

I imported a raster stack and made some processing (crop, reclassify). I
can plot the stack and all looks fine. However, I don't know any more where
the file is. Namely

fromDisk(raster) retrieves FALSE
filename(raster) retrieves ""
inMemory(raster) retrieves FALSE
hasValues(raster) retrieves TRUE

printing out the raster gives me this:
class       : RasterStack
dimensions  : 7041, 7221, 50843061, 11  (nrow, ncol, ncell, nlayers)
resolution  : 0.00015, 0.00015  (x, y)
extent      : -10.04175, -8.9586, 37.972, 39.02815  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84
+towgs84=0,0,0
names       : X10, X20, X30, X40, X50, X60, X70, X80, X90, X100, layer
min values  :   0,   0,   0,   0,   0,   0,   0,   0,   0,    0,     0
max values  :   1,   1,   1,   1,   0,   1,   0,   1,   1,    0,     1

I want to do everything in memory, but now I need to use gdalwarp, and
don't know how to define the argument srcfile. I can write my stack to
somewhere using writeRaster and get a filename, but that is too slow for my
needs and I'm looking for an alternative.

Thank you
Hugo

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: where is my raster stack? filename="" and inMemory=FALSE

Benjamin Leutner
For a RasterStack the internal organisation is a list of RasterLayers.
Hence you can retrieve the filenames like this, for example:

sapply(1:nlayers(raster), function(f) filename(raster[[f]]))


On 10/25/18 12:36 PM, Hugo Costa wrote:

> Dear list,
>
> I imported a raster stack and made some processing (crop, reclassify). I
> can plot the stack and all looks fine. However, I don't know any more where
> the file is. Namely
>
> fromDisk(raster) retrieves FALSE
> filename(raster) retrieves ""
> inMemory(raster) retrieves FALSE
> hasValues(raster) retrieves TRUE
>
> printing out the raster gives me this:
> class       : RasterStack
> dimensions  : 7041, 7221, 50843061, 11  (nrow, ncol, ncell, nlayers)
> resolution  : 0.00015, 0.00015  (x, y)
> extent      : -10.04175, -8.9586, 37.972, 39.02815  (xmin, xmax, ymin, ymax)
> coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84
> +towgs84=0,0,0
> names       : X10, X20, X30, X40, X50, X60, X70, X80, X90, X100, layer
> min values  :   0,   0,   0,   0,   0,   0,   0,   0,   0,    0,     0
> max values  :   1,   1,   1,   1,   0,   1,   0,   1,   1,    0,     1
>
> I want to do everything in memory, but now I need to use gdalwarp, and
> don't know how to define the argument srcfile. I can write my stack to
> somewhere using writeRaster and get a filename, but that is too slow for my
> needs and I'm looking for an alternative.
>
> Thank you
> Hugo
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

--
Benjamin Leutner

Department of Remote Sensing
University of W├╝rzburg

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo