<html style="direction: ltr;">
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
    <style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
  </head>
  <body style="direction: ltr;"
    bidimailui-detected-decoding-type="latin-charset" bgcolor="#FFFFFF"
    text="#000000">
    Just a python comment. (I'm not sure it will make any difference,
    but it makes the "run_command" cleaner)<br>
    See below:<br>
    <br>
    <div class="moz-cite-prefix">On 05/15/2015 05:02 PM, Jake Chila
      wrote:<br>
    </div>
    <blockquote
cite="mid:CANPF1K3Bo9EQZ=r+=3wf0qUXTsjWU+xYLqmP2Kq5Tu7e8YGOwQ@mail.gmail.com"
      type="cite">
      <div dir="ltr"><span style="font-size:12.8000001907349px">Actually,
          scratch that. The script ran once, but now when I run it from
          the GUI it doesn't actually update the table, it just runs
          through without doing anything.<br>
        </span><br>
        JDC</div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Fri, May 15, 2015 at 10:56 AM, Jake
          Chila <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:jake.chila@gmail.com" target="_blank">jake.chila@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">HI all,<br>
              <br>
              <br>
              <br>
              Here is the code I am running:
              <div><br>
              </div>
              <div>
                <div><font face="monospace, monospace">MAPS =
                    grass.read_command('i.group',</font></div>
                <div><font face="monospace, monospace">                 
                            group='LE7_SEG',</font></div>
                <div><font face="monospace, monospace">                 
                            flags='g',</font></div>
                <div><font face="monospace, monospace">                 
                            quiet=True).splitlines()</font></div>
                <div><br>
                </div>
                <br>
                <div><font face="monospace, monospace">for maps in MAPS:</font></div>
                <div><font face="monospace, monospace">    </font></div>
                <div><font face="monospace, monospace">   
                    band=maps.split('@',1)[0]</font></div>
                <div><font face="monospace, monospace"><br>
                  </font></div>
                <div><font face="monospace, monospace">   
                    bnum=band[-2:]</font></div>
              </div>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
    # Set variables for the column names <br>
    <font face="monospace, monospace">col = bnum+"_median"<br>
      qcol = "bright"+col<br>
      <br>
      <br>
    </font>
    <blockquote
cite="mid:CANPF1K3Bo9EQZ=r+=3wf0qUXTsjWU+xYLqmP2Kq5Tu7e8YGOwQ@mail.gmail.com"
      type="cite">
      <div class="gmail_extra">
        <div class="gmail_quote">
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">
              <div>
                <div><font face="monospace, monospace"><br>
                  </font></div>
                <div><font face="monospace, monospace">   
                    grass.run_command('v.build',</font></div>
                <div><font face="monospace, monospace">                 
                        map='LE7_2001_SEG',</font></div>
                <div><font face="monospace, monospace">                 
                        option='build')</font></div>
                <div><font face="monospace, monospace">                 
                        </font></div>
                <div><font face="monospace, monospace">   
                    grass.run_command('v.rast.stats',</font></div>
                <div><font face="monospace, monospace">                 
                        map='LE7_2001_SEG',</font></div>
                <div><font face="monospace, monospace">                 
                        flags='c',</font></div>
                <div><font face="monospace, monospace">                 
                        raster=band,</font></div>
                <div><font face="monospace, monospace">                 
                        method='median',</font></div>
                <div><font face="monospace, monospace">                 
                        column_prefix='%s' % bnum)</font></div>
              </div>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <font face="monospace, monospace">It seems to me that the '%s' is
      unnecessary here. bnum should already be a string variable so
      "column_prefix = bnum" should be fine.<br>
      <br>
    </font>
    <blockquote
cite="mid:CANPF1K3Bo9EQZ=r+=3wf0qUXTsjWU+xYLqmP2Kq5Tu7e8YGOwQ@mail.gmail.com"
      type="cite">
      <div class="gmail_extra">
        <div class="gmail_quote">
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">
              <div>
                <div><font face="monospace, monospace">    <br>
                  </font></div>
                <div><font face="monospace, monospace">   
                    grass.run_command('v.db.update',</font></div>
                <div><font face="monospace, monospace">                 
                        map='LE7_2001_SEG',</font></div>
                <div><font face="monospace, monospace">                 
                        column='bright',</font></div>
                <div><font face="monospace, monospace">                 
                        qcolumn='bright+%s_median' %bnum)</font></div>
              </div>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <br>
    <font face="monospace, monospace">Here just use: "qcolumm = qcol</font>" 
    (from above)<br>
    <br>
    <blockquote
cite="mid:CANPF1K3Bo9EQZ=r+=3wf0qUXTsjWU+xYLqmP2Kq5Tu7e8YGOwQ@mail.gmail.com"
      type="cite">
      <div class="gmail_extra">
        <div class="gmail_quote">
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">
              <div>
                <div><font face="monospace, monospace">    </font></div>
                <div><font face="monospace, monospace">   
                    grass.run_command('v.db.dropcolumn',</font></div>
                <div><font face="monospace, monospace">                 
                        map='LE7_2001_SEG',</font></div>
                <div><font face="monospace, monospace">                 
                        column = '%s_median' % bnum)</font></div>
              </div>
              <div><font face="monospace, monospace"><br>
                </font></div>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <font face="monospace, monospace">And here "column = col</font>" 
    (from above)<br>
    <br>
    <br>
    <br>
    <blockquote
cite="mid:CANPF1K3Bo9EQZ=r+=3wf0qUXTsjWU+xYLqmP2Kq5Tu7e8YGOwQ@mail.gmail.com"
      type="cite">
      <div class="gmail_extra">
        <div class="gmail_quote">
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">
              <div><font face="arial, helvetica, sans-serif"><br>
                  <br>
                  Thanks,<br>
                  <br>
                  JDC</font></div>
            </div>
            <div class="gmail_extra"><br>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>