[GRASS-stats] Re: [GRASS-user] Testing i.pca ~ prcomp(),
m.eigensystem ~ princomp()
Agustin Lobo
aloboaleu at gmail.com
Tue Mar 31 03:39:46 EDT 2009
Nikos,
I'm probably missing a message (I do not see which is
exactly the difference between the spot and the modis
example), 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.
Also, note that you must rescale
using the mean, not max min values. In other words
r.mapcalc "band1c = band1 - mean(band1)"
Agus
Nikos Alexandris wrote:
> Roger:
>>>> Good, thanks. There you say that you are using "some MODIS surface
>>>> reflectance products". I guess it will be easier to check things if the
>>>> data (GRASS location) are available, so that others can try the same
>>>> calculations. Would it be possible to make one or more test sets
>>>> available, and link them from thw Wiki?
>
> Nikos:
>> Finally,
>> I am, sort of, free again :-).
>
> Sorry for being late. Couldn't make it earlier. I've updated the
> wiki-page [1].
>
>
>> I have prepaired a grass-location
>> containing the 3 modis bands I've used for all PCA related examples. I
>> will eventually upload them in gregis [check previous post] but if there is another place
>> (GRASS-wiki?) to upload them would be also ok.
>
> I have currently some access problem in gregis this why I can't upload
> the MODIS bands there. Is there any other place to put them for now?
>
>
> Now, I am more confused than before. Or maybe not...
>
> There seems to be no problem with the SPOT images, that is, the results
> of i.pca are (almost) identical with the results of R's prcomp(x,
> center=TRUE) *with* centering. This is completely different than with
> the example using MODIS data.
>
> Perhaps it depends on the range of the input data?! The SPOT bands are
> up to max. 255. The MODIS bands are:
>
> # band 2
> r.info -r mod_b2
>
> min=0
> max=5504
>
> # band 6
> r.info -r mod_b6
>
> min=93
> max=5488
>
> # band 7
> r.info -r mod_b7
>
> min=0
> max=4133
>
>
> I ran the same PCA tests (in R) with the _rescaled_ as like with the
> "original" MODIS bands (using r.rescale) but no luck, I get the same
> contradictory results: _i.pca_ matches with _prcomp(x, center=FALSE)_.
>
> I suspect that the range of the input data is the reason... but I am not
> sure. This is why I tried to repeat the test with _rescaled_ MODIS
> bands. Given that the "r.rescale" products are kind of a "rules" file
> under the "cats" directory, is "r.rescale" safe? Should I instead
> rescale the data with r.mapcalc or is there no difference between
> r.rescale and r.mapcalc?
>
> All explained in the *under construction* wiki. Kind regards, Nikos
> ---
>
> [1] http://grass.osgeo.org/wiki/Principal_Component_Analysis
>
> _______________________________________________
> grass-stats mailing list
> grass-stats at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-stats
>
--
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: Agustin.Lobo at ija.csic.es
http://www.ija.csic.es/gt/obster
More information about the grass-user
mailing list