[GRASS-user] Calculating eigen valuesand%varianceexplainedafter PCA analysis

Wesley Roberts wroberts at csir.co.za
Tue Mar 3 02:27:36 EST 2009

>>> Nikos Alexandris <nikos.alexandris at felis.uni-freiburg.de> 03/03/09
9:04 AM >>>
> I got the svn grass6_devel code from the location you suggested and
> now installed but with lots of errors. Here is the output from the
> 'make' command (see below the lapack.h error). I understand that I
> to cd into the directory where the error occurred and run make inside
> that directory. I do this for the gmath directory and I once again
> receive an error message related to the lapack.h file. The same error
> occurs when running make in other error locations.

> error: expected declaration specifiers or ‘...’ before ‘ftnlen’
> make: *** [OBJ.i686-pc-linux-gnu/del2g.o] Error 1


what are the exact steps you are executing in order to compile

(assuming you work under linux) If you already had done a compilation
before, did you "make distclean" before re-compiling?
(or "sudo make distclean").

I actually figured out the problem about 10 min after I sent you and the
list the mail. My apologies (that actually happens fairly often), I
found the following entry while searching the mail archives of this


My error was related to the lapack.h file which is not used in Grass so
I removed '--with-blas --with-lapack' from my ./configure and hey
presto, everything works fine in the development version, except nviz,
which I am not too concerned about.

> I dont have much more time to spend on this so would ideally just like
> to get the i.pca working in development installation so that I can use
> i.pca and get the variance and eigen values. In my tests run so far I
> have seen that i.pca produces more realistic results, based on
> qualitative assessment. As such, I will use i.pca instead of the
> 'by-hand-method'

If you don't mind to share some more info about the way you assess the
quality of the components (just even mentioning some will be great - I
am really interested in it).

To be honest I just assess the resulting images visually and see if for
eg. PC1 looks to contain information from both the lidar and aerial
photography. While assessing the results from the 'by-hand' method I
noticed that my lidar data did not really contribute to the first PC
component. Given that both data sets were largely made up of canopy
information I was hoping that PC would contain more canopy info from the
lidar data. Assessing the result of a PCA is fairly difficult I think.
In past research I ran a time series analysis on 20years of NDVI data
and used PCA to analyse trends. Correlation between PC component 1 and
the time series data set generally returned seasonal variations in the
data set. In the present analysis I guess you could do the same although
I am not really sure how useful that would be. For me I would just like
to make sure that I am running the analysis correctly and that the
resulting fusion of the aerial photographs and lidar canopy models
contributes to an enhanced ability to count tree canopies. 

When I went back to tests run using the original i.pca I saw that the
first PC seemed to contain more information from both data sets. I am
now running a test using the new i.pca (grass_devel6) with all input
data scaled to 8 bit grey scale and centered using the global mean of
each band. Combined with the changes made by Hamish, I think this final
test will prove very successful.

> Thanks for all your help wrt running pca in grass.
> Wesley

Thanks to the community and Hamish for his time.

Yes, indeed, thanks to Hamish and the rest of the grass-user community

This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.

More information about the grass-user mailing list