<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Benilton,<br>
    <br>
    Mais uma vez obrigado! Problema resolvido!<br>
    <br>
    Não se preocupes não colocarei mais anexos a lista (eu não sabia). <br>
    <br>
    Humberto<br>
    <br>
    Em 3/30/2012 1:14 PM, Benilton Carvalho escreveu:
    <blockquote
cite="mid:CAO-arWNcOjJGFgnyF8_abJMLKH=X76wndgd=_vJD0LAXm9Ufjg@mail.gmail.com"
      type="cite">
      <div>Usando o 'resultados' da minha primeira resposta, na qual
        postei o codigo:</div>
      <div><br>
      </div>
      <div>resultadosFinais = do.call(rbind, lapply(resultados, '[',
        c('lat', 'lng', 'sst', 'mes', 'year')))</div>
      <div><br>
      </div>
      <div>Adicionalmente, considere a gentileza de nao enviar arquivos
        anexados para a lista.</div>
      <div><br>
      </div>
      <div>benilton</div>
      <br>
      <div class="gmail_quote">2012/3/30 Humberto Hazin <span dir="ltr"><<a
            moz-do-not-send="true" href="mailto:hghazin@hotmail.com">hghazin@hotmail.com</a>></span><br>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div bgcolor="#FFFFFF" text="#000000"> Olá Benilto,<br>
            Segue em anexo os resultados gerados pelo teu codigo
            (result.csv) para que vc possa ter uma ideia do que foi
            gerado. o que estava perguntando era se seria possivel
            deixar da seguinte forma anexo (result1.csv)<br>
            <br>
            Obrigado mais uma vez<br>
            <br>
            Humberto<br>
            <br>
            <br>
            Em 3/30/2012 12:46 PM, Benilton Carvalho escreveu:
            <div>
              <div class="h5">
                <blockquote type="cite">nao tenho como ter ideia sobre
                  as "5 colunas", afinal escrevi o codigo sem saber o
                  que sao os dados.
                  <div><br>
                  </div>
                  <div>se vc se refere a concatenar todos os data.frames
                    resultantes num data.frame maior, use:</div>
                  <div><br>
                  </div>
                  <div>resultados = do.call(rbind, resultados)</div>
                  <div><br>
                  </div>
                  <div>b</div>
                  <div><br>
                    <div class="gmail_quote">2012/3/30 Humberto Hazin <span
                        dir="ltr"><<a moz-do-not-send="true"
                          href="mailto:hghazin@hotmail.com"
                          target="_blank">hghazin@hotmail.com</a>></span><br>
                      <blockquote class="gmail_quote" style="margin:0 0
                        0 .8ex;border-left:1px #ccc
                        solid;padding-left:1ex">
                        <div bgcolor="#FFFFFF" text="#000000"> Benilton,<br>
                          <br>
                          Muito obrigado! Resolveu meu problema! <br>
                          So mais uma pergunta. Caso eu queira que os
                          valores fique em apenas 5 colunas como o
                          exemplo abaixo<br>
                          Lat   Long    Year        Mes   SST  <br>
                          23      49       2009        1<br>
                          22      49       2007        1<br>
                          21      49       2009        2<br>
                          21      49       2010        1<br>
                          .           .           .               . <br>
                          .           .           .               .<br>
                          .           .           .               .  <br>
                          <br>
                          <br>
                          Obrigado também ao Cleber!<br>
                          <br>
                          Um abraço<br>
                          <br>
                          Humberto<br>
                          <br>
                          Em 3/30/2012 12:10 PM, Benilton Carvalho
                          escreveu:
                          <div>
                            <div>
                              <blockquote type="cite">f =
                                function(fname){
                                <div>   year = substr(fname, 2, 5)</div>
                                <div>   day1 = as.integer(substr(fname,
                                  6, 8))</div>
                                <div>   month =
                                  format(as.Date(strptime(paste(year,
                                  "01", "01", sep='-'),
                                  '%Y-%m-%d'))+day1-1, '%m')</div>
                                <div>   objOut = paste('m', substr(year,
                                  3, 4), month, sep='')</div>
                                <div><br>
                                </div>
                                <div>   hdf4to5(fname)</div>
                                <div>   assign(objOut,
                                  satinGet(paste(fname, 5, sep=''),
                                  lats=c(10, -30), lons=c(-20, -50),
                                  itype='oceancolor'))</div>
                                <div>   assign(objOut,
                                  data.frame(extract(simplifySat(get(objOut),
                                  extent=1))))</div>
                                <div>   assign(objOut,
                                  cbind(get(objOut),
                                  mes=as.integer(month),
                                  year=as.integer(year)))</div>
                                <div>   return(get(objOut)<br>
                                  <div>}</div>
                                  <div><br>
                                  </div>
                                  <div>## vetor com o nome de todos os
                                    arquivos hdf4</div>
                                  <div>fns =
                                    list.files(pattern='\\.hdf$')</div>
                                  <div>resultados = lapply(fns, f)</div>
                                  <div><br>
                                  </div>
                                  <div>Claramente, eu nao experimentei o
                                    codigo acima... e fica pra vc a
                                    tarefa de testar e corrigir algum
                                    parenteses que esteja faltando ou
                                    algum outro problema.</div>
                                  <div><br>
                                  </div>
                                  <div>benilton</div>
                                  <div><br>
                                    <div class="gmail_quote">2012/3/30
                                      Humberto Hazin <span dir="ltr"><<a
                                          moz-do-not-send="true"
                                          href="mailto:hghazin@hotmail.com"
                                          target="_blank">hghazin@hotmail.com</a>></span><br>
                                      <blockquote class="gmail_quote"
                                        style="margin:0 0 0
                                        .8ex;border-left:1px #ccc
                                        solid;padding-left:1ex">
                                        <div bgcolor="#FFFFFF"
                                          text="#000000">
                                          <div> Bom dia Benilton,<br>
                                            <br>
                                            Obrigado por responder!<br>
                                            <br>
                                            É o seguinte quando baixo a
                                            imagem ela já vem com esse
                                            número todo
                                            (S20040322004060) onde
                                            S=seawifs, em seguida vem o
                                            ano 2004032 2004060
                                            significa o periodo da
                                            coleta do satélite ou seja
                                            032-60 dias de 2004, ou seja
                                            mes 2. Assim para o outro
                                            arquivo S20040012004031
                                            001-31 dias de 2004 ou seja
                                            mes 1<br>
                                            <br>
                                            Esse arquivos estão em hdf4
                                            porém preciso converter para
                                            hdf5 para poder trabalhar!
                                            Então criei uma função no R
                                            (hdf4to5) para para ler um
                                            executavel de um programa
                                            (H4H5TOOLS-2.2.1-win764-vs10static)
                                            em segundo plano para esse
                                            fim! Uso o pacote Satin para
                                            ler o arquivo convertido em
                                            hdf5 e fazer as extrações da
                                            área que quero ter esses
                                            dados
                                            "satinGet("S20040012004031.hdf5",lats=c(10,
                                            -30), lons=c(-20, -50),
                                            itype="oceancolor")" como
                                            preciso de quadrantes de 1x1
                                            grau uso a função
                                            "simplifySat(m0401,
                                            extent=1)" em seguida criei
                                            uma função no R
                                            "extract(m0401)" para
                                            extrair tudo em coluna Lat,
                                            Long, Parametro...<br>
                                            <br>
                                            <br>
                                          </div>
                                          <div>
                                            hdf4to5("S20040012004031.hdf");m0401
                                            <-
                                            satinGet("S20040012004031.hdf5",lats=c(10,
                                            -30), lons=c(-20, -50),
                                            itype="oceancolor")<br>
                                             m0401<-(simplifySat(m0401,

                                            extent=1));m0401<-extract(m0401);m0401<-data.frame(m0401);m0401$mes<-1;




                                            m0401$year<-2004<br>
                                            <br>
                                             hdf4to5("S20040322004060.hdf");m0402

                                            <-
                                            satinGet("S20040322004060.hdf5",lats=c(10,
                                            -30), lons=c(-20, -50),
                                            itype="oceancolor")<br>
                                             m0402<-(simplifySat(m0402,

                                            extent=1));m0402<-extract(m0402);m0402<-data.frame(m0402);m0402$mes<-2;




                                            m0402$year<-2004<br>
                                            <br>
                                          </div>
                                          <div> Eu não sei se ficou mais
                                            claro agora!<br>
                                            <br>
                                            Humberto<br>
                                            <br>
                                            <br>
                                            Em 3/29/2012 9:25 PM,
                                            Benilton Carvalho escreveu:
                                          </div>
                                          <blockquote type="cite">Sim,
                                            alguem pode te ajudar... mas
                                            depende muito de vc ajudar o
                                            alguem primeiro.... Qual o
                                            truque para sair
                                            de S20040322004060 para "mes
                                            2"? (minha bola de cristal
                                            diz que o ano corresponde
                                            aos 4 primeiros digitos apos
                                            S, mas isso eh soh uma
                                            hipotese, jah que vc nao
                                            disse explicitamente)
                                            <div>
                                              <div>
                                                <div> <br>
                                                </div>
                                                <div>b<br>
                                                  <br>
                                                  <div
                                                    class="gmail_quote">2012/3/29

                                                    Humberto Hazin <span
                                                      dir="ltr"><<a
                                                        moz-do-not-send="true"
