<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Thiago,<br>
    <br>
         Vou continuar tentando, mas extract() não funciona, pois o
    objeto kc$predict pertence a classe numeric.<br>
    <br>
    Abraço,<br>
    <br>
    Alexandre<br>
    <br>
    <br>
    <div class="moz-cite-prefix">Em 07/04/2013 02:54, Thiago V. dos
      Santos escreveu:<br>
    </div>
    <blockquote
      cite="mid:1365317676.57058.YahooMailNeo@web121902.mail.ne1.yahoo.com"
      type="cite">
      <div style="color:#000; background-color:#fff; font-family:times
        new roman, new york, times, serif;font-size:12pt">
        <div id="yiv232405379">
          <div>
            <div style="color: rgb(0, 0, 0); background-color: rgb(255,
              255, 255); font-family: 'times new roman', 'new york',
              times, serif; font-size: 12pt;">
              <div id="yiv232405379yui_3_7_2_18_1365302541879_54"
                style="font-family: 'times new roman', 'new york',
                times, serif; font-size: 12pt;"><span
                  id="yiv232405379yui_3_7_2_18_1365302541879_103">Alexandre,</span></div>
              <div id="yiv232405379yui_3_7_2_18_1365302541879_54"
                style="font-family: 'times new roman', 'new york',
                times, serif; font-size: 16px; color: rgb(0, 0, 0);
                background-color: transparent; font-style: normal;"><span
                  id="yiv232405379yui_3_7_2_18_1365302541879_106"><br>
                </span></div>
              <div id="yiv232405379yui_3_7_2_18_1365302541879_54"
                style="font-family: 'times new roman', 'new york',
                times, serif; font-size: 16px; color: rgb(0, 0, 0);
                background-color: transparent; font-style: normal;">Você
                já tem o polígono gridPol de onde você quer criar a
                média da krigagem. Não conheço bem as classes do pacote
                geoR, mas as coordenadas do kc$predict parecem estar no
                objeto pred.grid. <span style="font-size: 12pt;">A
                  abordagem que eu usaria seria criar um objeto raster
                  da krigagem e em seguida contar os valores usando a
                  função extract (raster) usando como argumentos o
                  raster da krigagem e o gridPol.</span></div>
              <div id="yiv232405379yui_3_7_2_18_1365302541879_54"
                style="font-family:'times new roman', 'new york', times,
                serif;font-size:16px;color:rgb(0, 0,
                0);background-color:transparent;font-style:normal;"
                class="yui_3_7_2_19_1365302541879_57"><br>
              </div>
              <div id="yiv232405379yui_3_7_2_18_1365302541879_54"
                style="font-family:'times new roman', 'new york', times,
                serif;font-size:16px;color:rgb(0, 0,
                0);background-color:transparent;font-style:normal;"
                class="yui_3_7_2_19_1365302541879_57">Além da ajuda para
                a função extract no manual do raster, talvez o último
                exemplo dessa página possa te ajudar: <a
                  moz-do-not-send="true"
href="http://stackoverflow.com/questions/14682606/extract-value-from-raster-stack-from-spatialpolygondataframe"
                  style="font-size: 12pt;">http://stackoverflow.com/questions/14682606/extract-value-from-raster-stack-from-spatialpolygondataframe</a></div>
              <div id="yiv232405379yui_3_7_2_18_1365302541879_54"
                style="font-family: 'times new roman', 'new york',
                times, serif; font-size: 16px; color: rgb(0, 0, 0);
                background-color: transparent; font-style: normal;"><br>
              </div>
              <div id="yiv232405379yui_3_7_2_18_1365302541879_54"
                style="font-family: 'times new roman', 'new york',
                times, serif; font-size: 16px; color: rgb(0, 0, 0);
                background-color: transparent; font-style: normal;">Mas
                não estou certo se era isso que você estava buscando.
                Acho que o Paulo vai te ajudar melhor.</div>
              <div id="yiv232405379yui_3_7_2_18_1365302541879_58"
                style="font-family: 'times new roman', 'new york',
                times, serif; font-size: 12pt;"> </div>
              <div style="font-family: 'times new roman', 'new york',
                times, serif; font-size: 12pt;">Saudações,<br
                  id="yiv232405379yui_3_7_2_18_1365302541879_61">
                --<br id="yiv232405379yui_3_7_2_18_1365302541879_64">
                Thiago V. dos Santos<br
                  id="yiv232405379yui_3_7_2_18_1365302541879_67">
                PhD student<br
                  id="yiv232405379yui_3_7_2_18_1365302541879_70">
                Land and Atmospheric Science<br
                  id="yiv232405379yui_3_7_2_18_1365302541879_73">
                University of Minnesota<br
                  id="yiv232405379yui_3_7_2_18_1365302541879_76">
