<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Thanks a lot, Adam!<div class=""><br class=""></div><div class="">It took me a while to understand what I’m getting by dim_numrun_n, but it saves me a lot of coding and is exactly what I needed!<div class=""><br class=""></div><div class="">For future reference, to better understand the data you get from dim_numrun_n and opt=1, it helps looking at example 2. opt=1 gives you the data in column “r1”, which refers to column “run length”. “r1” tells you how many consecutive runs of 1s of different lengths the dummy data in example 2 has, e.g., 3 runs with a single 1, 1 run with two 1s, 3 runs with three 1s, and so on.</div><div class=""><br class=""></div><div class="">To calculate the average length of consecutive 1s, multiply "run length” and “r1”, take the sum of the product, and divide it by the sum of “r1”. Essentially:</div><div class=""><br class=""></div><div class="">Average length = sum(“run length” * “r1”) / sum(“r1”)<br class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I hope that helps future users. It’s a great function!</div><div class=""><br class=""></div><div class="">Toni<br class=""><div class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Calibri" class=""><br class="Apple-interchange-newline"><br class=""></font></div><div style="color: rgb(0, 0, 0); font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Calibri" class=""><b class="">Toni Klemm, Ph.D.<br class=""></b>Postdoctoral Research Associate</font></div><div style="color: rgb(0, 0, 0); font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Department of Ecosystem Science and Management</div><div style="color: rgb(0, 0, 0); font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">College of Agriculture and Life Sciences</div><div style="color: rgb(0, 0, 0); font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Texas A&M University, College Station, TX</div><div style="color: rgb(0, 0, 0); font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div><font face="Calibri" class=""><a href="http://www.toni-klemm.de/" class="">www.toni-klemm.de</a> | <a href="http://twitter.com/toniklemm" class="">@toniklemm</a></font></div><div>Editorial Board member<font face="Calibri" class="">, <a href="http://www.eccforum.org/" class="">Early Career Climate Forum</a></font></div></div></div></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<div><br class=""><blockquote type="cite" class=""><div class="">On May 9, 2019, at 11:27 AM, Adam Phillips <<a href="mailto:asphilli@ucar.edu" class="">asphilli@ucar.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Toni,<div class="">See example #3 in the dim_numrun_n documentation:</div><div class=""><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.ncl.ucar.edu_Document_Functions_Built-2Din_dim-5Fnumrun-5Fn.shtml&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=VvzoKtIseDjtyUD8VWUMhpyE4jPU5aD352WZdT2aQ3g&s=uiPO4Wrb4KOva8OyRbBKNbb4nXl6qNPxJcnkwT7yMk0&e=" class="">http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_numrun_n.shtml</a><br class=""></div><div class="">Adam</div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 9, 2019 at 10:22 AM Toni Klemm <<a href="mailto:toni-klemm@tamu.edu" class="">toni-klemm@tamu.edu</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;" class="">Hello NCL community,<div class=""><br class=""></div><div class="">I have a dataset of de-trended precipitation and temperature projections from 2020 to 2099, and I’m trying to count the number of consecutive years with above and below zero data, in other words the length of wet/dry or warm/cool periods, for 20-year periods (2020-2039, 2040-2059, …) on a grid cell basis (241 latitudes, 457 longitudes = 110,137 grid cells). Is there a function in NCL that can do that somehow? It seems really cumbersome trying to do this through if and do loops.</div><div class=""><br class=""></div><div class="">Thank you very much for your help!</div><div class=""><br class=""></div><div class="">Toni<br class=""><div class="">
<div dir="auto" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><div dir="auto" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><div dir="auto" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><div dir="auto" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><div dir="auto" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><div dir="auto" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><div dir="auto" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><div style="font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><font face="Calibri" class=""><br class="gmail-m_-5986762203821397988Apple-interchange-newline"><br class=""></font></div><div style="font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><font face="Calibri" class=""><b class="">Toni Klemm, Ph.D.<br class=""></b>Postdoctoral Research Associate</font></div><div style="font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class="">Department of Ecosystem Science and Management</div><div style="font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class="">College of Agriculture and Life Sciences</div><div style="font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class="">Texas A&M University, College Station, TX</div><div style="font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><div class=""><font face="Calibri" class=""><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.toni-2Dklemm.de_&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=VvzoKtIseDjtyUD8VWUMhpyE4jPU5aD352WZdT2aQ3g&s=U4jmAacOAbmZmM6fgIchVP7dSP2S11b0ANC77goLcWI&e=" target="_blank" class="">www.toni-klemm.de</a> | <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__twitter.com_toniklemm&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=VvzoKtIseDjtyUD8VWUMhpyE4jPU5aD352WZdT2aQ3g&s=OHEdgxMYoVqcbCfRA-cHwpHEgqRG6zkaMXEdE_R-7v0&e=" target="_blank" class="">@toniklemm</a></font></div><div class="">Editorial Board member<font face="Calibri" class="">, <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.eccforum.org_&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=VvzoKtIseDjtyUD8VWUMhpyE4jPU5aD352WZdT2aQ3g&s=UAnIz2x1G6sy2zogLEV1N4oPuLWd0QWgpTP1yXXYqSs&e=" target="_blank" class="">Early Career Climate Forum</a></font></div></div></div></div><br class="gmail-m_-5986762203821397988Apple-interchange-newline"></div><br class="gmail-m_-5986762203821397988Apple-interchange-newline"></div><br class="gmail-m_-5986762203821397988Apple-interchange-newline"></div><br class="gmail-m_-5986762203821397988Apple-interchange-newline"></div><br class="gmail-m_-5986762203821397988Apple-interchange-newline"></div><br class="gmail-m_-5986762203821397988Apple-interchange-newline"><br class="gmail-m_-5986762203821397988Apple-interchange-newline">
</div>
<br class=""></div></div>_______________________________________________<br class="">
ncl-talk mailing list<br class="">
<a href="mailto:ncl-talk@ucar.edu" target="_blank" class="">ncl-talk@ucar.edu</a><br class="">
List instructions, subscriber options, unsubscribe:<br class="">
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.ucar.edu_mailman_listinfo_ncl-2Dtalk&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=VvzoKtIseDjtyUD8VWUMhpyE4jPU5aD352WZdT2aQ3g&s=CbpcNj_HeBVc3fHl1R8cdPFz9djuKgKAbbp51GJeUkY&e=" rel="noreferrer" target="_blank" class="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br class="">
</blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div class=""><div class=""><span class=""><font color="#888888" class="">Adam Phillips <br class=""></font></span></div><span class=""><font color="#888888" class="">Associate Scientist,  </font></span><span class=""><font color="#888888" class="">Climate and Global Dynamics Laboratory, NCAR<br class=""></font></span></div></div><div class=""><span class=""><font color="#888888" class=""><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.cgd.ucar.edu_staff_asphilli_&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=VvzoKtIseDjtyUD8VWUMhpyE4jPU5aD352WZdT2aQ3g&s=p6fI6x2nQFNh6jsTRpVAaKufOPKYmEnMhATPL--vQF0&e=" target="_blank" class="">www.cgd.ucar.edu/staff/asphilli/</a>   </font></span><span class=""><font color="#888888" class="">303-497-1726 </font></span></div><span class=""><font color="#888888" class=""></font></span><div class=""><div class=""><span class=""><font color="#888888" class=""><br class=""></font></span><div class=""><span class=""><font color="#888888" class=""><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.cgd.ucar.edu_staff_asphilli&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=VvzoKtIseDjtyUD8VWUMhpyE4jPU5aD352WZdT2aQ3g&s=DxMw6W0EDFtDQM8oXFqwCZWrroUpXa4oOSsUjn56r0c&e=" target="_blank" class=""></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div></blockquote></div><br class=""></div></div></div></body></html>