Ok, thanks for the answer. It must be a problem of disk space.

I'll try what you say.

Best,

Mathieu

2011/11/9 Robert J. Hijmans <r.hijmans@gmail.com>

> Mathieu/Carsten,
>
> Carsten's suggestion is also good:
>
> elev<-overlay(detm@layers[[1]],detm@layers[[2]],
> fun=function(a,b) {return(a-b)} )
>
> although I would do:
>
> elev<-overlay(detm, fun=function(a,b) {return(b-a) } ,
> filename="disk/with/space.tif")
>
> Robert
>
>
> On Wed, Nov 9, 2011 at 8:46 AM, Carsten Neumann <carstennh@aol.com> wrote:
>
>>  Am 09.11.2011 15:39, schrieb Mathieu Rajerison:
>> > Hi,
>> >
>> >
>> > I have a RasterStack detm composed of a dem and a dtm.
>> >
>> > I wanted to apply the difference between dem and dtm so as to get the
>> > elevation.
>> >
>> > But I got the following message (in French):
>> > Erreur dans result[, i]<- readBin(raster@file@con, what = dtype, n =
>> > ncols, :
>> > le nombre d'objets à remplacer n'est pas multiple de la taille du
>> > remplacement
>> > De plus : Messages d'avis :
>> > 1: fermeture de la connexion inutilisée 4
>> >
>> (C:/DOCUME~1/MATHIE~1.RAJ/LOCALS~1/Temp/R_raster_tmp/raster_tmp_310457192102.gri)
>> >
>> > 2: fermeture de la connexion inutilisée 3
>> >
>> (C:/DOCUME~1/MATHIE~1.RAJ/LOCALS~1/Temp/R_raster_tmp/raster_tmp_79244111022.gri)
>> >
>> > Also, I got an error message telling me I had low disk space...
>> >
>> > Here is the complete code:
>> >
>> >> dem<- unstack(detm)[[1]]
>> >> dtm<- unstack(detm)[[2]]
>> >> elev<- dem - dtm
>> > (the above message)
>> >> ncell(dem)==ncell(dtm)
>> > [1] TRUE
>> >> extent(dem)==extent(dtm)
>> > [1] TRUE
>> >> res(dem)==res(dtm)
>> > [1] TRUE TRUE
>> >
>> > Does anyone see where the problem is?
>> >
>> >
>> > Thanks in advance,
>> >
>> > Mathieu
>> >
>> >       [[alternative HTML version deleted]]
>> >
>> >
>> >
>> > _______________________________________________
>> > R-sig-Geo mailing list
>> > R-sig-Geo@r-project.org
>> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> Dear Mathieu,
>>
>> it seems your memory and/or disk space is to low for this kind of
>> processing. Maybe you can try:
>> ########################################################################
>> elev<-overlay(detm@layers[[1]],detm@layers[[2]], fun=function(a,b)
>> {return(a-b)} )
>> ########################################################################
>> that's just one line with the same result, but I am not sure wheather
>> this will avoid memory problems. Just a suggestion you could try!
>>
>> Best regards
>>
>> Carsten
>>
>> --
>>
>> Carsten Neumann
>> Telegrafenberg, A 17 01.13
>> 14473 Potsdam
>> -------------------------------------------------------
>> Helmholtz Centre Potsdam
>> GFZ German Research Centre for Geosciences
>> Department 1 - Section 1.4 - Remote Sensing
>> -------------------------------------------------------
>> Tel.: +49 (0) 331 288 1766
>> e-mail: carstenn@gfz-potsdam.de
>>
>>
>>        [[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]]