<a class="moz-txt-link-freetext" href="http://www.laas.umn.edu/CurrentStudents/MeettheStudents/ThiagodosSantos/index.htm">http://www.laas.umn.edu/CurrentStudents/MeettheStudents/ThiagodosSantos/index.htm</a><br
                  id="yiv232405379yui_3_7_2_18_1365302541879_79">
                Phone: (612) 323 9898<br
                  id="yiv232405379yui_3_7_2_18_1365302541879_82">
              </div>
              <div style="font-family: 'times new roman', 'new york',
                times, serif; font-size: 12pt;"
                id="yiv232405379yui_3_7_2_18_1365302541879_85"
                class="yiv232405379yui_3_7_2_18_1365302541879_84">
                <div style="font-family: 'times new roman', 'new york',
                  times, serif; font-size: 12pt;"
                  class="yiv232405379yui_3_7_2_18_1365302541879_87">
                  <div dir="ltr"> <font size="2" face="Arial">
                      <hr size="1"> <b><span style="font-weight:bold;">From:</span></b>
                      ASANTOS <a class="moz-txt-link-rfc2396E" href="mailto:alexandresantosbr@yahoo.com.br"><alexandresantosbr@yahoo.com.br></a><br>
                      <b><span style="font-weight:bold;">To:</span></b>
                      <a class="moz-txt-link-abbreviated" href="mailto:r-br@listas.c3sl.ufpr.br">r-br@listas.c3sl.ufpr.br</a>; Thiago V. dos Santos
                      <a class="moz-txt-link-rfc2396E" href="mailto:thi_veloso@yahoo.com.br"><thi_veloso@yahoo.com.br></a> <br>
                      <b><span style="font-weight:bold;">Sent:</span></b>
                      Saturday, April 6, 2013 10:26 PM<br>
                      <b><span style="font-weight:bold;">Subject:</span></b>
                      Re: [R-br] Obter valor médio dos pixels de uma
                      imagem gerada por krigagem<br>
                    </font> </div>
                  <br>
                  <div id="yiv232405379">
                    <div id="yiv232405379yui_3_7_2_18_1365302541879_179">
                      Thiago,<br>
                      <br>
                          Já pensei isto, mas para SpatialPoints(vp),
                      preciso fazer um list() das coordenadas dos pixels
                      (vp$x e vp$y) e isto não tenho e nem sei como
                      recuperar o valor de um pixel à partir de uma
                      coordenada conhecida.<br>
                      <br>
                      Abraço,<br>
                      <br>
                      Alexandre<br>
                      <br>
                      <br>
                      <div class="yiv232405379moz-cite-prefix">Em
                        06/04/2013 21:32, Thiago V. dos Santos escreveu:<br>
                      </div>
                      <blockquote type="cite">
                        <div style="color: rgb(0, 0, 0);
                          background-color: rgb(255, 255, 255);
                          font-family: 'times new roman', 'new york',
                          times, serif; font-size: 12pt;"
                          class="yiv232405379yui_3_7_2_18_1365302541879_93">
                          <div><span>Nao conheco bem todas as funcoes do
                              sp, mas para pela mensagem de erro eu
                              transformaria a tabela vp em
                              SpatialPoints, que eh o argumento esperado
                              pela funcao over.</span></div>
                          <div> </div>
                          <div>Saudações,<br>
                            --<br>
                            Thiago V. dos Santos<br>
                            PhD student<br>
                            Land and Atmospheric Science<br>
                            University of Minnesota<br>
                            <a moz-do-not-send="true" rel="nofollow"
                              class="yiv232405379moz-txt-link-freetext"
                              target="_blank"
href="http://www.laas.umn.edu/CurrentStudents/MeettheStudents/ThiagodosSantos/index.htm">http://www.laas.umn.edu/CurrentStudents/MeettheStudents/ThiagodosSantos/index.htm</a><br>
                            Phone: (612) 323 9898<br>
                          </div>
                          <div style="font-family: 'times new roman',
                            'new york', times, serif; font-size: 12pt;"
