# [ncl-talk] is there a function similar with bin_sum?

Yun Yue yunyue at huskers.unl.edu
Mon Apr 4 10:50:45 MDT 2016

```Hi Mary,

Hi Mary,

Thank you so much for detail explanation. Actually I've already speed up the code by using WRAPIT.

Thank you.

Yun

________________________________
From: Mary Haley <haley at ucar.edu>
Sent: Monday, April 4, 2016 11:45 AM
To: Yun Yue
Cc: ncl-talk at ucar.edu
Subject: Re: [ncl-talk] is there a function similar with bin_sum?

Yun,

I'm sorry somebody didn't get back to you sooner.

I don't know much about bin_sum, but I'm pretty sure we don't have a curvilinear version.

However, you might be able to speed up your loop calculations simply by getting rid of the loop entirely or moving as much of the code out of the loop as possible. You can take advantage of NCL's array arithmetic capabilities, which could significantly speed up your routine. If you could send us the loop snippet, then we'll see if it can be improved.

Or, if you need to go the Fortran route, then you can use WRAPIT:

https://www.ncl.ucar.edu/Document/Tools/WRAPIT.shtml

--Mary

On Tue, Mar 29, 2016 at 4:35 PM, Yun Yue <yunyue at huskers.unl.edu<mailto:yunyue at huskers.unl.edu>> wrote:

Hi NCL users,

I want to read many MODIS files. For each satellite pixel, find the nearest WRF grid based on lat, lon information (used function ind here to reduce the calculation time), then assign the MODIS data to this WRF grid.

I found that using loop in NCL to calculate each satellite pixel's distance to the WRF grid is very slow.

One way I'm thinking to solve this is to use FORTRAN in the NCL to do the loop part.

I also found NCL has a function bin_sum to calculate binned sums and counts on a rectilinear grid which is very fast. Is there a similar function in NCL like bin_sum but for curvilinear grid?

Thanks very much,

Yun

_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto: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/20160404/591ea7ef/attachment.html
```