[GRASS-user] i.pca with scrips

Dear Grass users

I am trying to run the principal components analysis with "i.pca" for 12
raster.

I made a script to process three times the "i.pca" with three sets
(twelve raster by each sets) of different parameters (temperature,
chlorophyll, Insolation), but when I run the scripts this only takes 11
images by sets. I tried i.pc manually and this takes twelve raster
correctly. Thank you in advance.

EXAMPLES WHIT SCRIP:

GRASS 6.4.1 > i.pca_.sh
.
.
.
Computing means for band 11...
100%
Computing row 1 (of 11) of covariance matrix...

EXAMPLES MANUALLY FOR ONE SET:

GRASS 6.4.1 >
input=tmedia_1,tmedia_2,tmedia_3,tmedia_4,tmedia_5,tmedia_6,tmedia_7,tmedia_8,tmedia_9,tmedia_10,tmedia_11,tmedia_12 output=PCA_tmedia_

Computing means for band 12...
100%
Computing row 1 (of 12) of covariance matrix...

EXAMPLE SCRIPS

#!/bin/bash

# Analisis de componentes principales

for map in tmedia_ aston_ clor_
do

B1=1
B2=2
B3=3
B4=4
B5=5
B5=6
B7=7
B8=8
B9=9
B10=10
B11=11
B12=12

i.pca rescale=0,0 input="$map$B1,$map$B2,$map$B3,$map$B4,$map$B5,$map
$B7,$map$B8,$map$B9,$map$B10,$map$B11,$map$B12" output=PCA_$map

On Mon, Jul 4, 2011 at 8:43 PM, Gaspar <gos47@hotmail.com> wrote:

Dear Grass users

I am trying to run the principal components analysis with "i.pca" for 12
raster.

I made a script to process three times the "i.pca" with three sets
(twelve raster by each sets) of different parameters (temperature,
chlorophyll, Insolation), but when I run the scripts this only takes 11
images by sets. I tried i.pc manually and this takes twelve raster
correctly. Thank you in advance.

EXAMPLES WHIT SCRIP:

GRASS 6.4.1 > i.pca_.sh
.
.
.
Computing means for band 11...
100%
Computing row 1 (of 11) of covariance matrix...

EXAMPLES MANUALLY FOR ONE SET:

GRASS 6.4.1 >
input=tmedia_1,tmedia_2,tmedia_3,tmedia_4,tmedia_5,tmedia_6,tmedia_7,tmedia_8,tmedia_9,tmedia_10,tmedia_11,tmedia_12 output=PCA_tmedia_

Computing means for band 12...
100%
Computing row 1 (of 12) of covariance matrix...

EXAMPLE SCRIPS

#!/bin/bash

# Analisis de componentes principales

for map in tmedia_ aston_ clor_
do

B1=1
B2=2
B3=3
B4=4
B5=5
B5=6
B7=7
B8=8
B9=9
B10=10
B11=11
B12=12

i.pca rescale=0,0 input="$map$B1,$map$B2,$map$B3,$map$B4,$map$B5,$map
$B7,$map$B8,$map$B9,$map$B10,$map$B11,$map$B12" output=PCA_$map

Is $map$B6 really missing in the script or is it just a typo above?

I had a fatal error when writing the script, I omitted the B6 = 6 and
$map$B6, and B5=6 is bad. I fixed the script. The script is now working
perfectly. Another question: Your I could suggest improvements to the
scripts, to make it more compact: for example, you can use "*" instead
B1=1 B2=2 B3=3 etc.

Thanks Markus Metz

# SCRIPS GOOD EXAMPLE:
#!/bin/bash
# Analisis de componentes principales

for map in tmedia_ aston_ clor_
do

B1=1
B2=2
B3=3
B4=4
B5=5
B6=6
B7=7
B8=8
B9=9
B10=10
B11=11
B12=12

i.pca rescale=0,0 input="$map$B1,$map$B2,$map$B3,$map$B4,$map$B5,$map
$B6,$map$B7,$map$B8,$map$B9,$map$B10,$map$B11,$map$B12" output=PCA_$map

El lun, 04-07-2011 a las 20:49 +0200, Markus Metz escribió:

On Mon, Jul 4, 2011 at 8:43 PM, Gaspar <gos47@hotmail.com> wrote:
> Dear Grass users
>
> I am trying to run the principal components analysis with "i.pca" for 12
> raster.
>
> I made a script to process three times the "i.pca" with three sets
> (twelve raster by each sets) of different parameters (temperature,
> chlorophyll, Insolation), but when I run the scripts this only takes 11
> images by sets. I tried i.pc manually and this takes twelve raster
> correctly. Thank you in advance.
>
> EXAMPLES WHIT SCRIP:
>
> GRASS 6.4.1 > i.pca_.sh
> .
> .
> .
> Computing means for band 11...
> 100%
> Computing row 1 (of 11) of covariance matrix...
>
> EXAMPLES MANUALLY FOR ONE SET:
>
> GRASS 6.4.1 >
> input=tmedia_1,tmedia_2,tmedia_3,tmedia_4,tmedia_5,tmedia_6,tmedia_7,tmedia_8,tmedia_9,tmedia_10,tmedia_11,tmedia_12 output=PCA_tmedia_
>
> Computing means for band 12...
> 100%
> Computing row 1 (of 12) of covariance matrix...
>
>
> EXAMPLE SCRIPS
>
> #!/bin/bash
>
> # Analisis de componentes principales
>
> for map in tmedia_ aston_ clor_
> do
>
> B1=1
> B2=2
> B3=3
> B4=4
> B5=5
> B5=6
> B7=7
> B8=8
> B9=9
> B10=10
> B11=11
> B12=12
>
> i.pca rescale=0,0 input="$map$B1,$map$B2,$map$B3,$map$B4,$map$B5,$map
> $B7,$map$B8,$map$B9,$map$B10,$map$B11,$map$B12" output=PCA_$map
>

Is $map$B6 really missing in the script or is it just a typo above?