how to get an attribute from a raster layer
Where did you search? My google search for "getZ package raster" found it easily. If you have loaded the raster package, then the command ?getZ brings up the manual page:
library(raster)
Loading required package: sp
?getZ
-------------------------------------- David L. Carlson Department of Anthropology Texas A&M University -----Original Message----- From: R-sig-Geo [mailto:r-sig-geo-bounces at r-project.org] On Behalf Of Antonio Silva Sent: Friday, December 28, 2018 10:39 AM To: Ben Tupper <btupper at bigelow.org> Cc: R-mailing list <r-sig-geo at r-project.org> Subject: Re: [R-sig-Geo] how to get an attribute from a raster layer Dear Ben Thanks again. I didn't find this function in my search. Happy new year to all. Antonio Olinto Em sex, 28 de dez de 2018 ?s 13:19, Ben Tupper <btupper at bigelow.org> escreveu:
Hi, You are looking for raster::getZ() but be aware that the Z value can be of any type - in this case I would guess it is a Date class so you will need to cast it to character using format() to get a label you desire. https://www.rdocumentation.org/packages/raster/versions/2.8-4/topics/z-values Cheers, Ben On Dec 28, 2018, at 10:04 AM, Antonio Silva <aolinto.lst at gmail.com> wrote: Dear list members I need help to do something that should be easy but I could not execute. I just want to plot a raster layer and use "z-value" as the title. rst.data[[1]] class : RasterLayer band : 1 (of 4 bands) dimensions : 33, 45, 1485 (nrow, ncol, ncell) resolution : 0.25, 0.25 (x, y) extent : -50.25, -39, -29, -20.75 (xmin, xmax, ymin, ymax) coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 data source : /mnt/.../dataset-sss-ssd-rep-monthly_2016-11-12_sos.nc names : X2016.11.15.1 z-value : 2016-11-15 zvar : sos Is it possible to extract the z-value value directly (2016-11-15)? The best I could do was plot(rst.data[[1]],main=substr(names(rst.data[[1]]),2,11)) Thanks a lot Antonio Olinto Fisheries Institute S?o Paulo, Brazil [[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo Ben Tupper Bigelow Laboratory for Ocean Sciences 60 Bigelow Drive, P.O. Box 380 East Boothbay, Maine 04544 http://www.bigelow.org Ecological Forecasting: https://eco.bigelow.org/
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo