<div dir="ltr"><span style="color:rgb(33,33,33);font-size:13px">Dear all</span><br><div>I want to bin MODIS level 2 products for a period of time. I modified an example script given in ncl HDF examples and it is giving me only output of a single level, where the desired output is for 20 levels. I tried to add a level loop and level dimension also as shown in the script below. </div><div><div>--------------------------------------</div><div><div>  GBIN  = new ( (/nlev,nlat,mlon/), float )</div><div>  GKNT  = new ( (/nlev,nlat,mlon/), integer )</div></div><div><br></div><div>snip</div><div><br></div><div> do nf=0,nfil-1</div><div>   do lev=0,nlev-1</div><div>     print(nf+&quot;   &quot;+fili(nf))</div><div>     f       = addfile(diri+fili(nf), &quot;r&quot;)</div><div>                                            ; read data</div><div>     x          = short2flt_hdf( f-&gt;$vNam$ )</div><div>     lat2d1     = f-&gt;Latitude</div><div>     lon2d1     = f-&gt;Longitude</div><div>     lat2d      = conform(x,lat2d1,(/1,2/))</div><div>     lon2d      = conform(x,lon2d1,(/1,2/))</div><div>     level        = (/1000,950,920,850,700,620,500,400,300,250,200,100,150,100,70,50,30,20,10,5/)</div><div>     x!0          = &quot;level&quot;</div><div>     x&amp;level      = level</div><div>     nx           = product(dimsizes(x))</div><div>    bin_sum(GBIN(level,:,:),GKNT(level,:,:),lon,lat \</div><div>           ,ndtooned(lon2d),ndtooned(lat2d),ndtooned(x) )</div><div>printVarSummary(x)</div></div><div>---------------------------------------</div><div><div>but it is giving this error:</div><div>fatal:Subscript out of range, error in subscript #0</div><div>fatal:An error occurred reading GBIN</div><div><br></div><div>Can anybody help me to resolve this issue? </div><div>Please find my script and data as follows </div></div><div>Data:   MOD07_L2.A2012166.0*.hdf<br></div><div>Script:  bin.ncl</div><div><br></div><div>Any help would be appreciated</div><div>Thank You!</div></div>