<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> I slightly modified your NCl script. It generated exactly what I want!<br><br>Thanks you so much!!!!<br><br>Xiaoming <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. 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"> cmap = read_colormap_file("gsdtol")</font></div><div class="ecxgmail_default"><font face="monospace, monospace"> res@cnFillPalette = cmap(::-1,:) ; reverse the color map </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". 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. 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"> </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. 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"><<a href="mailto:yuanfangcan@hotmail.com" target="_blank">yuanfangcan@hotmail.com</a>></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. <div>See what I got </div><div><div style="display:inline-block;"> <span> </span> <div style="display:inline-block;"><br></div> <span> </span></div></div><div><div style="display:inline-block;"></div>using my script of <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 </div><div><div style="display:inline-block;"> <span> </span> <div style="display:inline-block;"><br></div> <span> </span></div></div><div><div style="display:inline-block;"></div>There are a few issues, </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. </div><div>If I set gsn_define_colormap(wks,"<wbr>BlAqGrYeOrReVi200") , how can I make the fist used color transparent? </div><div><br></div><div>Thanks</div><div><span class="ecxHOEnZb"><font color="#888888">Xiaoming <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 <<a href="mailto:yuanfangcan@hotmail.com" target="_blank">yuanfangcan@hotmail.com</a>> 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;"><overlay.png></div> <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>