[R-sig-Geo] NAvalues on a raster stack

Els Ducheyne educheyne at avia-gis.be
Tue Nov 8 09:18:28 CET 2011


Dear list
I have been working with raster stack for a while. Until now I have not experienced any problems with NAvalues on stacks. However, yesterday I was stacking 6 layers in a stack. 4 of these seemed to contain background values only with a value of -0.3.
I have tried to set the NAvalue on the stack as follows
NAvalues(ndvi.stack) <-  -0.3

but when using summarise(ndvi.stack,na.rm=T) I still get the -0.3 values.
The main problem is that I am calculating monthly means after this step as follows
monthly.mean <- calc(ndvi.stack,fun=mean,na.rm=T) and that because of the fact that the NA value is not accepted i get wrong outputs.

is the NAvalue not accepted because the entire image is -0.3? or is there another reason?

i am using the Raster package version 1.9-5 
Thanks for any suggestions
Best regards
Els



More information about the R-sig-Geo mailing list