[R-sig-Geo] write.tgrass (spacetime) does not work for any RasterStack
Edzer Pebesma
edzer.pebesma at uni-muenster.de
Tue Sep 6 21:52:48 CEST 2016
Indeed:
x = setZ(tempmean_new_rs, getZ(test))
write.tgrass(x, "x.tar.gz")
seems to work.
On 06/09/16 21:31, Veronica Andreo wrote:
> Hello Edzer
>
> Thank you very much for your answer :)
>
> Yes, sure! Find it attached.
>
> Best,
> Vero
>
> 2016-09-06 15:51 GMT-03:00 Edzer Pebesma <edzer.pebesma at uni-muenster.de
> <mailto:edzer.pebesma at uni-muenster.de>>:
>
> Could you provide me off-list with an .RData file that contains the
> tempmean_new_rs and test objects?
>
> On 06/09/16 20:43, Veronica Andreo wrote:
> > Hello
> >
> > I'm working with raster time series in GRASS, but I needed to apply a
> > gap-filling function available in R (dineof in the package sinkr).
> > Exporting the time series from GRASS and importing into R went
> fine... I
> > did all the processing which implies transforming the raster time
> series
> > into a matrix, run dineof and then rebuild the RasterStack... And
> here is
> > the problem... write.tgrass does not work with this rebuilt
> RasterStack
> >
> > I get this error:
> >
> > write.tgrass(tempmean_new_rs, "tempmean_new_from_R.tar.gzip")
> > Error in data.frame(names(obj), start.time, end.time) : arguments
> imply
> > differing number of rows: 156, 0
> >
> > write.tgrass does work however with the RasterStack imported and
> read with
> > read.tgrass. So, I compared both RasterStacks:
> >
> > ### the one imported from GRASS (without any change):
> >> test
> > class : RasterStack
> > dimensions : 104, 139, 14456, 156 (nrow, ncol, ncell, nlayers)
> > resolution : 500, 500 (x, y)
> > extent : 624500, 694000, 208500, 260500 (xmin, xmax, ymin, ymax)
> > coord. ref. : +proj=lcc +lat_1=36.16666666666666
> +lat_2=34.33333333333334
> > +lat_0=33.75 +lon_0=-79 +x_0=609601.22 +y_0=0 +no_defs +a=6378137
> > +rf=298.257222101 +towgs84=0.000,0.000,0.000 +to_meter=1
> > names : X2000_01_tempmean, X2000_02_tempmean, X2000_03_tempmean,
> > X2000_04_tempmean, X2000_05_tempmean, X2000_06_tempmean,
> X2000_07_tempmean,
> > X2000_08_tempmean, X2000_09_tempmean, X2000_10_tempmean,
> X2000_11_tempmean,
> > X2000_12_tempmean, X2001_01_tempmean, X2001_02_tempmean,
> X2001_03_tempmean,
> > ...
> > time : 2000-01-01 - 2012-12-01 (range)
> >
> > ### the one I re-constructed after doing my processing
> >> tempmean_new_rs
> > class : RasterStack
> > dimensions : 104, 139, 14456, 156 (nrow, ncol, ncell, nlayers)
> > resolution : 500, 500 (x, y)
> > extent : 624500, 694000, 208500, 260500 (xmin, xmax, ymin, ymax)
> > coord. ref. : +proj=lcc +lat_1=36.16666666666666
> +lat_2=34.33333333333334
> > +lat_0=33.75 +lon_0=-79 +x_0=609601.22 +y_0=0 +no_defs +a=6378137
> > +rf=298.257222101 +towgs84=0.000,0.000,0.000 +to_meter=1
> > names : layer.1, layer.2, layer.3, layer.4,
> layer.5,
> > layer.6, layer.7, layer.8, layer.9, layer.10, layer.11,
> > layer.12, layer.13, layer.14, layer.15, ...
> > min values : 2.8337839, 6.4129490, 11.2577566, 13.2967885,
> 20.4898198,
> > 24.3399993, 24.2426851, 24.0908008, 20.4639886, 14.9326849,
> 7.8406800,
> > 0.6784587, 3.0555789, 6.4902200, 7.4145889, ...
> > max values : 4.496206, 8.090485, 12.699460, 14.956419,
> 21.605554,
> > 25.174480, 25.044242, 24.839163, 21.734339, 16.165316,
> 9.309428,
> > 2.563087, 4.884175, 8.479331, 9.218642, ...
> >
> > All the same, *except for the time attribute* that the one read
> from GRASS
> > has and the one I rebuilt doesn't. Maybe there's the problem? How do I add
> > this time attribute to my RasterStack so that write.tgrass creates the
> > file I need to import directly into GRASS as a raster time series???
> >
> > Thanks a lot for any hint!
> >
> > Best,
> > Vero
> >
> > [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > R-sig-Geo at r-project.org <mailto:R-sig-Geo at r-project.org>
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> <https://stat.ethz.ch/mailman/listinfo/r-sig-geo>
> >
>
> --
> Edzer Pebesma
> Institute for Geoinformatics (ifgi), University of Münster
> Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 33081
> <tel:%2B49%20251%2083%2033081>
> Journal of Statistical Software: http://www.jstatsoft.org/
> Computers & Geosciences: http://elsevier.com/locate/cageo/
> <http://elsevier.com/locate/cageo/>
>
>
--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 33081
Journal of Statistical Software: http://www.jstatsoft.org/
Computers & Geosciences: http://elsevier.com/locate/cageo/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20160906/5b3cd43e/attachment.bin>
More information about the R-sig-Geo
mailing list