<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thank you so much Adam<div class=""><br class=""></div><div class="">I got the netCDF operators and it works perfect!</div><div class=""><br class=""></div><div class="">Sun-</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 22, 2015, at 7:34 AM, Adam Phillips &lt;<a href="mailto:asphilli@ucar.edu" class="">asphilli@ucar.edu</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Sun,<div class="">If you do want to create a netCDF file for each month from your files that contain 12 months of data, I would use the netCDF operators:</div><div class=""><br class=""></div><div class="">; Note: Script not tested, check that the results are as you would expect.</div><div class=""><br class=""></div><div class="">begin</div><div class=""><br class=""></div><div class="">year = (/"2007","2008","2009","2010","2011","2012","2013"/)</div><div class="">varname = "MFLUX_GDS0_ISBL_S130"<br class=""></div><div class="">diri &nbsp; &nbsp;= "/Users/spark/vertical/00_DATA/20_JRA-55/"<br class=""></div><div class="">filo =&nbsp;"fcst_phy3m125.231_mflux."</div><div class="">do gg = 0,dimsizes(year)-1</div><div class="">&nbsp; &nbsp; &nbsp;<span style="font-size:12.8px" class="">fili &nbsp; &nbsp;= "fcst_phy3m125.231_mflux."+</span><span style="font-size:12.8px" class="">year(gg)+"01_"+year(gg)+"12. &nbsp;</span><span style="font-size:12.8px" class=""><a href="http://allen136024.nc/" class="">allen136024.nc</a>"</span></div><div class="">&nbsp; &nbsp; &nbsp;do hh = 1,12</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;en = sprinti("%2.2i",hh))&nbsp;</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;print("ncks -v "+varname+" -d time,"+(hh-1)+","+(hh-1)+" "+diri+fili+" "+filo+year(gg)+en+".nc")</div><div class="">; &nbsp; &nbsp; system("ncks -v "+varname+"-d time,"+(hh-1)+","+(hh-1)+" "+diri+fili+" "+diri+filo+year(gg)+en+".nc")</div><div class="">&nbsp; &nbsp; &nbsp;end do</div><div class="">&nbsp; &nbsp; &nbsp;print("Now done with year = "+year(gg))</div><div class="">end do</div><div class=""><br class=""></div><div class="">end</div><div class=""><br class=""></div><div class="">If the print statements look good, then you could uncomment out the system statement.</div><div class=""><br class=""></div><div class="">Hope that helps.. If not, or if I totally misunderstood what you are after, please respond to the ncl-talk email list and not to me personally.</div><div class="">Adam</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">&nbsp;</div><div class="">&nbsp; &nbsp;&nbsp;</div><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Oct 20, 2015 at 11:59 PM, mireiyue <span dir="ltr" class="">&lt;<a href="mailto:mireiyue@gmail.com" target="_blank" class="">mireiyue@gmail.com</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Dear NCL users<div class=""><br class=""></div><div class="">I have a file it contains 12 months data (ec550aer_aero_NorESM1-M_historicalExt_r1i1p1_<b class="">201201-201212</b>.nc). I want to make file for each month. What nil function I should use? I tried to use reshape but It gives me&nbsp;</div><div class="">fatal:_NclBuildArray: each element of a literal array must have the same dimension sizes, at least one item doesn’t (near L30). If I made mistake in the script please help me what I did wrong or if I have to use other function.</div><div class=""><br class=""></div><div class="">I do appreciate any helps.&nbsp;</div><div class=""><br class=""></div><div class="">year = (/"2007","2008","2009","2010","2011","2012","2013"/)</div><div class="">diri &nbsp; &nbsp;= "/Users/spark/vertical/00_DATA/20_JRA-55/" &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; path to file</div><div class="">do ii=0,6</div><div class=""><br class=""></div><div class="">&nbsp; fili &nbsp; &nbsp;= "fcst_phy3m125.231_mflux."+year(ii)+"01_"+year(ii)+"12.allen136024"</div><div class="">&nbsp; varname = "MFLUX_GDS0_ISBL_S130"</div><div class="">&nbsp; filenc &nbsp; &nbsp; &nbsp; = addfile (diri+fili+".nc", "r") &nbsp; &nbsp; &nbsp;; entire file</div><div class="">&nbsp; mf &nbsp; = filenc-&gt;$varname$ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; (time, ver, lat, lon)</div><div class=""><br class=""></div><div class="">&nbsp; time =filenc-&gt;initial_time0</div><div class="">&nbsp; lev =filenc-&gt;lv_ISBL1</div><div class="">&nbsp; lat =filenc-&gt;g0_lat_2</div><div class="">&nbsp; lon =filenc-&gt;g0_lon_3</div><div class="">&nbsp; mf@_FillValue=1e+20</div><div class=""><br class=""></div><div class="">printVarSummary(mf)</div><div class=""><br class=""></div><div class="">&nbsp; ntim = dimsizes(time)</div><div class="">&nbsp; nlev = dimsizes(lev)</div><div class="">&nbsp; nlat = dimsizes(lat)</div><div class="">&nbsp; nlon = dimsizes(lon)</div><div class="">&nbsp; nyears = ntim/12</div><div class=""><br class=""></div><div class=""><b class="">&nbsp; mfreshape = reshape(mf,(/nyears,12,nlev,nlat,nlon/)) &nbsp;:an error occurs here</b></div><div class="">&nbsp; printVarSummary(mfreshape) &nbsp;</div><div class=""><br class=""></div><div class="">Thank you</div><div class="">Sun-</div><div class=""><br class=""></div></div><br class="">_______________________________________________<br class="">
ncl-talk mailing list<br class="">
<a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a><br class="">
List instructions, subscriber options, unsubscribe:<br class="">
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank" class="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br class="">
<br class=""></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div class=""><div class=""><span class=""><font color="#888888" class="">Adam Phillips <br class=""></font></span></div><span class=""><font color="#888888" class="">Associate Scientist,&nbsp; </font></span><span class=""><font color="#888888" class="">Climate and Global Dynamics Laboratory, NCAR<br class=""></font></span></div></div><div class=""><span class=""><font color="#888888" class=""><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank" class="">www.cgd.ucar.edu/staff/asphilli/</a>&nbsp;&nbsp; </font></span><span class=""><font color="#888888" class="">303-497-1726 </font></span></div><span class=""><font color="#888888" class=""></font></span><div class=""><div class=""><span class=""><font color="#888888" class=""><br class=""></font></span><div class=""><span class=""><font color="#888888" class=""><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank" class=""></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div>
</div></blockquote></div><br class=""></div></body></html>