<div dir="ltr">Hi Sun,<div>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><br></div><div>; Note: Script not tested, check that the results are as you would expect.</div><div><br></div><div>begin</div><div><br></div><div>year = (/&quot;2007&quot;,&quot;2008&quot;,&quot;2009&quot;,&quot;2010&quot;,&quot;2011&quot;,&quot;2012&quot;,&quot;2013&quot;/)</div><div>varname = &quot;MFLUX_GDS0_ISBL_S130&quot;<br></div><div>diri    = &quot;/Users/spark/vertical/00_DATA/20_JRA-55/&quot;<br></div><div>filo = &quot;fcst_phy3m125.231_mflux.&quot;</div><div>do gg = 0,dimsizes(year)-1</div><div>     <span style="font-size:12.8px">fili    = &quot;fcst_phy3m125.231_mflux.&quot;+</span><span style="font-size:12.8px">year(gg)+&quot;01_&quot;+year(gg)+&quot;12.  </span><span style="font-size:12.8px"><a href="http://allen136024.nc">allen136024.nc</a>&quot;</span></div><div>     do hh = 1,12</div><div>         en = sprinti(&quot;%2.2i&quot;,hh)) </div><div>         print(&quot;ncks -v &quot;+varname+&quot; -d time,&quot;+(hh-1)+&quot;,&quot;+(hh-1)+&quot; &quot;+diri+fili+&quot; &quot;+filo+year(gg)+en+&quot;.nc&quot;)</div><div>;     system(&quot;ncks -v &quot;+varname+&quot;-d time,&quot;+(hh-1)+&quot;,&quot;+(hh-1)+&quot; &quot;+diri+fili+&quot; &quot;+diri+filo+year(gg)+en+&quot;.nc&quot;)</div><div>     end do</div><div>     print(&quot;Now done with year = &quot;+year(gg))</div><div>end do</div><div><br></div><div>end</div><div><br></div><div>If the print statements look good, then you could uncomment out the system statement.</div><div><br></div><div>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>Adam</div><div><br></div><div><br></div><div> </div><div>    </div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 20, 2015 at 11:59 PM, mireiyue <span dir="ltr">&lt;<a href="mailto:mireiyue@gmail.com" target="_blank">mireiyue@gmail.com</a>&gt;</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 NCL users<div><br></div><div>I have a file it contains 12 months data (ec550aer_aero_NorESM1-M_historicalExt_r1i1p1_<b>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>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><br></div><div>I do appreciate any helps. </div><div><br></div><div>year = (/&quot;2007&quot;,&quot;2008&quot;,&quot;2009&quot;,&quot;2010&quot;,&quot;2011&quot;,&quot;2012&quot;,&quot;2013&quot;/)</div><div>diri    = &quot;/Users/spark/vertical/00_DATA/20_JRA-55/&quot;                    ; path to file</div><div>do ii=0,6</div><div><br></div><div>  fili    = &quot;fcst_phy3m125.231_mflux.&quot;+year(ii)+&quot;01_&quot;+year(ii)+&quot;12.allen136024&quot;</div><div>  varname = &quot;MFLUX_GDS0_ISBL_S130&quot;</div><div>  filenc       = addfile (diri+fili+&quot;.nc&quot;, &quot;r&quot;)      ; entire file</div><div>  mf   = filenc-&gt;$varname$                          ; (time, ver, lat, lon)</div><div><br></div><div>  time =filenc-&gt;initial_time0</div><div>  lev =filenc-&gt;lv_ISBL1</div><div>  lat =filenc-&gt;g0_lat_2</div><div>  lon =filenc-&gt;g0_lon_3</div><div>  mf@_FillValue=1e+20</div><div><br></div><div>printVarSummary(mf)</div><div><br></div><div>  ntim = dimsizes(time)</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><b>  mfreshape = reshape(mf,(/nyears,12,nlev,nlat,nlon/))  :an error occurs here</b></div><div>  printVarSummary(mfreshape)  </div><div><br></div><div>Thank you</div><div>Sun-</div><div><br></div></div><br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist,  </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a>   </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div>