<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Kyle,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I&#39;ve added a ticket, NCL-2058, for a &quot;cnFillOpacities&quot; type of resource. I don&#39;t think this would be an issue.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><br>
<div class="gmail_quote">On Fri, Aug 29, 2014 at 4:20 PM, Kyle Griffin <span dir="ltr">&lt;<a href="mailto:ksgriffin2@wisc.edu" target="_blank">ksgriffin2@wisc.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi Mary,<div><br></div><div>Thanks for the clarification. I think Rabah would need to use cnFillPalette as it seems like he has multiple opacities to set that vary by color. On a related note, is it possible to readily change cnFillOpacityF to accept an array of values, much like setting cnFillColors allows one to set RGB/RGBA colors? This would allow for a more readily accessible method of setting varying opacities rather than via direct manipulation of the color quadruplets. Just a suggestion, as I&#39;ve generally struggled in my attempts to make alpha values work from a color table file.</div>
<span class="HOEnZb"><font color="#888888">

<div><br></div><div><br></div><div>Kyle</div></font></span></div><div class="gmail_extra"><div class=""><br clear="all"><div><div dir="ltr">----------------------------------------<div>Kyle S. Griffin</div><div>Department of Atmospheric and Oceanic Sciences</div>


<div>University of Wisconsin - Madison</div><div>Room 1421</div><div>1225 W Dayton St, Madison, WI 53706</div><div>Email: <a href="mailto:ksgriffin2@wisc.edu" target="_blank">ksgriffin2@wisc.edu</a></div></div></div>
<br><br></div><div><div class="h5"><div class="gmail_quote">On Fri, Aug 29, 2014 at 4:22 PM, Mary Haley <span dir="ltr">&lt;<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Kyle and Rabah,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Sorry about the confusion on gsn_define_colormap.  It doesn&#39;t seem to handle RGBA type color maps, although you can certainly set a colormap using gsn_define_colormap, and then apply opacity to it later via opacity resources like cnFillOpacityF</div>



<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">We recommend using &quot;cnFillPalette&quot; if you want to use a color map that has various opacity values set.</div>



<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">See the attached example, which you should be able to run as-is.  It shows two ways to set opacities. </div>


<div class="gmail_default" style="font-size:small">
<br></div><div class="gmail_default" style="font-size:small">I&#39;m not sure what&#39;s going on with the labelbar, and whether this is correct. Rick will need to weigh in here.</div><span><font color="#888888"><div class="gmail_default" style="font-size:small">



<br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div></font></span></div><div><div><div class="gmail_extra"><br><br>

<div class="gmail_quote">On Thu, Aug 28, 2014 at 9:32 PM, Kyle Griffin <span dir="ltr">&lt;<a href="mailto:ksgriffin2@wisc.edu" target="_blank">ksgriffin2@wisc.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Rabah,<div><br></div><div>As far as I know, gsn_define_colormap does not support RGBA colors, but I can&#39;t immediately find that in the documentation. If you want to use all of the colors in your color array, directly assign res@cnFillColors = colors (or colors(:,0:2) if you only want the first three colors) and this will set all of the colors in that array to be used in the FillColors. However, I believe the &quot;more proper&quot; way is to use cnFillPalette, as specified in the link I sent you in the last email.</div>



<span><font color="#888888">

<div><br></div><div><br></div><div>Kyle</div></font></span></div><div class="gmail_extra"><div><br clear="all"><div><div dir="ltr">----------------------------------------<div>Kyle S. Griffin</div><div>Department of Atmospheric and Oceanic Sciences</div>





<div>University of Wisconsin - Madison</div><div>Room 1421</div><div>1225 W Dayton St, Madison, WI 53706</div><div>Email: <a href="mailto:ksgriffin2@wisc.edu" target="_blank">ksgriffin2@wisc.edu</a></div></div></div>
<br><br></div><div><div><div class="gmail_quote">On Thu, Aug 28, 2014 at 10:17 PM, Rabah Hachelaf <span dir="ltr">&lt;<a href="mailto:hachelaf@sca.uqam.ca" target="_blank">hachelaf@sca.uqam.ca</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr">Hi Kyle,<div><br></div><div>I think your suggestion doesn&#39;t work because when i add the 4th values for opacity i get this message ; </div><div><div>(0)     Warning: gsn_define_colormap: cmap must either be an n x 3 float array,</div>






<div>(0)     a single pre-defined colormap name, or a 1-dimensional string array of named colors.</div></div><div><br></div><div>i simplified my script like this : </div><div><br></div><div><div>colors = (/ (/255,255,255,1/), (/163,255,163,125/), (/255,178,102,200/) /) * 1.0</div>






<div>colors= colors/255.</div><div>print(colors)</div><div>  </div><div>gsn_define_colormap(wks,colors)</div></div><div>......</div><div>......<br></div><div><div>.........</div><div><div>res@cnLevelSelectionMode = &quot;ExplicitLevels&quot;    <span style="white-space:pre-wrap">                        </span>; set explicit contour levels</div>






<div>res@cnLevels    = (/ 40,70,100/)<span style="white-space:pre-wrap">        </span>; set levels</div></div><div>res@cnFillColors = (/ 0,1,2/)</div></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra">






<br><br><div class="gmail_quote">2014-08-28 22:42 GMT-04:00 Kyle Griffin <span dir="ltr">&lt;<a href="mailto:ksgriffin2@wisc.edu" target="_blank">ksgriffin2@wisc.edu</a>&gt;</span>:<div><div><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">






