<div dir="ltr"><div><div><div><div>Hi,<br><br></div>I'm not totally sure, but I wonder if "level" in this line should be "lev"?<br><br>bin_sum(GBIN(level,:,:),GKNT(level,:,:),lon,lat \<br><br></div>In any case, a few strategic print() statements on your indexing variables will show where/when thing go arwy.<br><br></div>HTH...<br></div>Rick<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 21, 2016 at 7:10 AM, AJILESH PP <span dir="ltr"><<a href="mailto:ajileshparolla@gmail.com" target="_blank">ajileshparolla@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 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+" "+fili(nf))</div><div> f = addfile(diri+fili(nf), "r")</div><div> ; read data</div><div> x = short2flt_hdf( f->$vNam$ )</div><div> lat2d1 = f->Latitude</div><div> lon2d1 = f->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 = "level"</div><div> x&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>
<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></div>