NAvalues on a raster stack
Am 08.11.2011 09:18, schrieb Els Ducheyne:
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
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Dear Els, did you keep your dataset 'ndvi.stack' as read from disk? The function Navalues can only change values when reading your rasterStack object from disk. If you have your values in memory nothing will change applying your function. Maybe this could help? 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 at gfz-potsdam.de