Hi Julio,

To put NA values on your raster for values equal to 3:
r[r==3] <- NA

2012/9/20 Julio Oliveira <oliveirajc1@gmail.com>

> Dear,
>
> I have two rasterStack (NDVI and B) with 232 layers each.
>
> NDVI
> class       : RasterBrick
> dimensions  : 10, 11, 110, 232  (nrow, ncol, ncell, nlayers)
> resolution  : 0.00225, 0.00225  (x, y)
> extent      : -48.345, -48.32025, -20.3625, -20.34  (xmin, xmax, ymin,
> ymax)
> coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84
> +towgs84=0,0,0
> values      : in memory
> min values  : 0.46 0.64 0.58 0.46 0.30 0.20 0.19 0.24 0.20 0.22 ...
> max values  : 0.91 0.95 0.94 0.94 0.88 0.76 0.70 0.82 0.77 0.78 ...
> layer names : MOD13Q1.A2000353.h13v11.005.2006346191943.250m_16_days_NDVI,
> MOD13Q1.A2001001.h13v11.005.2008270060743.250m_16_days_NDVI,
> MOD13Q1.A2001017.h13v11.005.2006358162247.250m_16_days_NDVI,
> MOD13Q1.A2001033.h13v11.005.2008271231754.250m_16_days_NDVI,
> MOD13Q1.A2001049.h13v11.005.2007002215512.250m_16_days_NDVI,
> MOD13Q1.A2001065.h13v11.005.2007007103033.250m_16_days_NDVI,
> MOD13Q1.A2001081.h13v11.005.2008278010133.250m_16_days_NDVI,
> MOD13Q1.A2001097.h13v11.005.2007018110448.250m_16_days_NDVI,
> MOD13Q1.A2001113.h13v11.005.2008284095248.250m_16_days_NDVI,
> MOD13Q1.A2001129.h13v11.005.2007027112124.250m_16_days_NDVI, .
>
>
> IMAGE B
> The image B has values 0,1 or  3 for each layer.
>
> class       : RasterBrick
> dimensions  : 10, 11, 110, 232  (nrow, ncol, ncell, nlayers)
> resolution  : 0.00225, 0.00225  (x, y)
> extent      : -48.345, -48.32025, -20.3625, -20.34  (xmin, xmax, ymin,
> ymax)
> coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84
> +towgs84=0,0,0
> values      : in memory
> min values  : 1 0 0 0 0 0 0 0 0 0 ...
> max values  : 3 0 0 0 0 3 0 0 0 1 ...
> layer names :
> MOD13Q1.A2000353.h13v11.005.2006346191943.250m_16_days_pixel_reliability,
> MOD13Q1.A2001001.h13v11.005.2008270060743.250m_16_days_pixel_reliability,
> MOD13Q1.A2001017.h13v11.005.2006358162247.250m_16_days_pixel_reliability,
> MOD13Q1.A2001033.h13v11.005.2008271231754.250m_16_days_pixel_reliability,
> MOD13Q1.A2001049.h13v11.005.2007002215512.250m_16_days_pixel_reliability,
> MOD13Q1.A2001065.h13v11.005.2007007103033.250m_16_days_pixel_reliability,
> MOD13Q1.A2001081.h13v11.005.2008278010133.250m_16_days_pixel_reliability,
> MOD13Q1.A2001097.h13v11.005.2007018110448.250m_16_days_pixel_reliability,
> MOD13Q1.A2001113.h13v11.005.2008284095248.250m_16_days_pixel_reliability,
> MOD13Q1.A2001129.h13v11.005.2007027112124.250m_16_days_pixel_reliability
>
>
> First Question:
>
> I'll like select cells (ex.: values == 3) from difference layer in B  and
> put NA for each cells / layer in NDVI image.
>
> I tried the syntax:
>
> NDVI <- stackSelect(NDVI, !(B==3), recycle=TRUE, type = 'index')
> Error: nlx > nly is not TRUE
>
> Second Question:
> How put NA values for all the pixels with value == 3 on image B ?
>
> Thanks
>
> Julio
>         [[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]]

