<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 <<a href="mailto:asphilli@ucar.edu" class="">asphilli@ucar.edu</a>> 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 = "/Users/spark/vertical/00_DATA/20_JRA-55/"<br class=""></div><div class="">filo = "fcst_phy3m125.231_mflux."</div><div class="">do gg = 0,dimsizes(year)-1</div><div class=""> <span style="font-size:12.8px" class="">fili = "fcst_phy3m125.231_mflux."+</span><span style="font-size:12.8px" class="">year(gg)+"01_"+year(gg)+"12. </span><span style="font-size:12.8px" class=""><a href="http://allen136024.nc/" class="">allen136024.nc</a>"</span></div><div class=""> do hh = 1,12</div><div class=""> en = sprinti("%2.2i",hh)) </div><div class=""> print("ncks -v "+varname+" -d time,"+(hh-1)+","+(hh-1)+" "+diri+fili+" "+filo+year(gg)+en+".nc")</div><div class="">; system("ncks -v "+varname+"-d time,"+(hh-1)+","+(hh-1)+" "+diri+fili+" "+diri+filo+year(gg)+en+".nc")</div><div class=""> end do</div><div class=""> 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=""> </div><div class=""> </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=""><<a href="mailto:mireiyue@gmail.com" target="_blank" class="">mireiyue@gmail.com</a>></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 </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. </div><div class=""><br class=""></div><div class="">year = (/"2007","2008","2009","2010","2011","2012","2013"/)</div><div class="">diri = "/Users/spark/vertical/00_DATA/20_JRA-55/" ; path to file</div><div class="">do ii=0,6</div><div class=""><br class=""></div><div class=""> fili = "fcst_phy3m125.231_mflux."+year(ii)+"01_"+year(ii)+"12.allen136024"</div><div class=""> varname = "MFLUX_GDS0_ISBL_S130"</div><div class=""> filenc = addfile (diri+fili+".nc", "r") ; entire file</div><div class=""> mf = filenc->$varname$ ; (time, ver, lat, lon)</div><div class=""><br class=""></div><div class=""> time =filenc->initial_time0</div><div class=""> lev =filenc->lv_ISBL1</div><div class=""> lat =filenc->g0_lat_2</div><div class=""> lon =filenc->g0_lon_3</div><div class=""> mf@_FillValue=1e+20</div><div class=""><br class=""></div><div class="">printVarSummary(mf)</div><div class=""><br class=""></div><div class=""> ntim = dimsizes(time)</div><div class=""> nlev = dimsizes(lev)</div><div class=""> nlat = dimsizes(lat)</div><div class=""> nlon = dimsizes(lon)</div><div class=""> nyears = ntim/12</div><div class=""><br class=""></div><div class=""><b class=""> mfreshape = reshape(mf,(/nyears,12,nlev,nlat,nlon/)) :an error occurs here</b></div><div class=""> printVarSummary(mfreshape) </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, </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> </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>