<div dir="ltr">Ok, I put the file (r.colors.sttdev) on C:\GRASS\scripts.<br><br>On the output windowm, if I enter with r.colors.sttdev and Run, seems GRASS recognize the command. But how in the syntax to inform the input and other parametres?<br>
<br>Can I found this in the code?<br><br>1 #!/bin/sh<br>2 ############################################################################<br>3 #<br>4 # MODULE: r.colors.stddev<br>5 # AUTHOR: M. Hamish Bowman, Dept. Marine Science, Otago Univeristy,<br>
6 # New Zealand<br>7 # PURPOSE: <br>8 #<br>9 # COPYRIGHT: (c) 2007 Hamish Bowman, and the GRASS Development Team<br>10 # This program is free software under the GNU General Public<br>
11 # License (>=v2). Read the file COPYING that comes with GRASS<br>12 # for details.<br>13 #<br>14 #############################################################################<br>
15 <br>16 #%Module<br>17 #% description: Set color rules based on stddev from a map's mean value.<br>18 #% keywords: raster<br>19 #%End<br>20 #% option<br>21 #% key: input<br>22 #% type: string<br>
23 #% gisprompt: old,cell,raster<br>24 #% key_desc: name<br>25 #% description: Name of input raster map<br>26 #% required: yes<br>27 #%end<br>28 #%flag<br>29 #% key: b<br>30 #% description: Color using standard deviation bands<br>
31 #%end<br>32 #%flag<br>33 #% key: z<br>34 #% description: Force center at zero<br>35 #%end<br>36 <br>37 <br>38 if [ -z "$GISBASE" ] ; then<br>39 echo "You must be in GRASS GIS to run this program." 1>&2<br>
40 exit 1<br>41 fi<br>42 <br>43 if [ "$1" != "@ARGS_PARSED@" ] ; then<br>44 exec g.parser "$0" "$@"<br>45 fi<br>46 <br>47 <br>48 eval `r.univar -g "$GIS_OPT_INPUT"`<br>
49 # $? is result of the eval not r.univar (???)<br>50 #if [ $? -ne 0 ] ; then<br>51 # echo "ERROR: Problem running r.univar" 1>&2<br>52 # exit 1<br>53 #fi<br>54 <br>55 <br>
56 if [ $GIS_FLAG_Z -eq 0 ] ; then<br>57 <br>58 MEAN_MINUS_2STDEV=`echo "$mean $stddev" | awk '{print $1 - 2*$2}'`<br>59 MEAN_PLUS_2STDEV=`echo "$mean $stddev" | awk '{print $1 + 2*$2}'`<br>
60 <br>61 if [ $GIS_FLAG_B -eq 0 ] ; then<br>62 # smooth free floating blue/white/red<br>63 r.colors "$GIS_OPT_INPUT" color=rules << EOF<br>64 0% blue<br>65 $MEAN_MINUS_2STDEV blue<br>
66 $mean white<br>67 $MEAN_PLUS_2STDEV red<br>68 100% red<br>69 EOF<br>70 else<br>71 # banded free floating black/red/yellow/green/yellow/red/black<br>72 MEAN_MINUS_1STDEV=`echo "$mean $stddev" | awk '{print $1 - $2}'`<br>
73 MEAN_MINUS_3STDEV=`echo "$mean $stddev" | awk '{print $1 - 3*$2}'`<br>74 MEAN_PLUS_1STDEV=`echo "$mean $stddev" | awk '{print $1 + $2}'`<br>75 MEAN_PLUS_3STDEV=`echo "$mean $stddev" | awk '{print $1 + 3*$2}'`<br>
76 <br>77 # reclass with labels only works for category (integer) based maps<br>78 #r.reclass input="$GIS_OPT_INPUT" output="${GIS_OPT_INPUT}.stdevs" << EOF<br>79 <br>80 # >3 S.D. outliers colored black so they show up in d.histogram w/ white background<br>
81 r.colors "$GIS_OPT_INPUT" color=rules << EOF<br>82 0% black<br>83 $MEAN_MINUS_3STDEV black<br>84 $MEAN_MINUS_3STDEV red<br>85 $MEAN_MINUS_2STDEV red<br>
86 $MEAN_MINUS_2STDEV yellow<br>87 $MEAN_MINUS_1STDEV yellow<br>88 $MEAN_MINUS_1STDEV green<br>89 $MEAN_PLUS_1STDEV green<br>90 $MEAN_PLUS_1STDEV yellow<br>91 $MEAN_PLUS_2STDEV yellow<br>
92 $MEAN_PLUS_2STDEV red<br>93 $MEAN_PLUS_3STDEV red<br>94 $MEAN_PLUS_3STDEV black<br>95 100% black<br>96 EOF<br>97 fi<br>98 <br>99 <br>100 else <br>101 # data centered on 0 (e.g. map of deviations)<br>
102 r.mapcalc "r_col_stdev_abs_$$ = abs($GIS_OPT_INPUT)"<br>103 eval `<a href="http://r.info">r.info</a> -r "r_col_stdev_abs_$$"`<br>104 <br>105 # current r.univar truncates percentage to the base integer<br>
106 STDDEV2=`r.univar -eg "r_col_stdev_abs_$$" perc=95.4500 | grep ^percentile | cut -f2 -d=`<br>107 <br>108 if [ $GIS_FLAG_B -eq 0 ] ; then<br>109 # zero centered smooth blue/white/red<br>
110 r.colors "$GIS_OPT_INPUT" color=rules << EOF<br>111 -$max blue<br>112 -$STDDEV2 blue<br>113 0 white<br>114 $STDDEV2 red<br>115 $max red<br>
116 EOF<br>117 else<br>118 # zero centered banded black/red/yellow/green/yellow/red/black<br>119 <br>120 # current r.univar truncates percentage to the base integer<br>121 STDDEV1=`r.univar -eg "r_col_stdev_abs_$$" perc=68.2689 | grep ^percentile | cut -f2 -d=`<br>
122 STDDEV3=`r.univar -eg "r_col_stdev_abs_$$" perc=99.7300 | grep ^percentile | cut -f2 -d=`<br>123 <br>124 # >3 S.D. outliers colored black so they show up in d.histogram w/ white background<br>
125 r.colors "$GIS_OPT_INPUT" color=rules << EOF<br>126 -$max black<br>127 -$STDDEV3 black<br>128 -$STDDEV3 red<br>129 -$STDDEV2 red<br>130 -$STDDEV2 yellow<br>
131 -$STDDEV1 yellow<br>132 -$STDDEV1 green<br>133 $STDDEV1 green<br>134 $STDDEV1 yellow<br>135 $STDDEV2 yellow<br>136 $STDDEV2 red<br>137 $STDDEV3 red<br>
138 $STDDEV3 black<br>139 $max black<br>140 EOF<br>141 fi<br>142 <br>143 g.remove rast="r_col_stdev_abs_$$" --quiet<br>144 fi<br><br><br><div class="gmail_quote">On Tue, Aug 12, 2008 at 11:50 AM, Martin Wegmann <span dir="ltr"><<a href="mailto:wegmann@biozentrum.uni-wuerzburg.de">wegmann@biozentrum.uni-wuerzburg.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello Raphael,<br>
<br>
just download it and call the script within the GRASS shell<br>
<br>
sh r.colors.stddev<br>
<br>
you have to define the input on the command line. The GUI won't work with this<br>
method.<br>
<br>
regards, Martin<br>
<div><div></div><div class="Wj3C7c"><br>
<br>
<br>
<br>
On Dienstag, 12. August 2008 16:03:16 Raphael Saldanha wrote:<br>
> Hi!<br>
><br>
> Where can I download GEM? I'm a newbie and need to use an add-onn<br>
> (r.colors.stddev), can someone give some instructions?<br>
><br>
> GRASS 6.3.0 running on Windows :-(<br>
><br>
><br>
><br>
> Regards,<br>
><br>
> Raphael Saldanha<br>
> <a href="mailto:saldanha.plangeo@gmail.com">saldanha.plangeo@gmail.com</a><br>
><br>
> BRAZIL<br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Atenciosamente,<br><br>Raphael Saldanha<br><a href="mailto:saldanha.plangeo@gmail.com">saldanha.plangeo@gmail.com</a><br>Lucille Ball - "The secret of staying young is to live honestly, eat slowly, and lie about your age."
</div>