[ncl-talk] best way to overlay two color filled contour maps?

xiaoming Hu yuanfangcan at hotmail.com
Thu Sep 1 15:30:26 MDT 2016


Dear Mary 

After slightly modify your NCl script, it generated exactly what I want! 
See: 
               
http://www.caps.ou.edu/micronet/YangYi/WRF_QTT/V3.7.1/wrfERA2d_Sichuan_forQTT_UCM_YSU.2014070912/wrfout_d02_hourlyRAIN_7.png

Thank you so much!
Xiaoming 

From: haley at ucar.edu
Date: Thu, 1 Sep 2016 12:39:42 -0600
Subject: Re: [ncl-talk] best way to overlay two color filled contour maps?
To: yuanfangcan at hotmail.com
CC: shea at ucar.edu; ncl-talk at ucar.edu; xhu at ou.edu

Xiaoming,
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).

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.
So, for the case where you want to reverse the "gsdtol" color map, you can do this:
  cmap = read_colormap_file("gsdtol")  res at cnFillPalette = cmap(::-1,:)      ; reverse the color map  
But, there's already a reversed version of "gsdtol" called "gsltod", so you could also use that directly:
res at cnFillPalette = "gsltod"
Then, for the overlaid contours, set:
res2 at cnFillPalette = "BlAqGrYeOrReVi200"
Remove all calls to "gsn_define_colormap" and "gsn_reverse_colormap".  They are no longer needed.
There are some other things you may want to clean up in your plot:
[1] Don't use WRF_map_c. This is not an advertised function and was deprecated a long time ago.  Instead, use:








  wrf_map_resources(fmap, res)[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.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.
--Mary

















On Wed, Aug 31, 2016 at 10:10 PM, xiaoming Hu <yuanfangcan at hotmail.com> wrote:



I actually looked at those pages. See what I got               using my script of http://www.caps.ou.edu/micronet/YangYi/WRF_QTT/V3.7.1/wrfERA2d_Sichuan_forQTT_UCM_YSU.2014070912/plot_totalRain_daily_spatial.ncl
Apparently it is not as nice as               There are a few issues, 1. I need the two contour maps using different colormaps, one is gsdtol, the other is BlAqGrYeOrReVi2002. In the exemplary figure, the overlay is done not through Opacity setting, but setting the 1st color transparent.   If I set gsn_define_colormap(wks,"BlAqGrYeOrReVi200") , how can I make the fist used color transparent? 
ThanksXiaoming 

CC: ncl-talk at ucar.edu; xhu at ou.edu
From: shea at ucar.edu
Subject: Re: [ncl-talk] best way to overlay two color filled contour maps?
Date: Wed, 31 Aug 2016 17:11:20 -0600
To: yuanfangcan at hotmail.com

Did you look at the overlay page?
Applications/overlay.shtmlApplications/rgbacolor.shtml

Sent from my iPhone
On Aug 31, 2016, at 12:36 PM, xiaoming Hu <yuanfangcan at hotmail.com> wrote:




What is the best way to overlay two color-filled contour maps (like below) in NCl? 

    <overlay.png>     

Thanks
Xiaoming 
 		 	   		  
_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
 		 	   		  

_______________________________________________

ncl-talk mailing list

ncl-talk at ucar.edu

List instructions, subscriber options, unsubscribe:

http://mailman.ucar.edu/mailman/listinfo/ncl-talk



 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160901/fefbfa0a/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wrfout_d02_hourlyRAIN_7.png
Type: image/png
Size: 131379 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160901/fefbfa0a/attachment-0002.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: overlay.png
Type: image/png
Size: 40998 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160901/fefbfa0a/attachment-0003.png 


More information about the ncl-talk mailing list