<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Dear Mary <br><br>&nbsp;&nbsp; I slightly modified your NCl script. It generated exactly what I want!<br><br>Thanks you so much!!!!<br><br>Xiaoming&nbsp; <br><br><div><hr id="stopSpelling">From: haley@ucar.edu<br>Date: Thu, 1 Sep 2016 12:39:42 -0600<br>Subject: Re: [ncl-talk] best way to overlay two color filled contour maps?<br>To: yuanfangcan@hotmail.com<br>CC: shea@ucar.edu; ncl-talk@ucar.edu; xhu@ou.edu<br><br><div dir="ltr"><div class="ecxgmail_default" style="font-size:small;">Xiaoming,</div><div class="ecxgmail_default" style="font-size:small;"><br></div><div class="ecxgmail_default" style="font-size:small;">If you need to use transparency, or more than two colormaps per plot, then you can't to use the workstation color map for setting the contour colors (i.e. the gsn_define_colormap procedure).<br><br></div><div class="ecxgmail_default" style="font-size:small;">Instead, use the cnFillPalette resource.&nbsp; This powerful resource allows you to directly associate a predefined color map (like "BlAqGrYeOrReVi200") or an RGB/RGBA directly with a contour plot.</div><div class="ecxgmail_default" style="font-size:small;"><br></div><div class="ecxgmail_default" style="font-size:small;">So, for the case where you want to reverse the "gsdtol" color map, you can do this:</div><div class="ecxgmail_default" style="font-size:small;"><br></div><div class="ecxgmail_default" style="font-size:small;"><div class="ecxgmail_default"><font face="monospace, monospace">&nbsp; cmap = read_colormap_file("gsdtol")</font></div><div class="ecxgmail_default"><font face="monospace, monospace">&nbsp; res@cnFillPalette = cmap(::-1,:) &nbsp; &nbsp; &nbsp;; reverse the color map &nbsp;</font></div><div class="ecxgmail_default"><br></div><div class="ecxgmail_default">But, there's already a reversed version of "gsdtol" called "gsltod", so you could also use that directly:</div><div class="ecxgmail_default"><br></div><div class="ecxgmail_default"><font face="monospace, monospace">res@cnFillPalette = "gsltod"</font></div><div class="ecxgmail_default"><br></div><div class="ecxgmail_default">Then, for the overlaid contours, set:</div></div><div class="ecxgmail_default" style="font-size:small;"><br></div><div class="ecxgmail_default" style="font-size:small;"><font face="monospace, monospace">res2@cnFillPalette = "BlAqGrYeOrReVi200"</font></div><div class="ecxgmail_default" style="font-size:small;"><br></div><div class="ecxgmail_default" style="font-size:small;">Remove all calls to "gsn_define_colormap" and "gsn_reverse_colormap".&nbsp; They are no longer needed.</div><div class="ecxgmail_default" style="font-size:small;"><br></div><div class="ecxgmail_default" style="font-size:small;">There are some other things you may want to clean up in your plot:</div><div class="ecxgmail_default" style="font-size:small;"><br></div><div class="ecxgmail_default" style="font-size:small;">[1] Don't use WRF_map_c. This is not an advertised function and was deprecated a long time ago.&nbsp; Instead, use:</div><div class="ecxgmail_default" style="font-size:small;"><br></div><div class="ecxgmail_default" style="font-size:small;">







<p class="ecxgmail-p1"><font face="monospace, monospace"><span class="ecxgmail-s1">&nbsp;&nbsp;</span><span class="ecxgmail-s2">wrf_map_resources</span><span class="ecxgmail-s1">(fmap, res)</span></font></p><p class="ecxgmail-p1"><span class="ecxgmail-s1"><font face="arial, helvetica, sans-serif">[2] You are setting a bunch of resource inside a do loop. This can cause your script to run slowly, if you have a do loop with a lot of increments, because it's needlessly executing the same code over and over.&nbsp; I recommend moving all code that doesn't need to be inside the loop, to outside the loop.</font></span></p><p class="ecxgmail-p1"><font face="arial, helvetica, sans-serif">I tried to fix your code to illustrate what you mean, but since I can't run it, I can't guarantee that it is bug free. See the attached script.</font></p><p class="ecxgmail-p1"><font face="arial, helvetica, sans-serif"><br></font></p><p class="ecxgmail-p1"><font face="arial, helvetica, sans-serif">--Mary</font></p><p class="ecxgmail-p1"><font face="arial, helvetica, sans-serif"><br></font></p></div>