<div dir="ltr">You should be able to just add a fourth value to your RGB triplets to make them RGBA (A for alpha) quadruplets. Since you already divide the numbers out of 255, you can simply add the alpha on the same scale, with 0 = transparent and 1=opaque (or 255, in your case).<div>








<br></div><div>More of the problem is that you don&#39;t seem to be assigning the color array you create at the beginning of the script to the cnFillColors resource you set later on. Look at some of the examples on the NCL website discussing how to work with the new color capabilities at: <a href="http://www.ncl.ucar.edu/Applications/rgbacolor.shtml" target="_blank">http://www.ncl.ucar.edu/Applications/rgbacolor.shtml</a></div>








<div><br></div><div><br></div><div>Kyle</div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr">----------------------------------------<div>Kyle S. Griffin</div><div>Department of Atmospheric and Oceanic Sciences</div>








<div>University of Wisconsin - Madison</div><div>Room 1421</div><div>1225 W Dayton St, Madison, WI 53706</div><div>Email: <a href="mailto:ksgriffin2@wisc.edu" target="_blank">ksgriffin2@wisc.edu</a></div></div></div>
<br><br><div class="gmail_quote"><div><div>On Thu, Aug 28, 2014 at 8:44 PM, Rabah Hachelaf <span dir="ltr">&lt;<a href="mailto:hachelaf@sca.uqam.ca" target="_blank">hachelaf@sca.uqam.ca</a>&gt;</span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>

<div dir="ltr"><div class="gmail_quote"><br><div dir="ltr">Hi all ,<div><br></div><div>I am using the script below to plot humidity between 40-70%(green) and 70-100% (orange).</div><div><br></div><div>I want to know if i can set the opacity for each color for example opacity 50% for the green color and 100% for the orange. </div>










<div><br></div><div>Thanks for help.</div><div><br></div><div><div>;************************************************</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot; </div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;  </div>










<div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;   </div><div>;************************************************</div><div>begin</div><div> a = addfile(&quot;gfs.t00z.pgrb2f00.grib2&quot;,&quot;r&quot;)</div>










<div>    lon = a-&gt;lon_0</div><div>    lat = a-&gt;lat_0</div><div>    icing     = short2flt(a-&gt;RH_P0_L100_GLL0({50000},:,:))</div><div><br></div><div>print(icing(1:4,1:4))</div><div>;********************************************************</div>










<div>;  Display parameters</div><div>;***************************************</div><div>zoom=&quot;test&quot;</div><div>pixel=2048</div><div>;***************************************************</div><div><br></div><div>wks_type=&quot;png&quot;</div>










<div><br></div><div>  wks_type@wkWidth = pixel</div><div>   wks_type@wkHeight = pixel</div><div>  wks_type@wkBackgroundOpacityF = 0.0</div><div>wks = gsn_open_wks(wks_type,&quot;icing_test&quot;)</div><div><br></div><div>










colors = (/ (/255,255,255/),(/0,0,0/),(/255,255,255/), (/244,255,244/), \</div><div>              (/217,255,217/), (/163,255,163/), (/106,255,106/), \</div><div>              (/43,255,106/), (/0,224,0/), (/0,134,0/),(/255,145,0/),\</div>










<div>              (/255,178,102/) /) * 1.0 ; we multiply by 1 to make colors float</div><div><br></div><div>colors = colors/255.</div><div><br></div><div>  </div><div>gsn_define_colormap(wks,colors)</div><div><br></div>









<div>
<br></div><div>res                   = True</div><div>  res@mpProjection      = &quot;Mercator&quot;       ; choose projection</div><div>  res@mpGridAndLimbOn   = False             ; turn on lat/lon lines</div><div>  res@mpPerimOn         = False             ; turn off box around plot</div>










<div>  res@mpFillOn          = False</div><div>  res@mpOutlineOn       = True  </div><div>  res@cnFillOn          = True              ; color plot desired</div><div>  res@cnLineLabelsOn    = False             ; turn off contour lines</div>










<div>   res@mpLimitMode  = &quot;LatLon&quot;</div><div>   res@mpMinLatF            =   -85.0</div><div>    res@mpMaxLatF            =  85.0 </div><div>    res@mpMinLonF            = -180</div><div>    res@mpMaxLonF            = 180</div>










<div>  res@vpXF            = 0                 ; make plot bigger</div><div>  res@vpYF            = 1         </div><div>  res@vpWidthF        = 1</div><div>  res@vpHeightF       = 1</div><div><br></div><div>res@cnLevelSelectionMode = &quot;ExplicitLevels&quot;    ; set explicit contour levels</div>










<div>res@cnLevels    = (/ 40,70,100/)<span style="white-space:pre-wrap">        </span>; set levels</div><div>res@cnFillColors = (/ -1,5,11/)</div><div><br></div><div>;res@cnFillOpacityF=0.5</div></div><div>  <br clear="all">
<div>contour0 = gsn_csm_contour_map(wks,icing,res)  ; create the plot<span><font color="#888888"><br></font></span></div><span><font color="#888888">-- <br><div dir="ltr"><div>------------------------------</div>

Cordialement,<br>Best regards,<br>Rabah Hachelaf <br>  <br><br></div>
</font></span></div></div><span><font color="#888888">
<br></font></span></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>------------------------------</div>Cordialement,<br>Best regards,<br>Rabah Hachelaf <br></div>


</font></span></div>
<br></div></div>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div></div></div><div><div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>------------------------------</div>Cordialement,<br>Best regards,<br>Rabah Hachelaf <br></div>
</div></div></div>
</blockquote></div><br></div></div></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div>