<div dir="ltr">Hi Debasish:<div><br></div><div>You can easily turn your target grid into a 2D array.</div><div><br></div><div><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/onedtond.shtml">https://www.ncl.ucar.edu/Document/Functions/Built-in/onedtond.shtml</a><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Oct 18, 2020 at 11:36 PM Dave Allured - NOAA Affiliate via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">Debasish,<div><br></div><div>Sorry, you originally said "I have ... 2d lat, lon grid" and I misunderstood what that meant. See other answers from Barry and Dennis. If you need more help, please show printVarSummary for your input variables x, lat, and lon, so we can be clear about what type of input data you have.</div></div></div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Oct 18, 2020 at 11:32 AM Paimazumder, Debasish <<a href="mailto:Debasish.Paimazumder@aig.com" target="_blank">Debasish.Paimazumder@aig.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="auto">
Dave- <span style="color:rgb(0,0,0)">getind_latlon2d needs two-dimensional lat/lon while my output grid 1-d lat/lon. </span>
<div><font color="#000000"><span>Interpolation from location to 1-d grid could be an option but we won’t get the accumulation (sum) at the output grid.<br>
</span></font><br>
<div dir="ltr">Best regards,
<div>Dave</div>
</div>
<div dir="ltr"><br>
<blockquote type="cite">On Oct 18, 2020, at 12:54 PM, Barry Lynn <<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</a>> wrote:</blockquote></div><blockquote type="cite"><div dir="ltr">
<div dir="ltr">Right, that can be done. Or, you can interpolate the data from the fine to coarse grid.
<div><br>
</div>
<div>I am not sure if the latter will conserve the averages like doing the averaging in a loop.</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sun, Oct 18, 2020 at 6:58 PM Dave Allured - NOAA Affiliate via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">Use the function <b>getind_latlon2d</b> to get the (i,j) grid point indices for the point data coordinates. Then do a single loop over the point data to accumulate sums and counts on the output grid.
<div><br>
<div dir="ltr"><br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sun, Oct 18, 2020 at 9:09 AM Paimazumder, Debasish via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="auto">Hi Barry,
<div>Thanks for your response. Actually I don’t have time dimension. I have location level data (at high resolution).</div>
<div>For example, x(m) with lat(m) and lon (m) where m = 300k location </div>
<div><br>
</div>
<div>My output grid is 32x32 km and I would like to do following </div>
<div>1. Estimate the number of locations are in each 32x32 km grid</div>
<div>2. Accumulate (sum) the x at each output grid.</div>
<div>For example- if I have 100 locations at one of the 32x32km grid, I will sum all x from 100 locations and assign the sum to the output grid.<br>
<br>
<div dir="ltr">Best regards,
<div>Dave</div>
</div>
<div dir="ltr"><br>
<blockquote type="cite">On Oct 18, 2020, at 3:50 AM, Barry Lynn <<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</a>> wrote:<br>
</blockquote>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">Hi:
<div><br>
</div>
<div>If you have two grids of the same dimensions, but different times, you can simply add them together.</div>
<div><br>
</div>
<div>If you have grids of a different size, you can interpolate the data to this grid, one grid at a time.</div>
<div><br>
</div>
<div>See for example:</div>
<div><br>
</div>
<div><a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__www.ncl.ucar.edu_Applications_regrid.shtml&d=DwMFaQ&c=kn4_INW_mBCDHV_xJEVJkg&r=fpudUXThXLQwAKQPDCnmVaSzm2dwE9OxcWi7MuJ0jbo&m=IaFm8AuXStzIPZXMbIRmp6fjt5zy74eAUUQzoQb5pBc&s=tUIMDu-yehcnE2-mHTaX2NhZiAg5eBHJsqf3e1Bmbl8&e=" target="_blank">https://www.ncl.ucar.edu/Applications/regrid.shtml</a><br>
</div>
<div><br>
</div>
<div>This may also help.</div>
<div><br>
</div>
<div><a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__www.ncl.ucar.edu_Document_Functions_Built-2Din_dim-5Fsum-5Fn.shtml&d=DwMFaQ&c=kn4_INW_mBCDHV_xJEVJkg&r=fpudUXThXLQwAKQPDCnmVaSzm2dwE9OxcWi7MuJ0jbo&m=IaFm8AuXStzIPZXMbIRmp6fjt5zy74eAUUQzoQb5pBc&s=4tdKFBxFBOUpMYFj95WyO8MUdUcYRniTWsJIvCCbhAE&e=" target="_blank">https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_sum_n.shtml</a><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sun, Oct 18, 2020 at 7:59 AM Paimazumder, Debasish via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div>
<p class="MsoNormal">Hi NCL users<u></u><u></u></p>
<p class="MsoNormal">I have location level data and 2d lat, lon grid and I’m trying to accumulate the data on 2d lat, lon grid.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">For example <u></u><u></u></p>
<p class="MsoNormal">Input - x (n) with lat(n), lon(n)<u></u><u></u></p>
<p class="MsoNormal">Output grid - lat(i)xlon(j)<u></u><u></u></p>
<p class="MsoNormal">I’m trying to estimate number of location within each grid and accumulate x at each grid.
<u></u><u></u></p>
<p class="MsoNormal">Is there any function in NCL that will solve this problem?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">With regards<u></u><u></u></p>
<p class="MsoNormal">-Debasish <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><b><span style="font-size:12pt;color:rgb(0,176,240)">Debasish PaiMazumder, PhD |</span></b><span style="font-size:12pt;color:rgb(102,102,102)">Tel
<a href="tel:%2B1%20215%20255%206371" target="_blank"><span style="color:blue">+1 215 255 6052</span></a> | Cell
<a href="tel:%2B1%20718%20913%206946" target="_blank"><span style="color:blue">+1 267 449 5226</span></a> |</span><u><span style="font-size:12pt;color:blue"><a href="mailto:Debasish.Paimazumder@aig.com" target="_blank">Debasish.Paimazumder@aig.com</a></span></u></p></div></div></blockquote></div></div></blockquote></div></div></blockquote></div></div></div></div></blockquote></div>
</div>
</blockquote>
</div>
</div>
</blockquote></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Associate Scientist, Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br><br></div></div></div></div></div>