</div><div class="ecxgmail_extra"><br><div class="ecxgmail_quote">On Wed, Aug 31, 2016 at 10:10 PM, xiaoming Hu <span dir="ltr">&lt;<a href="mailto:yuanfangcan@hotmail.com" target="_blank">yuanfangcan@hotmail.com</a>&gt;</span> wrote:<br><blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex;">


<div><div dir="ltr">I actually looked at those pages.&nbsp;<div>See what I got&nbsp;</div><div><div style="display:inline-block;">    <span>&nbsp;</span>    <div style="display:inline-block;"><br></div>    <span>&nbsp;</span></div></div><div><div style="display:inline-block;"></div>using my script of&nbsp;<a href="http://www.caps.ou.edu/micronet/YangYi/WRF_QTT/V3.7.1/wrfERA2d_Sichuan_forQTT_UCM_YSU.2014070912/plot_totalRain_daily_spatial.ncl" target="_blank">http://www.caps.ou.edu/<wbr>micronet/YangYi/WRF_QTT/V3.7.<wbr>1/wrfERA2d_Sichuan_forQTT_UCM_<wbr>YSU.2014070912/plot_totalRain_<wbr>daily_spatial.ncl</a></div><div><br></div><div>Apparently it is not as nice as&nbsp;</div><div><div style="display:inline-block;">    <span>&nbsp;</span>    <div style="display:inline-block;"><br></div>    <span>&nbsp;</span></div></div><div><div style="display:inline-block;"></div>There are a few issues,&nbsp;</div><div>1. I need the two contour maps using different colormaps, one is gsdtol, the other is BlAqGrYeOrReVi200</div><div>2. In the exemplary figure, the overlay is done not through Opacity setting, but setting the 1st color transparent. &nbsp;&nbsp;</div><div>If I set&nbsp;gsn_define_colormap(wks,"<wbr>BlAqGrYeOrReVi200") , how can I make the fist used color transparent?&nbsp;</div><div><br></div><div>Thanks</div><div><span class="ecxHOEnZb"><font color="#888888">Xiaoming&nbsp;<br></font></span><div class="ecxhm ecxHOEnZb"><br></div><div><div class="ecxhm ecxHOEnZb"><hr>CC: <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>; <a href="mailto:xhu@ou.edu" target="_blank">xhu@ou.edu</a><br>From: <a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a><br>Subject: Re: [ncl-talk] best way to overlay two color filled contour maps?<br>Date: Wed, 31 Aug 2016 17:11:20 -0600<br>To: <a href="mailto:yuanfangcan@hotmail.com" target="_blank">yuanfangcan@hotmail.com</a></div><div><div class="h5"><br><br><div>Did you look at the overlay page?</div><div><br></div><div>Applications/overlay.shtml</div><div>Applications/rgbacolor.shtml<br><br>Sent from my iPhone</div><div><br>On Aug 31, 2016, at 12:36 PM, xiaoming Hu &lt;<a href="mailto:yuanfangcan@hotmail.com" target="_blank">yuanfangcan@hotmail.com</a>&gt; wrote:<br><br></div><blockquote><div>


<div dir="ltr"><div style="display:inline-block;">What is the best <span>way to overlay two color-filled contour maps (like below) in NCl? <br><br></span>    <div style="display:inline-block;">&lt;overlay.png&gt;</div>&nbsp;    <span><br><br>Thanks<br>Xiaoming <br></span></div>                                               </div>
</div></blockquote><blockquote><div><span>______________________________<wbr>_________________</span><br><span>ncl-talk mailing list</span><br><span><a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a></span><br><span>List instructions, subscriber options, unsubscribe:</span><br><span><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a></span><br></div></blockquote></div></div></div></div>                                               </div></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></div>                                               </div></body>
</html>