href="mailto:hghazin@hotmail.com" target="_blank">hghazin@hotmail.com</a>></span><br>
                                                    <blockquote
                                                      class="gmail_quote"
                                                      style="margin:0 0
                                                      0
                                                      .8ex;border-left:1px
                                                      #ccc
                                                      solid;padding-left:1ex">
                                                      Prezados,<br>
                                                      <br>
                                                      Venho mais uma vez
                                                      pedir ajuda a
                                                      voces para
                                                      resolver um
                                                      problema!<br>
                                                      <br>
                                                      baixei uma série
                                                      de images de
                                                      satelite, por ano
                                                      e mes (2004 a
                                                      2010) totalizando
                                                      163 arquivos ate
                                                      ai tudo bem! Por
                                                      termos de
                                                      comodidade
                                                      gostaria de criar
                                                      um loop para nao
                                                      ter que digitar
                                                      essas 163 linhas
                                                      ou mais para
                                                      extrair latitude,
                                                      longitude e SST.
                                                      conforme o codigo
                                                      abaixo:<br>
                                                      <br>
                                                      hdf4to5("S20040012004031.hdf");m0401

                                                      <-
                                                      satinGet("S20040012004031.hdf5",lats=c(10,
                                                      -30), lons=c(-20,
                                                      -50),
                                                      itype="oceancolor")<br>
                                                       m0401<-(simplifySat(m0401,

                                                      extent=1));m0401<-extract(m0401);m0401<-data.frame(m0401);m0401$mes<-1;