class="yiv232405379yui_3_7_2_18_1365302541879_94">
                            <div style="font-family: 'times new roman',
                              'new york', times, serif; font-size:
                              12pt;"
                              class="yiv232405379yui_3_7_2_18_1365302541879_95"
id="yiv232405379yui_3_7_2_18_1365302541879_182">
                              <div dir="ltr"> <font size="2"
                                  face="Arial">
                                  <hr size="1"> <b><span
                                      style="font-weight:bold;">From:</span></b>
                                  ASANTOS <a moz-do-not-send="true"
                                    rel="nofollow"
                                    class="yiv232405379moz-txt-link-rfc2396E"
ymailto="mailto:alexandresantosbr@yahoo.com.br" target="_blank"
                                    href="mailto:alexandresantosbr@yahoo.com.br"><alexandresantosbr@yahoo.com.br></a><br>
                                  <b><span style="font-weight:bold;">To:</span></b>
                                  <a moz-do-not-send="true"
                                    rel="nofollow"
                                    class="yiv232405379moz-txt-link-abbreviated"
ymailto="mailto:r-br@listas.c3sl.ufpr.br" target="_blank"
                                    href="mailto:r-br@listas.c3sl.ufpr.br">r-br@listas.c3sl.ufpr.br</a>
                                  <br>
                                  <b><span style="font-weight:bold;">Sent:</span></b>
                                  Saturday, April 6, 2013 8:12 PM<br>
                                  <b><span style="font-weight:bold;">Subject:</span></b>
                                  Re: [R-br] Obter valor médio dos
                                  pixels de uma imagem gerada por
                                  krigagem<br>
                                </font> </div>
                              <br>
                              Boa noite pessoal,<br>
                              <br>
                                    Acho evoluí um pouco na questão, mas
                              agora a dificuldade esta em contar os
                              pixels contidos no interior das malhas,
                              quando tento um over(), ocorre o seguinte
                              erro:<br>
                              <br>
                              Erro em function (classes, fdef, mtable) 
                              :<br>
                                unable to find an inherited method for
                              function "over", for signature "table",
                              "SpatialPolygons"<br>
                              <br>
                              <br>
                              segue CRM:<br>
                              #<br>
                              require(geoR)<br>
                              plot(s100$coords, xlim=c(0,1.2),
                              ylim=c(0,1.2), xlab="Coord X", ylab="Coord
                              Y")<br>
                              loci <- matrix(c(0.2, 0.6, 0.2, 1.1,
                              0.2, 0.3, 1.0, 1.1), ncol=2)<br>
                              text(loci, as.character(1:4), col="red")<br>
                              polygon(x=c(0,1,1,0), y=c(0,0,1,1), lty=2)<br>
                              <br>
                              # Fitting models with nugget fixed to zero<br>
                              ml <- likfit(s100, ini = c(1,0.5),
                              fix.nugget = T)<br>
                              <br>
                              # defining the grid<br>
                              pred.grid <-  expand.grid(seq(0,1,
                              l=51), seq(0,1, l=51))<br>
                              # kriging calculations<br>
                              kc <- krige.conv(s100, loc = pred.grid,
                              krige = krige.control(obj.m = ml))<br>
                              # displaying predicted values<br>
                              image(kc, loc = pred.grid,
                              col=gray(seq(1,0.1,l=30)), xlab="Coord X",
                              ylab="Coord Y")<br>
                              #<br>
                              <br>
                              #Centro das 25 parcela 0.2 x 0.2<br>
                              p0<-c(0.1,0.1)<br>
                              #<br>
                              c0 <- seq(p0[1],p0[1]+0.9,by=0.2)<br>
                              d0 <- seq(p0[2],p0[2]+0.9,by=0.2)<br>
                              d1 <- expand.grid(x=c0, y=d0)<br>
                              points(d1[,1],d1[,2],col="red")<br>
                              ver<-c(0.0,0.2,0.4,0.6,0.8,1.0)<br>
                              hor<-c(0.0,0.2,0.4,0.6,0.8,1.0)<br>
                              abline(v=ver, col="red")<br>
                              abline(h=hor, col="red")<br>
                              #<br>
                              require(sp)<br>
                              grid=GridTopology(c(0.1,0.1), c(0.2,0.2),
                              c(5,5))### Cria as área<br>
                              grid=SpatialGrid(grid=grid)<br>
                              class(grid)  ## SpatialPixels<br>
                              gridPol <- as(grid, "SpatialPolygons")
                              ## Transfoma as areas em polígonos
                              espaciais<br>
                              options(digits=5)<br>
                              pixelsize <-
                              (1.0-0.0/30)*(1.0-0.0/30)#Tamanho do pixel
                              é dado por seq Xmaior - Xmenor/l *
                              Ymaior-Ymenor/l<br>
                              vp <- table(area <- kc$predict)##
                              Valor dos pixels<br>
                              count.pix<-table(over(vp, gridPol))
                              #contar quantos pontos tem em cada area<br>
                              <br>
                              <br>
                              Obrigado,<br>
                              <br>
                              Alexandre<br>
                              <br>
                              Em 06/04/2013 17:11, ASANTOS escreveu:<br>
                              > Boa noite membros da lista,<br>
                              > <br>
                              >        Gostaria de receber ideias
                              para calcular o valor médio dos pixel em
                              uma imagem gerada por krigagem em
                              sub-regiões de interesse na imagem, por
                              exemplo usando um exemplo do Prof. Paulo,
                              onde ajusta-se um semivariograma e faz a
                              krigagem ordinária dos dados:<br>
                              > <br>
                              > #<br>
                              > require(geoR)<br>
                              > plot(s100$coords, xlim=c(0,1.2),
                              ylim=c(0,1.2), xlab="Coord X", ylab="Coord
                              Y")<br>
                              > loci <- matrix(c(0.2, 0.6, 0.2,
                              1.1, 0.2, 0.3, 1.0, 1.1), ncol=2)<br>
                              > text(loci, as.character(1:4),
                              col="red")<br>
                              > polygon(x=c(0,1,1,0), y=c(0,0,1,1),
                              lty=2)<br>
                              > <br>
                              > # Fitting models with nugget fixed to
                              zero<br>
                              > ml <- likfit(s100, ini = c(1,0.5),
                              fix.nugget = T)<br>
                              > <br>
                              > # defining the grid<br>
                              > pred.grid <-  expand.grid(seq(0,1,
                              l=51), seq(0,1, l=51))<br>
                              > # kriging calculations<br>
                              > kc <- krige.conv(s100, loc =
                              pred.grid, krige = krige.control(obj.m =
                              ml))<br>
                              > # displaying predicted values<br>
                              > image(kc, loc = pred.grid,
                              col=gray(seq(1,0.1,l=30)), xlab="Coord X",
                              ylab="Coord Y")<br>
                              > #<br>
                              > <br>
                              > #Agora vou dividir esta área em 25
                              partes e lançar os centroides destas
                              subáreas:<br>
                              > <br>
                              > #Centro das 25 parcela 0.2 x 0.2<br>
                              > p0<-c(0.1,0.1)<br>
                              > #<br>
                              > c0 <- seq(p0[1],p0[1]+0.9,by=0.2)<br>
                              > d0 <- seq(p0[2],p0[2]+0.9,by=0.2)<br>
                              > d1 <- expand.grid(x=c0, y=d0)<br>
                              > points(d1[,1],d1[,2],col="red")<br>
                              > ver<-c(0.0,0.2,0.4,0.6,0.8,1.0)<br>
                              > hor<-c(0.0,0.2,0.4,0.6,0.8,1.0)<br>
                              > abline(v=ver, col="red")<br>
                              > abline(h=hor, col="red")<br>
                              > #<br>
                              > <br>
                              >  E aqui vem minha pergunta, como
                              calcular o valor médio dos pixels contidos
                              em cada subárea de 0.2 x 0.2?<br>
                              > <br>
                              > Obrigado,<br>
                              > <br>
                              <br>
                              --
                              ======================================================================<br>
                              Alexandre dos Santos<br>
                              Proteção Florestal<br>
                              Coordenador do curso Técnico em Florestas<br>
                              Vice Coordenador do curso de Engenharia
                              Florestal<br>
                              IFMT - Instituto Federal de Educação,
                              Ciência e Tecnologia de Mato Grosso<br>
                              Campus Cáceres<br>
                              Caixa Postal 244<br>
                              Avenida dos Ramires, s/n<br>
                              Bairro: Distrito Industrial<br>
                              Cáceres - MT                      CEP:
                              78.200-000<br>
                              Fone: (+55) 65 8132-8112 (TIM)  (+55) 65
                              9686-6970 (VIVO)<br>
                              e-mails:<a moz-do-not-send="true"
                                rel="nofollow"
                                ymailto="mailto:alexandresantosbr@yahoo.com.br"
                                target="_blank"
                                href="mailto:alexandresantosbr@yahoo.com.br">alexandresantosbr@yahoo.com.br</a><br>
                                      <a moz-do-not-send="true"
                                rel="nofollow"
                                ymailto="mailto:alexandre.santos@cas.ifmt.edu.br"
                                target="_blank"
                                href="mailto:alexandre.santos@cas.ifmt.edu.br">alexandre.santos@cas.ifmt.edu.br</a><br>
======================================================================<br>
                              <br>
_______________________________________________<br>
                              R-br mailing list<br>
                              <a moz-do-not-send="true" rel="nofollow"
                                ymailto="mailto:R-br@listas.c3sl.ufpr.br"
                                target="_blank"
                                href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br>
                              <a moz-do-not-send="true" rel="nofollow"
                                target="_blank"
                                href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
                              Leia o guia de postagem (<a
                                moz-do-not-send="true" rel="nofollow"
                                target="_blank"
                                href="http://www.leg.ufpr.br/r-br-guia">http://www.leg.ufpr.br/r-br-guia</a>)
                              e forneça código mínimo reproduzível.<br>
                              <br>
                              <br>
                            </div>
                          </div>
                        </div>
                        <br>
                        <fieldset
                          class="yiv232405379mimeAttachmentHeader"></fieldset>
                        <br>
                        <pre>_______________________________________________
R-br mailing list
<a moz-do-not-send="true" rel="nofollow" class="yiv232405379moz-txt-link-abbreviated" ymailto="mailto:R-br@listas.c3sl.ufpr.br" target="_blank" href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a>
<a moz-do-not-send="true" rel="nofollow" class="yiv232405379moz-txt-link-freetext" target="_blank" href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a>
Leia o guia de postagem (<a moz-do-not-send="true" rel="nofollow" class="yiv232405379moz-txt-link-freetext" target="_blank" href="http://www.leg.ufpr.br/r-br-guia">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.</pre>
                      </blockquote>
                      <br>
                      <pre class="yiv232405379moz-signature">-- 
======================================================================
Alexandre dos Santos
Proteção Florestal
Coordenador do curso Técnico em Florestas
Vice Coordenador do curso de Engenharia Florestal 
IFMT - Instituto Federal de Educação, Ciência e Tecnologia de Mato Grosso
Campus Cáceres
Caixa Postal 244
Avenida dos Ramires, s/n
Bairro: Distrito Industrial 
Cáceres - MT                      CEP: 78.200-000
Fone: (+55) 65 8132-8112 (TIM)   (+55) 65 9686-6970 (VIVO)
<a moz-do-not-send="true" rel="nofollow" class="yiv232405379moz-txt-link-abbreviated" ymailto="mailto:e-mails:alexandresantosbr@yahoo.com.br" target="_blank" href="mailto:e-mails:alexandresantosbr@yahoo.com.br">e-mails:alexandresantosbr@yahoo.com.br</a> 
        <a moz-do-not-send="true" rel="nofollow" class="yiv232405379moz-txt-link-abbreviated" ymailto="mailto:alexandre.santos@cas.ifmt.edu.br" target="_blank" href="mailto:alexandre.santos@cas.ifmt.edu.br">alexandre.santos@cas.ifmt.edu.br</a>                    
======================================================================
</pre>
                    </div>
                  </div>
                  <br>
                  <br>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
======================================================================
Alexandre dos Santos
Proteção Florestal
Coordenador do curso Técnico em Florestas
Vice Coordenador do curso de Engenharia Florestal 
IFMT - Instituto Federal de Educação, Ciência e Tecnologia de Mato Grosso
Campus Cáceres
Caixa Postal 244
Avenida dos Ramires, s/n
Bairro: Distrito Industrial 
Cáceres - MT                      CEP: 78.200-000
Fone: (+55) 65 8132-8112 (TIM)   (+55) 65 9686-6970 (VIVO)
<a class="moz-txt-link-abbreviated" href="mailto:e-mails:alexandresantosbr@yahoo.com.br">e-mails:alexandresantosbr@yahoo.com.br</a> 
        <a class="moz-txt-link-abbreviated" href="mailto:alexandre.santos@cas.ifmt.edu.br">alexandre.santos@cas.ifmt.edu.br</a>                    
======================================================================
</pre>
  </body>
</html>