[GRASS-dev] PCA (i.pca) in G7: filtering and rescaling

Nikos Alexandris nik at nikosalexandris.net
Sat Dec 7 08:46:42 PST 2013


Moritz Lennert wrote:
.. 
> Try the attached diff to imagery/i.pca/main.c.

Great! So, applied the diff. Here some numbers:

PC1 238310.68 ( 0.1606, 0.2231, 0.1228, 0.9536) [96.10%]
PC2   9364.65 ( 0.4319, 0.5989, 0.6082,-0.2912) [ 3.78%]
PC3    217.78 ( 0.7028, 0.1609,-0.6897,-0.0672) [ 0.09%]
PC4     80.33 ( 0.5420,-0.7521, 0.3732, 0.0366) [ 0.03%]

Thus, we have:

96.10 + 3.78 + 0.09 = 99.88 + 0.09 = 99.97


Then, pca with "-f":

i.pca in=Blue_DNs,Green_DNs,Red_DNs,NIR1_DNs out=TEST_PC --o -f percent=96.10
ERROR: Not enough principal components left for filtering

and

i.pca in=Blue_DNs,Green_DNs,Red_DNs,NIR1_DNs out=TEST_PC --o -f percent=96.11

gives:

r.info -r TEST_PC.1
min=19.4012346427396
max=1570.71398669652


Good sign, means it works :-).  And it does not truncate (otherwise, 
trunc(96.11) = 96, so "normally" it should fail to filter again)!  Then, with  
"percent=99.87" still the same:

r.info -r TEST_PC.1
min=19.4012346427396
max=1570.71398669652

while with "percent=99.88" it works:

r.info -r TEST_PC.1
min=8.08831247843905
max=1443.35532373978


Finally, with "percent=99.97"  OR  below  OR  above, always gives the same

r.info -r TEST_PC.1
min=8.08831247843905
max=1443.35532373978


So, the questions are:

1) why does it make the switch with 99.11 and not with 99.10, while it does 
make the switch already with 99.88 instead of requiring 99.89?

2) Why is there no filtering taking place for "percent >= 99.97" ?

In a way, though, this is already getting better :-)

Nikos


More information about the grass-dev mailing list