<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;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" class="OWAAutoLink" id="LPlnk210234" previewremoved="true">
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>
</body>
</html>