<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Éder, Perfeito!!!!!<br>
<br>
Apenas inclui: write.table(XYZ, file ="coordstime.mod",
row.names=F,append=T), para que as informações das duas imagens
ficassem armazenadas em um único arquivo, <br>
<br>
Muito Obrigado,<br>
<br>
Alexandre<br>
<br>
CRM FINAL:<br>
<br>
<br>
#<code r><br>
setwd('C:/LAB/RBASICS/tmp'); getwd()<br>
require(raster); require(rgdal)<br>
<br>
### Download a partir de uma lista de links<br>
##############################################################################<br>
### A opção "get link" gera algo como
<a class="moz-txt-link-rfc2396E" href="https://www.dropbox.com/s/XXXXXX/file.png">"https://www.dropbox.com/s/XXXXXX/file.png"</a><br>
### para download.file() Use "XXXXXX/file.png" após
<a class="moz-txt-link-rfc2396E" href="http://dl.dropbox.com/s/">"http://dl.dropbox.com/s/"</a><br>
### XXXXXX = token<br>
<br>
### links obtidos no seu script<br>
links <- c(<br>
<a class="moz-txt-link-rfc2396E" href="https://www.dropbox.com/s/8b99gn9ve1yo7is/Fig1-0_00_00.png">"https://www.dropbox.com/s/8b99gn9ve1yo7is/Fig1-0_00_00.png"</a>,<br>
<a class="moz-txt-link-rfc2396E" href="https://www.dropbox.com/s/8b99gn9ve1yo7is/Fig2-0_20_00.png">"https://www.dropbox.com/s/8b99gn9ve1yo7is/Fig2-0_20_00.png"</a>, ###
erro! mesmo token do anterior!<br>
<a class="moz-txt-link-rfc2396E" href="https://www.dropbox.com/s/bo6gbt3ca6xwxm0/Fig3-0_40_00.png">"https://www.dropbox.com/s/bo6gbt3ca6xwxm0/Fig3-0_40_00.png"</a>)<br>
<br>
tokens <- gsub("^.*/s/","",dirname(links))<br>
fileNames <- basename(links)<br>
newLinks <- file.path(<a class="moz-txt-link-rfc2396E" href="http://dl.dropbox.com/s">"http://dl.dropbox.com/s"</a>, tokens,
fileNames); newLinks<br>
<br>
for (a in newLinks) {<br>
tryCatch(download.file(a, dest=basename(a), mode='wb'),<br>
error=function(...) print("Falha no
download!"))}<br>
<br>
### Verificando arquivos baixados corretamente<br>
##############################################################################<br>
fileInfo <- file.info(fileNames); fileInfo ### observe o segundo
arquivo<br>
files.OK <- fileNames[fileInfo$size>0 &
!is.na(fileInfo$size)]; files.OK<br>
<br>
### Operando arquivos baixados corretamente<br>
##############################################################################<br>
for (b in files.OK) {<br>
t <- strsplit(b,"-|\\.")[[1]][2]<br>
tempo <- gsub("_", ":", t)<br>
r <- raster(b); #image(r) ### comentado para
otimizar<br>
XYZ <- data.frame(coordinates(r), values(r),
rep(tempo))<br>
XYZ.0 <- XYZ[XYZ[,3]==0,]<br>
outName <- paste0('XYZ.0-', t, '.txt')<br>
write.table(XYZ, file ="coordstime.mod",
row.names=F,append=T)<br>
message(noquote(paste(outName, "salvo em", getwd())))<br>
}<br>
#</code><br>
<div class="moz-cite-prefix">Em 05/12/2013 16:27, Éder Comunello
escreveu:<br>
</div>
<blockquote
cite="mid:CABmC8gmP0DkC4p9xLiTC3GUssUM599isO6D_3-OGhQ4TnsPUGQ@mail.gmail.com"
type="cite">
<div dir="ltr">Alexandre, boa tarde!
<div><br>
</div>
<div>Fiz algumas alterações em cima do seu CMR. Veja se há algo
que possa lhe servir.<br>
<div><br>
</div>
<div>
<div><font face="courier new, monospace">#<code r></font></div>
<div><font face="courier new, monospace">setwd('C:/LAB/RBASICS/tmp');
getwd()</font></div>
<div><font face="courier new, monospace">require(raster);
require(rgdal)</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">### Download a
partir de uma lista de links</font></div>
<div><font face="courier new, monospace">##############################################################################</font></div>
<div><font face="courier new, monospace">### A opção "get
link" gera algo como "<a moz-do-not-send="true"
href="https://www.dropbox.com/s/XXXXXX/file.png">https://www.dropbox.com/s/XXXXXX/file.png</a>"</font></div>
<div><font face="courier new, monospace">### para
download.file() Use "XXXXXX/file.png" após "<a
moz-do-not-send="true" href="http://dl.dropbox.com/s/">http://dl.dropbox.com/s/</a>"</font></div>
<div><font face="courier new, monospace">### XXXXXX = token</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">### links obtidos
no seu script</font></div>
<div><font face="courier new, monospace">links <- c(</font></div>
<div><font face="courier new, monospace">"<a
moz-do-not-send="true"
href="https://www.dropbox.com/s/8b99gn9ve1yo7is/Fig1-0_00_00.png">https://www.dropbox.com/s/8b99gn9ve1yo7is/Fig1-0_00_00.png</a>", </font></div>
<div><font face="courier new, monospace">"<a
moz-do-not-send="true"
href="https://www.dropbox.com/s/8b99gn9ve1yo7is/Fig2-0_20_00.png">https://www.dropbox.com/s/8b99gn9ve1yo7is/Fig2-0_20_00.png</a>",
### erro! mesmo token do anterior!</font></div>
<div><font face="courier new, monospace">"<a
moz-do-not-send="true"
href="https://www.dropbox.com/s/bo6gbt3ca6xwxm0/Fig3-0_40_00.png">https://www.dropbox.com/s/bo6gbt3ca6xwxm0/Fig3-0_40_00.png</a>")</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">tokens <-
gsub("^.*/s/","",dirname(links))</font></div>
<div><font face="courier new, monospace">fileNames <-
basename(links)</font></div>
<div>
<font face="courier new, monospace">newLinks <-
file.path("<a moz-do-not-send="true"
href="http://dl.dropbox.com/s">http://dl.dropbox.com/s</a>",
tokens, fileNames); newLinks</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">for (a in newLinks)
{</font></div>
<div><font face="courier new, monospace">
tryCatch(download.file(a, dest=basename(a), mode='wb'),</font></div>
<div><font face="courier new, monospace">
error=function(...) print("Falha no
download!"))} </font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">### Verificando
arquivos baixados corretamente</font></div>
<div><font face="courier new, monospace">##############################################################################</font></div>
<div><font face="courier new, monospace">fileInfo <- <a
moz-do-not-send="true" href="http://file.info">file.info</a>(fileNames);
fileInfo ### observe o segundo arquivo</font></div>
<div><font face="courier new, monospace">files.OK <-
fileNames[fileInfo$size>0 & !<a
moz-do-not-send="true" href="http://is.na">is.na</a>(fileInfo$size)];
files.OK</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">### Operando
arquivos baixados corretamente</font></div>
<div><font face="courier new, monospace">##############################################################################</font></div>
<div><font face="courier new, monospace">for (b in files.OK)
{</font></div>
<div><font face="courier new, monospace"> t
<- strsplit(b,"-|\\.")[[1]][2]</font></div>
<div><font face="courier new, monospace"> tempo
<- gsub("_", ":", t)</font></div>
<div><font face="courier new, monospace"> r
<- raster(b); #image(r) ### comentado para otimizar</font></div>
<div><font face="courier new, monospace"> XYZ
<- data.frame(coordinates(r), values(r), rep(tempo))</font></div>
<div><font face="courier new, monospace"> XYZ.0
<- XYZ[XYZ[,3]==0,]</font></div>
<div><font face="courier new, monospace"> outName
<- paste0('XYZ.0-', t, '.txt')</font></div>
<div><font face="courier new, monospace">
write.table(XYZ, outName, row.names=F)</font></div>
<div><font face="courier new, monospace">
message(noquote(paste(outName, "salvo em", getwd()))) </font></div>
<div><font face="courier new, monospace">}</font></div>
<div><font face="courier new, monospace">#</code></font></div>
</div>
<div><br>
</div>
<div><br>
</div>
<div class="gmail_extra"><br clear="all">
<div>
<div dir="ltr">Éder Comunello <<a
moz-do-not-send="true"
href="mailto:comunello.eder@gmail.com" target="_blank">c</a><a
moz-do-not-send="true"
href="mailto:omunello.eder@gmail.com" target="_blank">omunello.eder@gmail.com</a>>
<br>
Dourados, MS - [22 16.5'S, 54 49'W]</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
R-br mailing list
<a class="moz-txt-link-abbreviated" href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a>
<a class="moz-txt-link-freetext" 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 class="moz-txt-link-freetext" 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="moz-signature" cols="72">--
======================================================================
Alexandre dos Santos
Proteção 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>
Lattes: <a class="moz-txt-link-freetext" href="http://lattes.cnpq.br/1360403201088680">http://lattes.cnpq.br/1360403201088680</a>
======================================================================
</pre>
</body>
</html>