<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Alan,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">That's a good question, and I'm afraid we don't have a function to do that. The problem is that the function has to sort the values in order to effectively find the unique elements, and it doesn't bother unsorting them when done. This would add a potentially expensive extra step that people may not want. However, I do see the value of not sorting the values.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I've attached a function that unsorts the values after you call get_unique_values. If you have a lot of values, this may add noticeable time to execute. Also, this will currently only work on a 1D array.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I created a ticket for this, in case we get more requests for this and need to create a more elegant solution (NCL-2618).</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default"><div style="font-size:small"><br></div></div></div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 25, 2017 at 11:33 AM, Alan Rhoades <span dir="ltr"><<a href="mailto:alan.m.rhoades@gmail.com" target="_blank">alan.m.rhoades@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"><img width="0" height="0" class="m_-3916837355478959127mailtrack-img" style="float:right" alt="" src="https://mailtrack.io/trace/mail/abd9355b95c51f735edb13e546f6e7fbe1ac95ae.png?u=1126611"><span style="font-size:12.8px">Hello,</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I'm currently using this nifty NCL function get_unique_values to sort through an array and extract unique strings and/or floats from in-situ station data.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">My problem is that the extracted values are then sorted alphabetically and/or lowest to highest. </div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Is it possible to use this function (or a similar) and maintain the ordering from the original array which the strings/floats were extracted from?</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Best,</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">AR</div><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_-3916837355478959127gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="font-weight:bold"><font color="#000000"><br></font></div><div><font color="#000000"><font size="1"><b>Alan Rhoades, Ph.D. | Lawrence Berkeley National Laboratories</b></font></font></div><div><font color="#000000" size="1"><b>Hydroclimate Uncertainty Postdoctoral Fellow | <a href="http://climate.ucdavis.edu/hyperion/" target="_blank">Project Hyperion</a></b></font></div><div><div><font color="#000000"><b><font size="1" face="arial, helvetica, sans-serif"><i><a href="mailto:arhoades@lbl.gov" target="_blank">arhoades@lbl.gov</a> | <a href="mailto:alan.m.rhoades@gmail.com" target="_blank">alan.m.rhoades@gmail.com</a></i></font></b></font></div><div><font color="#000000"><b><i><font size="1"><u><a href="http://alanrhoades.weebly.com/" target="_blank">Website</a></u></font><span style="font-size:12.8px"> |</span><span style="font-size:12.8px"> </span><font size="1"><u><a href="https://www.researchgate.net/profile/Alan_Rhoades" target="_blank">Research Gate</a></u></font><span style="font-size:12.8px"> </span></i></b><b style="font-size:12.8px"><i><span style="font-size:12.8px">| </span></i></b></font><b style="font-size:12.8px"><i><font size="1"><font color="#000000"><a href="https://scholar.google.gr/citations?user=AVFLiFsAAAAJ&hl=en" target="_blank">Google Scholar</a> </font></font></i></b><b style="font-size:12.8px;color:rgb(0,0,0)"><i><span style="font-size:12.8px">|</span><font size="1"> </font><u style="font-size:12.8px"><font size="1"><a href="https://www.linkedin.com/pub/alan-rhoades/22/5bb/52a" target="_blank">LinkedIn</a></font></u></i></b><b style="font-size:12.8px;color:rgb(0,0,0)"><i><span style="font-size:12.8px"> </span></i></b><b style="font-size:12.8px"><i><font size="1"><u><a href="https://scholar.google.gr/citations?user=AVFLiFsAAAAJ&hl=en" target="_blank"><br></a></u></font></i></b></div></div></div></div></div></div></div></div></div></div></div></div></div>
</font></span></div>
<br>______________________________<wbr>_________________<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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>