m0401$year<-2004<br>
                                                      <br>
                                                       hdf4to5("S20040322004060.hdf");m0402

                                                      <-
                                                      satinGet("S20040322004060.hdf5",lats=c(10,
                                                      -30), lons=c(-20,
                                                      -50),
                                                      itype="oceancolor")<br>
                                                       m0402<-(simplifySat(m0402,

                                                      extent=1));m0402<-extract(m0402);m0402<-data.frame(m0402);m0402$mes<-2;



m0402$year<-2004<br>
                                                      <br>
                                                      Alguem poderia me
                                                      ajudar!<br>
                                                      <br>
                                                      Nao coloquei o
                                                      arquivo pois é
                                                      muito grande quase
                                                      36gigas porém caso
                                                      precisem posso
                                                      colocar o parte do
                                                      codigo para
                                                      baixarem um ou
                                                      mais arquivos e
                                                      testarem<br>
                                                      <br>
                                                      Humberto<br>
                                                      <br>
_______________________________________________<br>
                                                      R-br mailing list<br>
                                                      <a
                                                        moz-do-not-send="true"
href="mailto:R-br@listas.c3sl.ufpr.br" target="_blank">R-br@listas.c3sl.ufpr.br</a><br>
                                                      <a
                                                        moz-do-not-send="true"
href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br"
                                                        target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
                                                      Leia o guia de
                                                      postagem (<a
                                                        moz-do-not-send="true"
href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>)
                                                      e forneça código
                                                      mínimo
                                                      reproduzível.<br>
                                                    </blockquote>
                                                  </div>
                                                  <br>
                                                </div>
                                                <br>
                                                <fieldset></fieldset>
                                                <br>
                                                <pre>_______________________________________________
R-br mailing list
<a moz-do-not-send="true" href="mailto:R-br@listas.c3sl.ufpr.br" target="_blank">R-br@listas.c3sl.ufpr.br</a>
<a moz-do-not-send="true" href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a>
Leia o guia de postagem (<a moz-do-not-send="true" href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.</pre>
                                              </div>
                                            </div>
                                          </blockquote>
                                          <br>
                                        </div>
                                      </blockquote>
                                    </div>
                                    <br>
                                  </div>
                                </div>
                              </blockquote>
                              <br>
                            </div>
                          </div>
                        </div>
                      </blockquote>
                    </div>
                    <br>
                  </div>
                </blockquote>
                <br>
              </div>
            </div>
          </div>
        </blockquote>
      </div>
      <br>
    </blockquote>
    <br>
  </body>
</html>