<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Ótima Rotina Éder!!!!!<br>
<br>
Acho que tem que trocar <font face="monospace, monospace">download.file(url1,
fn, mode="wb") </font>por <font face="monospace, monospace">download.file(url0,
fn, mode="wb")</font><br>
<br>
Mais uma outra coisa, se eu trocar o formato nc e no meu caso,
que são geoTiff por *asc não tornaria essa operação mais rápida e
menos sujeita a restrições de limite de memória?<br>
<br>
<br>
Obrigado,<br>
<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>
OrcID: orcid.org/0000-0001-8232-6722
Researchgate: <a class="moz-txt-link-freetext" href="https://www.researchgate.net/profile/Alexandre_Santos10">https://www.researchgate.net/profile/Alexandre_Santos10</a>
LinkedIn: <a class="moz-txt-link-freetext" href="https://br.linkedin.com/in/alexandre-dos-santos-87961635">https://br.linkedin.com/in/alexandre-dos-santos-87961635</a>
======================================================================
</pre>
<div class="moz-cite-prefix">Em 16/02/2016 08:24, Éder Comunello
escreveu:<br>
</div>
<blockquote
cite="mid:CABmC8gmCNbTyYBC_ADAcafxxrZp7P6ANF0NwW+L1iL_efqDz=A@mail.gmail.com"
type="cite">
<div class="gmail_default"><font face="monospace, monospace">###
<code r></font></div>
<div class="gmail_default" style="">
<div class="gmail_default"><font face="monospace, monospace">setwd("D:/Temp")</font></div>
<div class="gmail_default"><font face="monospace, monospace">sapply(c("raster",
"sp", "ncdf4"), require, char=T)</font></div>
<div class="gmail_default"><font face="monospace, monospace">url0
<- "<a moz-do-not-send="true"
href="https://drive.google.com/file/d/0B6tnaf2fmoCcOXhnRDIxWnM5UDA/view">https://drive.google.com/file/d/0B6tnaf2fmoCcOXhnRDIxWnM5UDA/view</a>"</font></div>
<div class="gmail_default"><font face="monospace, monospace">browseURL(url0)
### 266 Mb</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">dir(patt="\\.nc")</font></div>
<div class="gmail_default"><font face="monospace, monospace">fn
<- "Rs_daily_UT_Brazil_v2_20070101_20131231.nc"</font></div>
<div class="gmail_default"><font face="monospace, monospace">download.file(url1,
fn, mode="wb")</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">#
nc <- nc_open(fn); names(nc[['var']]) ### inspeção de
conteúdo</font></div>
<div class="gmail_default"><font face="monospace, monospace"># r
<- raster(fn); dim(r); object.size(r) ### importará
somente primeiro layer</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">s
<- stack(fn, varname="Rs")</font></div>
<div class="gmail_default"><font face="monospace, monospace">dim(s);
print(object.size(s), units="Mb") ### 2557 layers (datas),
30.4 Mb</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">POI
<- SpatialPoints(cbind(lon=c(-47.5,-47.5,-44.5,-40),
lat=c(-18.5,-19.5,-20.5,-22)))</font></div>
<div class="gmail_default"><font face="monospace, monospace">proj4string(POI)
<- proj4string(s)</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">e
<- extract(s, POI, method= "bilinear", df=T) #ou
method="simple"</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">dim(e);
head(e[,1:5])</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">e2
<- t(e[-1]) ### inverte, retirando a primeira coluna (ID)</font></div>
<div class="gmail_default"><font face="monospace, monospace">dim(e2)
### [1] 2557 4</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">head(e2,
3)</font></div>
<div class="gmail_default"><font face="monospace, monospace">#
[,1] [,2] [,3] [,4]</font></div>
<div class="gmail_default"><font face="monospace, monospace">#
X2007.01.01 11.67222 12.36980 8.660182 NA</font></div>
<div class="gmail_default"><font face="monospace, monospace">#
X2007.01.02 17.28591 14.08362 9.963414 NA</font></div>
<div class="gmail_default"><font face="monospace, monospace">#
X2007.01.03 15.78652 12.72562 10.278209 NA</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">tail(e2,
3)</font></div>
<div class="gmail_default"><font face="monospace, monospace">#
[,1] [,2] [,3] [,4]</font></div>
<div class="gmail_default"><font face="monospace, monospace">#
X2013.12.29 23.22835 23.38377 19.95641 NA</font></div>
<div class="gmail_default"><font face="monospace, monospace">#
X2013.12.30 18.80989 21.45013 16.14789 NA</font></div>
<div class="gmail_default"><font face="monospace, monospace">#
X2013.12.31 19.01340 17.74833 20.40014 NA</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">###
Comparação de métodos de extração (utilizando primeiro
layer)</font></div>
<div class="gmail_default"><font face="monospace, monospace">sp1
<- as(s[[1]], "SpatialPixelsDataFrame")</font></div>
<div class="gmail_default"><font face="monospace, monospace">over(POI,
sp1)[,1]</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">data.frame(POI@coords, </font></div>
<div class="gmail_default"><font face="monospace, monospace">
over = over(POI, sp1)[,1], </font></div>
<div class="gmail_default"><font face="monospace, monospace">
bil = extract(s[[1]], POI, method= "bilinear",
df=T)[,2],</font></div>
<div class="gmail_default"><font face="monospace, monospace">
simp = extract(s[[1]], POI, method= "simple",
df=T)[,2])</font></div>
<div class="gmail_default"><font face="monospace, monospace">#
lon lat over bil simp</font></div>
<div class="gmail_default"><font face="monospace, monospace"># 1
-47.5 -18.5 11.586952 11.672215 11.639958</font></div>
<div class="gmail_default"><font face="monospace, monospace"># 2
-47.5 -19.5 12.564141 12.369798 11.964512</font></div>
<div class="gmail_default"><font face="monospace, monospace"># 3
-44.5 -20.5 8.624653 8.660182 7.975467</font></div>
<div class="gmail_default"><font face="monospace, monospace"># 4
-40.0 -22.0 NA NA NaN</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">###
Visualizando os dois primeiros pontos</font></div>
<div class="gmail_default"><font face="monospace, monospace">crop
<- crop(s[[1]], extent(-48, -47, -20, -18))</font></div>
<div class="gmail_default"><font face="monospace, monospace">image(crop,
asp=T)</font></div>
<div class="gmail_default"><font face="monospace, monospace">text(crop,
lab=round(getValues(crop), 6), cex=.5); points(POI, pch=20,
cex=2)</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">###
over pega à esquerda, simple à direita e bilinear interpola.</font></div>
<div class="gmail_default"><span
style="font-family:monospace,monospace">### </code></span><br>
</div>
<div class="gmail_default"><span
style="font-family:monospace,monospace"><br>
</span></div>
</div>
</blockquote>
<br>
</body>
</html>