<div dir="ltr">Hi Sunmin,<div><br></div><div>I believe you are trying to reshape a string. varname = <font face="arial, sans-serif">"ec550aer” which is one dimensional. Don't you want to reshape the actual data array? Reshape only works on numerical data (of any type though), so maybe that's the cause of your error.</font></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">So try something like this:</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">ecreshape = reshape(data,(/nyears,12,nlev,nlat,nlon/))</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px">Hope this helps,</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><font face="arial, sans-serif">Maria</font></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 24, 2014 at 11:26 AM, Sunmin Park <span dir="ltr"><<a href="mailto:mireiyue@gmail.com" target="_blank">mireiyue@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Dear all nil users<span style="white-space:pre-wrap">        </span><div><br></div><div>I am trying to get plots from each month and year. One file contains all 7 years and 12 months values. So, I used reshape but I got a problem. I try to follow the reshape example in the website but it is not working. How can I fix it?</div>
<div><br></div><div>Thank you for any help</div><div>Sun-</div><div><br></div><div>This is what I got </div><div><br></div><div>fatal:Argument type mismatch on argument (0) of (reshape) can not coerce</div><div>fatal:["Execute.c":7743]:Execute: Error occurred at or near line 53 in file CMIP5_ec.ncl</div>
<div><br></div><div><br></div><div>; ==============================================================</div><div>; Open the file:</div><div>; ==============================================================</div><div> fili = "ec550aer_aero_NorESM1-M_historicalExt_"+version(ii)+"<a href="http://i1p1_200601-201212.nc" target="_blank">i1p1_200601-201212.nc</a>"</div>
<div> varname = "ec550aer” </div><div><div> filenc = addfile (diri+fili+".nc", "r") ; entire file</div><div>; print (varname)</div><div>; print (filenc)</div><div><br></div><div> data = filenc->$varname$ ; (time, ver, lat, lon)</div>
<div>; print (dimsizes(data))</div><div> time =filenc->time</div><div> lev =filenc->lev</div><div> lat =filenc->lat</div><div> lon =filenc->lon</div><div> data@_FillValue= 0</div><div><br></div><div>; printVarSummary(data)</div>
<div>; print(dimsizes(time))</div><div>; return</div><div><br></div><div> ntim = dimsizes(time)</div></div><div><div> nlev = dimsizes(lev)</div><div> nlat = dimsizes(lat)</div><div> nlon = dimsizes(lon)</div><div> nyears = ntim/12</div>
<div><br></div><div>; printVarSummary(ntim)</div><div>; printVarSummary(nyears)</div><div>; print(ntim)</div><div>; print(nyears)</div><div><br></div><div> <font color="#e32400">ecreshape = reshape(varname,(/nyears,12,nlev,nlat,nlon/))</font></div>
<div>; reec550nm = reshape(ecreshape(:,0:2,:,:,:),(/nyears*12,nlev,nlat,nlon/))</div><div> printVarSummary(ecreshape)</div><div>; printVarSummary(ec550nm)</div><div> return</div><div><br></div></div><div><br></div></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>