<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hello Rick,</p>
<p><br>
</p>
<p>Thank you so much for your response! I just sent the data (still copying as I speak) and actual script via the ftp using my email address as password. Is this helpful? Please, let me know if you need anything else.</p>
<p><br>
</p>
<p>In addition to the progressively slower running of the script, I m also curious to hear if there are faster ways to plot trajectories (polylines) with each segment having a different color (based on meteorological values) or if this is the only way as I
have it.</p>
<p><br>
</p>
<p>Thank you so much!!</p>
<p><br>
</p>
<p>Wish you a good day!</p>
<p>Best,</p>
<p>Andries</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Rick Brownrigg <brownrig@ucar.edu><br>
<b>Sent:</b> 08 February 2021 21:42:10<br>
<b>To:</b> De Vries Andries<br>
<b>Cc:</b> ncl-talk@ucar.edu<br>
<b>Subject:</b> Re: [ncl-talk] solution for drawing a polyline (trajectory) with different colors for each line segment (e.g., without using loop) to avoid very slow script?</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>Hi Andries,</div>
<div><br>
</div>
<div>I don't see anything that should cause the loop to run progressively slower, and that puzzles me. Are you able to send your data and actual script (not the test script)? You can send directly to me if you prefer.</div>
<div><br>
</div>
<div>Rick</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Mon, Feb 8, 2021 at 10:09 AM De Vries Andries 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 id="gmail-m_-8994382651802238474divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p>Dear NCL team and NCL users,</p>
<p><br>
</p>
<p>Currently I use NCL to plot air parcel trajectories using the function gsn_add_polyline on a latlon map. For these polylines I would like to assign different colors to each line segment, for example defined by pressure. I have a script that works, it is
practically the same as the example 2 under the link <a href="https://www.ncl.ucar.edu/Applications/traj.shtml" id="gmail-m_-8994382651802238474LPlnk210234" target="_blank">
https://www.ncl.ucar.edu/Applications/traj.shtml</a>, whereby the script loops over each pair of points, retrieves the right color, and then plots each individual line segment. In my application I have a huge set of trajectories each consisting of many segments
(~72 per trajectory). It takes extremely long for NCL to complete the plot; in the beginning the script will run fast, but it gets slower and slower as the script proceeds over the number trajectories.</p>
<p><br>
</p>
<p>What solutions do I have to make the script faster?</p>
<p><br>
</p>
<p>I tried a few things, for example, plotting the polylines using arrays in stead of loops, and retrieving colors as arrays. That works, but then plotting the lines using an array of different colors fails. </p>
<p><br>
</p>
<p>In the attached script I send an example as well as the resulting plot and colorbar I used;</p>
<p>1) the working script with the loop over each line segment that works, but is in reality very slow (map1(0))</p>
<p>2) an attempt with retrieving the colors based on an array with Pressure, which works, but then using the 2-D color array assigned to the plotting resource (r2) fails <span style="font-size:12pt">(map1(1))</span></p>
<p>3) an attempt with named colors (in 1-D array), which also fails as only the first named color is used for all segments. <span style="font-size:12pt">(map1(2))</span></p>
<p><br>
</p>
<p>Any solutions that avoid using the loop, or make the script faster, are most welcome!!</p>
<p><br>
</p>
<p>Thank you so much!</p>
<p><br>
</p>
<p>Best,</p>
<p>Andries </p>
<p></p>
</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>
</div>
</body>
</html>