[ncl-talk] Binning multilevel MODIS data using bin_sum

Rick Brownrigg brownrig at ucar.edu
Thu Apr 21 09:26:53 MDT 2016


Hi,

I'm not totally sure, but I wonder if "level" in this line should be "lev"?

bin_sum(GBIN(level,:,:),GKNT(level,:,:),lon,lat \

In any case, a few strategic print() statements on your indexing variables
will show where/when thing go arwy.

HTH...
Rick


On Thu, Apr 21, 2016 at 7:10 AM, AJILESH PP <ajileshparolla at gmail.com>
wrote:

> Dear all
> 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.
> --------------------------------------
>   GBIN  = new ( (/nlev,nlat,mlon/), float )
>   GKNT  = new ( (/nlev,nlat,mlon/), integer )
>
> snip
>
>  do nf=0,nfil-1
>    do lev=0,nlev-1
>      print(nf+"   "+fili(nf))
>      f       = addfile(diri+fili(nf), "r")
>                                             ; read data
>      x          = short2flt_hdf( f->$vNam$ )
>      lat2d1     = f->Latitude
>      lon2d1     = f->Longitude
>      lat2d      = conform(x,lat2d1,(/1,2/))
>      lon2d      = conform(x,lon2d1,(/1,2/))
>      level        =
> (/1000,950,920,850,700,620,500,400,300,250,200,100,150,100,70,50,30,20,10,5/)
>      x!0          = "level"
>      x&level      = level
>      nx           = product(dimsizes(x))
>     bin_sum(GBIN(level,:,:),GKNT(level,:,:),lon,lat \
>            ,ndtooned(lon2d),ndtooned(lat2d),ndtooned(x) )
> printVarSummary(x)
> ---------------------------------------
> but it is giving this error:
> fatal:Subscript out of range, error in subscript #0
> fatal:An error occurred reading GBIN
>
> Can anybody help me to resolve this issue?
> Please find my script and data as follows
> Data:   MOD07_L2.A2012166.0*.hdf
> Script:  bin.ncl
>
> Any help would be appreciated
> Thank You!
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160421/4946acc1/attachment.html 


More information about the ncl-talk mailing list