<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12px"><div dir="ltr" id="yui_3_16_0_1_1417745344934_59630"><span>Humberto,</span></div><div dir="ltr" id="yui_3_16_0_1_1417745344934_59630"><span><br></span></div><div dir="ltr" id="yui_3_16_0_1_1417745344934_59630"><span>Obrigado pelo exemplo completamente reprodutível.</span></div><div dir="ltr" id="yui_3_16_0_1_1417745344934_59631"><span><br></span></div><div dir="ltr" id="yui_3_16_0_1_1417745344934_59632">O pacote ncdf não é mais atualizado pelo David Pierce e muito em breve o seu codigo pode nao mais funcionar. Use o ncdf4, que é mantido e regularmente atualizado. Ao fazer isso você terá de reformular o código, por exemplo 'open.ncdf' vira 'nc_open', mas dessa forma você garante que o seu codigo continue funcionando pelos próximos anos.</div><div dir="ltr" id="yui_3_16_0_1_1417745344934_59632"><br></div><div class="" dir="ltr" id="yui_3_16_0_1_1417745344934_60379" style="">A solucao ideal para o seu problema seria usar a funcao 'rotate' do pacote raster mas isso não é possível porque a grade do seu arquivo não é regular. Dessa forma a minha sugestão para reprojetar a longitude 'na marra' é:</div><div dir="ltr" id="yui_3_16_0_1_1417745344934_59632"><br></div><div dir="ltr" id="yui_3_16_0_1_1417745344934_59632" class="" style="">new_lon = ((lon + 180) %% 360) - 180</div><div class="" style="" dir="ltr" id="yui_3_16_0_1_1417745344934_60380"><br></div><div class="" style="" dir="ltr" id="yui_3_16_0_1_1417745344934_60379">A diferença de 0.5 grau entre o que eu recomendo e o que você espera se deve à implementação de cada software: em alguns a coordenada é do canto da grade, enquanto em outros a coordenada é do centro da grade. Ajuste o resultado conforme a sua necessidade (i.e. new_lon <- new_lon + 0.5).</div><div class="" style="" dir="ltr" id="yui_3_16_0_1_1417745344934_60379"><br></div><div class="" style="" dir="ltr" id="yui_3_16_0_1_1417745344934_60379">Por último, note também que o seu vetor de datas está incorreto porque está sendo criado de uma origem diferente da origem embebida no netcdf (ano 1900 ao invés de 1800). Uma solucao que resgata os valores de data diretamente do arquivo é a seguinte (note que as funções já são do ncdf4):<br></div><div class="" style="" dir="ltr" id="yui_3_16_0_1_1417745344934_60379"><br></div><div class="" style="" dir="ltr" id="yui_3_16_0_1_1417745344934_60379"><div class="" dir="ltr" id="yui_3_16_0_1_1417745344934_60379" style=""># get time dimension</div><div class="" dir="ltr" id="yui_3_16_0_1_1417745344934_60379" style="">t <- ncvar_get(nc,"time")</div><div class="" dir="ltr" id="yui_3_16_0_1_1417745344934_60379" style="">tunits <- ncatt_get(nc,"time","units")</div><div class="" dir="ltr" id="yui_3_16_0_1_1417745344934_60379" style=""><br class="" style=""></div><div class="" dir="ltr" id="yui_3_16_0_1_1417745344934_60379" style=""># show "real" times</div><div class="" dir="ltr" id="yui_3_16_0_1_1417745344934_60379" style="">tustr <- strsplit(tunits$value, " ") </div><div class="" dir="ltr" id="yui_3_16_0_1_1417745344934_60379" style="">tdstr <- strsplit(unlist(tustr)[3], "-")</div><div class="" dir="ltr" id="yui_3_16_0_1_1417745344934_60379" style="">tmonth <- as.integer(unlist(tdstr)[2])</div><div class="" dir="ltr" id="yui_3_16_0_1_1417745344934_60379" style="">tday <- as.integer(unlist(tdstr)[3])</div><div class="" dir="ltr" id="yui_3_16_0_1_1417745344934_60379" style="">tyear <- as.integer(unlist(tdstr)[1])</div><div class="" dir="ltr" id="yui_3_16_0_1_1417745344934_60379" style="">ndate <- as.Date(chron(t, out.format='year-month-day', origin=c(tmonth, tday, tyear)))</div></div><div></div><div id="yui_3_16_0_1_1417745344934_59896"><br></div><div id="yui_3_16_0_1_1417745344934_59896" dir="ltr">O vetor ndate serve para visualização das datas em um formato "humano", mas se você vai recriar o arquivo, provavelmente você montará a dimensao de tempo usando o vetor "t".</div><div id="yui_3_16_0_1_1417745344934_59896"> </div><div id="yui_3_16_0_1_1417745344934_59898"><div id="yui_3_16_0_1_1417745344934_59897">Saudações,<br>--<br>Thiago V. dos Santos<br>PhD student<br>Land and Atmospheric Science<br>University of Minnesota<br>http://www.laas.umn.edu/CurrentStudents/MeettheStudents/ThiagodosSantos/index.htm<br>Phone: (612) 323 9898</div></div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"> <font size="2" face="Arial"> On Thursday, December 4, 2014 8:56 PM, Humberto <hghazin@hotmail.com> wrote:<br> </font> </div> <br><br> <div class="y_msg_container"><div id="yiv7845785605"><style><!--
#yiv7845785605
_filtered #yiv7845785605 {font-family:"Cambria Math";panose-1:2 4 5 3 5 4 6 3 2 4;}
_filtered #yiv7845785605 {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;}
#yiv7845785605
#yiv7845785605 p.yiv7845785605MsoNormal, #yiv7845785605 li.yiv7845785605MsoNormal, #yiv7845785605 div.yiv7845785605MsoNormal
{margin:0in;margin-bottom:.0001pt;font-size:11.0pt;font-family:"Calibri", sans-serif;}
#yiv7845785605 a:link, #yiv7845785605 span.yiv7845785605MsoHyperlink
{color:#0563C1;text-decoration:underline;}
#yiv7845785605 a:visited, #yiv7845785605 span.yiv7845785605MsoHyperlinkFollowed
{color:#954F72;text-decoration:underline;}
#yiv7845785605 span.yiv7845785605EstiloDeEmail17
{font-family:"Calibri", sans-serif;color:windowtext;}
#yiv7845785605 .yiv7845785605MsoChpDefault
{font-family:"Calibri", sans-serif;}
_filtered #yiv7845785605 {margin:70.85pt 85.05pt 70.85pt 85.05pt;}
#yiv7845785605 div.yiv7845785605WordSection1
{}
--></style><div><div class="yiv7845785605WordSection1"><div class="yiv7845785605MsoNormal">Boa noite pessoal,</div><div class="yiv7845785605MsoNormal"> </div><div class="yiv7845785605MsoNormal">Estou extraindo de um arquivo ncdf os valores de latitude (lat) longitude( lon) e temperatura da superfície da agua do mar( SST), entretanto a longitude (lon) ela está na projeção 0 a 360 graus. Minha pergunta é como faço para converter ela para -180 a 180 graus? Segue o script que estou utilizando juntamente com o link dos dados.</div><div class="yiv7845785605MsoNormal">Desde já agradeço a ajuda </div><div class="yiv7845785605MsoNormal">Humberto </div><div class="yiv7845785605MsoNormal"> </div><table class="yiv7845785605MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="450" style="width:337.5pt;border-collapse:collapse;"><tbody><tr style="height:15.0pt;"><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal"><span style="color:black;"> lon</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal"><span style="color:black;"> lat</span></div></td><td width="77" nowrap="" valign="bottom" style="width:58.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal"><span style="color:black;"> data</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal"><span style="color:black;"> sst</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"></td><td width="117" nowrap="" valign="bottom" style="width:87.5pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal"><span style="font-size:10.0pt;font-family:"Times New Roman", serif;"> Lon como deveria ser</span></div></td></tr><tr style="height:15.0pt;"><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">299.5</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">10.5</span></div></td><td width="77" nowrap="" valign="bottom" style="width:58.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">11/30/1981</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">27.85</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;"> </span></div></td><td width="117" nowrap="" valign="bottom" style="width:87.5pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">-60.000</span></div></td></tr><tr style="height:15.0pt;"><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">300.5</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">10.5</span></div></td><td width="77" nowrap="" valign="bottom" style="width:58.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">11/30/1981</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">27.96</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;"> </span></div></td><td width="117" nowrap="" valign="bottom" style="width:87.5pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">-59.500</span></div></td></tr><tr style="height:15.0pt;"><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">301.5</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">10.5</span></div></td><td width="77" nowrap="" valign="bottom" style="width:58.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">11/30/1981</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">28.02</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;"> </span></div></td><td width="117" nowrap="" valign="bottom" style="width:87.5pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">-58.500</span></div></td></tr><tr style="height:15.0pt;"><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">302.5</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">10.5</span></div></td><td width="77" nowrap="" valign="bottom" style="width:58.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">11/30/1981</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">28.02</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;"> </span></div></td><td width="117" nowrap="" valign="bottom" style="width:87.5pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">-57.500</span></div></td></tr><tr style="height:15.0pt;"><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">303.5</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">10.5</span></div></td><td width="77" nowrap="" valign="bottom" style="width:58.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">11/30/1981</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">27.97</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;"> </span></div></td><td width="117" nowrap="" valign="bottom" style="width:87.5pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">-56.500</span></div></td></tr><tr style="height:15.0pt;"><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">304.5</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">10.5</span></div></td><td width="77" nowrap="" valign="bottom" style="width:58.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">11/30/1981</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">27.84</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;"> </span></div></td><td width="117" nowrap="" valign="bottom" style="width:87.5pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">-55.500</span></div></td></tr><tr style="height:15.0pt;"><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">305.5</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">10.5</span></div></td><td width="77" nowrap="" valign="bottom" style="width:58.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">11/30/1981</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">27.81</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;"> </span></div></td><td width="117" nowrap="" valign="bottom" style="width:87.5pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">-54.500</span></div></td></tr><tr style="height:15.0pt;"><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">306.5</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">10.5</span></div></td><td width="77" nowrap="" valign="bottom" style="width:58.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">11/30/1981</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">27.78</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;"> </span></div></td><td width="117" nowrap="" valign="bottom" style="width:87.5pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">-53.500</span></div></td></tr><tr style="height:15.0pt;"><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">307.5</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">10.5</span></div></td><td width="77" nowrap="" valign="bottom" style="width:58.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">11/30/1981</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">27.75</span></div></td><td width="64" nowrap="" valign="bottom" style="width:48.0pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;"> </span></div></td><td width="117" nowrap="" valign="bottom" style="width:87.5pt;padding:0in 3.5pt 0in 3.5pt;height:15.0pt;"><div class="yiv7845785605MsoNormal" align="right" style="text-align:right;"><span style="color:black;">-52.500</span></div></td></tr></tbody></table><div class="yiv7845785605MsoNormal"> </div><div class="yiv7845785605MsoNormal"> </div><div class="yiv7845785605MsoNormal">Link para acesso dos dados <a rel="nofollow" target="_blank" href="https://www.dropbox.com/s/xnab2g365mduykx/SST_81_14.nc?dl=0">https://www.dropbox.com/s/xnab2g365mduykx/SST_81_14.nc?dl=0</a></div><div class="yiv7845785605MsoNormal"> </div><div class="yiv7845785605MsoNormal">Script:</div><div class="yiv7845785605MsoNormal"><span lang="EN-US">require(ncdf) #'ncdf' versao 1.6.6</span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US">require(reshape)</span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US">require(chron)</span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US"> </span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US">###sst</span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US">nc <- open.ncdf("SST_81_14.nc")</span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US">nc</span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US"> </span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US">lat <- get.var.ncdf(nc, "lat")</span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US">lon <- get.var.ncdf(nc, "lon")</span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US">tunits <- att.get.ncdf(nc,"time","units")</span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US"> </span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US"># print tunits</span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US">tunits$value</span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US"> </span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US"># criar tempo "real" Times</span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US">time<- get.var.ncdf(nc,"time")</span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US">Time<-chron(time,origin=c(month=1, day=1, year=1900))</span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US"> </span></div><div class="yiv7845785605MsoNormal">## array da variavel sst</div><div class="yiv7845785605MsoNormal">wm <- get.var.ncdf(nc, "sst")</div><div class="yiv7845785605MsoNormal">str(wm)</div><div class="yiv7845785605MsoNormal"> </div><div class="yiv7845785605MsoNormal">## atribuindo dimnames conforme lon, lat e tempo</div><div class="yiv7845785605MsoNormal"><span lang="EN-US">dimnames(wm)[[1]] <- as.character(lon)</span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US">dimnames(wm)[[2]] <- as.character(lat)</span></div><div class="yiv7845785605MsoNormal"><span lang="EN-US">dimnames(wm)[[3]] <- as.character(Time)</span></div><div class="yiv7845785605MsoNormal">str(wm)</div><div class="yiv7845785605MsoNormal"> </div><div class="yiv7845785605MsoNormal">## melt para reestruturação dos dados</div><div class="yiv7845785605MsoNormal">mwm <- melt(wm)</div><div class="yiv7845785605MsoNormal">head(mwm)</div></div></div></div><br>_______________________________________________<br>R-br mailing list<br><a ymailto="mailto:R-br@listas.c3sl.ufpr.br" href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br><a 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 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><br></div> </div> </div> </div> </div></body></html>