Jonathan,

Thanks for pointing out this omission. I will implement it in the next
version. For now, perhaps you can use the layerNames and native format to
keep the z values.

Robert

On Sat, May 5, 2012 at 6:33 PM, Jonathan Kennel <j2kennel@gmail.com> wrote:

> Hello R-sig-geo community!
>
> First off I want to say the raster package is one of the most beautiful
> packages I have used.
>
> I am attempting to save a raster brick to a file so that I can read it in
> at a later date.  The raster brick has a time component attached to it
> using the raster package function setZ.  Now when I try to read this in,
> the time values are missing (and I can't find them in the output .grd file
> either).  I am just wondering if I am missing something or if this is part
> of the 'in development' aspect of including time with the native 'raster'
> format.
>
> Here is a minimal example:
>
> library(raster)
> r <- raster(ncol=10, nrow=10)
> s <- stack(lapply(1:3, function(x) setValues(r, runif(ncell(r)))))
> s <- setZ(s, as.Date('2000-1-1') + 0:2)
> s  # time is present
> writeRaster(s,'tmp.grd',overwrite = TRUE)    # write the brick (time is
> missing now)
> s <- NULL
> s <- brick('tmp.grd')    # read the brick
> s
> getZ(s)
>
>
> Windows 7
>
> SessionInfo()
> R version 2.15.0 (2012-03-30)
> Platform: x86_64-pc-mingw32/x64 (64-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252
> [2] LC_CTYPE=English_United States.1252
> [3] LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] graphics  grDevices datasets  stats     utils     methods   base
>
> other attached packages:
> [1] raster_1.9-92  sp_0.9-99      RODBC_1.3-5    stringr_0.6
>  lattice_0.20-6
>
> loaded via a namespace (and not attached):
>  [1] colorspace_1.1-1   dichromat_1.2-4    digest_0.5.2       grid_2.15.0
>
>  [5] memoise_0.1        munsell_0.3        plyr_1.7.1         proto_0.3-9.2
>
>  [9] RColorBrewer_1.0-5 reshape2_1.2.1     scales_0.2.0       tools_2.15.0
>
>
> Thank you,
> -Jonathan
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]

