[GRASS-stats] Re: [GRASS-user] Testing i.pca ~ prcomp(), m.eigensystem ~ princomp()

Nikos Alexandris nikos.alexandris at felis.uni-freiburg.de
Tue Mar 31 10:30:10 EDT 2009


Agustin:
> Nikos, I'm probably missing a message (I do not see which is
> exactly the difference between the spot and the modis example),

Hi Agus. The difference is:

Using SPOT (range up to max. 255):
i.pca == prcomp(x, center=TRUE, scale=FALSE)

Using MODIS (range varries between bands, up to max. ~5500):
i.pca == prcomp(x, center=FALSE, scale=FALSE)


>  but Perhaps you must use r.mapcalc to rescale and not r.rescale, or
> if using r.rescale you must use r.mapcalc afterwards to rewrite the
> output raster, as r.rescale is modifying the categories only and not
> the actual raster values which is what i.pca is probably using. Maybe,
> as i.pca is quite old, it considers the categories only up to 255. In
> any case, using r.mapcalc you know better what you are doing.

That's the confirmation I needed. I think rescaling the MODIS data to
0~255 will confirm that:

IF "r.info -r" =< max. 255
THEN i.pca == prcomp(x, center=TRUE, scale=FALSE)


> Also, note that you must rescale
> using the mean, not max min values. In other words
> r.mapcalc "band1c = band1 - mean(band1)"

Thanks for the tip. Maybe this can be added in the grass-wiki FAQ !?

Cheers, Nikos



More information about the grass-user mailing list