<div dir="ltr">Hi SB,<div>The plot that is going to be overlaid cannot be created by calling gsn_csn_contour_map. You should use gsn_csm_contour instead. So switch this:</div><div><div>  plot2 =  gsn_csm_contour_map(wks,rain,res)<br></div>with this:</div><div><div>  plot2 =  gsn_csm_contour(wks,rain,res)<br></div><div>Adam</div><br class="gmail-Apple-interchange-newline"></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 2, 2019 at 11:59 AM S Br <<a href="mailto:sbr.climate@gmail.com">sbr.climate@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Rick,<div>You have correctly guessed my query. Now, I have checked that the new variable 'rain' is correctly defined with the value gt/lt .39/-.39 but I am still struggling to overlay this value with patterns with another gsn_csm_contour_map. I am copying here the last part of my program. Am I doing somewhere wrong? Else, do I need to send a second resources (res2) for the 2nd plot?</div><div><br></div><div><div>   plot1 =  gsn_csm_contour_map(wks,rain,res)</div><div><br></div><div>  res@cnMonoFillPattern = True<br></div><div>  res@cnFillPattern = 12</div><div>  rain = where(<a href="http://rain.lt/" target="_blank">rain.lt</a>. .39 .and. <a href="http://rain.gt/" target="_blank">rain.gt</a>. -.39, rain@_FillValue, rain)<br></div><div>  plot2 =  gsn_csm_contour_map(wks,rain,res)<br></div><div>  overlay(plot1,plot2)<br></div><div><br></div><div>  draw(plot1)</div><div>  frame(wks)</div></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 2, 2019 at 6:03 PM Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div>So my (very limited) understanding from the code you sent, you drew a color-filled contour plot of the variable "rain", which was a time slice of the variable precip from the file. Then you intended to use gsn_csm_shade to hachure regions where rain was gt/lt .39/-.39 ?</div><div><br></div><div>This is speculation:</div><div><br></div><div>i) draw your color-filled plot as before</div><div><br></div><div>ii) mask out the rain variable for only the values you want:</div><div><br></div><div>   rain = where(<a href="http://rain.lt" target="_blank">rain.lt</a>. .39 .and. <a href="http://rain.gt" target="_blank">rain.gt</a>. -.39, rain@_FillValue, rain)</div><div><br></div><div>iii) redraw the rain variable with gsn_csm_contour_map as before, but using cnFillPatterns instead of color</div><div><br></div><div>iv) overlay the two plots as in the coneff_14 example (this requires you set res@gsnFrame = False and res@gsnDraw = False)</div><div><br></div><div>HTH...</div><div>Rick<br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 2, 2019 at 10:30 AM S Br <<a href="mailto:sbr.climate@gmail.com" target="_blank">sbr.climate@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Rick,<div>Thanks for your reply but my region of interest cover a regional lat/lon domain, so I can't use gsn_csm_contour(). Instead, I am using gsn_csm_contour_map(). </div><div>Actually, my main objective is to draw a correlation plot with contour filled with color and then mark pattern to the region having significant correlation value (see the map attached). </div><div>For example, I have calculated the threshold value of correlation to be significant is 0.39. So, I want to draw patterns over the filled contour for the region having the correlation value below -0.39 and above 0.39.</div><div>'gsn_contour_shade' is working fine for this but unfortunately, I can't use this with gsn_csm_contour_map()</div><div><br></div><div>Is there any otherway to achieve this?</div><div><br></div><div>Thanks.</div><div>SB</div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 2, 2019 at 4:45 PM Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>The docs for gsn_contour_shade() state:</div><div><br></div><div>You cannot mix and match color and shading with this routine.
For an example of drawing shaded and filled contours, see
example <a href="http://ncl.ucar.edu/Applications/coneff.shtml#ex14" target="_blank">coneff_14.ncl</a>. <br></div><div><br></div><div>However, that example coneff_14 shows how to achieve the result via two calls to gsn_csm_contour():</div><div><br></div><div><a href="http://ncl.ucar.edu/Applications/coneff.shtml#ex14" target="_blank">http://ncl.ucar.edu/Applications/coneff.shtml#ex14</a></div><div><br></div><div>Hope that helps...</div><div>Rick<br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 2, 2019 at 5:39 AM S Br <<a href="mailto:sbr.climate@gmail.com" target="_blank">sbr.climate@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Users,<div>I am trying to plot a contour map filled with color and then apply patterns to the values greater and smaller than the specified values using the function gsn_contour_shade(plot,0.5,3.0,opt)</div><div><br></div><div>However, when I use the gsn_contour_shade and overlay, the contour filled with color disappears. I can only see the patterns without the filled contour. Please have a look at the attached image.</div><div><div> I am using NCL6.4.0 and my script is given below.</div></div><div><br></div><div>Thank you, SB</div><div><br></div><div><div>begin</div><div><br></div><div> in1 = addfile("<a href="http://precip.gpcp.mon.mean.nc" target="_blank">precip.gpcp.mon.mean.nc</a>","r")</div><div>  rain=in1->precip(0,:,:)</div><div>  printVarSummary(rain)</div><div>;************************************</div><div>;create plot</div><div>;************************************</div><div>  wks = gsn_open_wks("pdf","overlay")             ; send graphics to PNG file</div><div>  res                     = True<br></div><div>  res@gsnDraw           = False         ; Don't draw plots</div><div>  res@gsnFrame          = False         ; Don't advance frame</div><div>  res@cnFillOn          = True          ; Turn on contour fill</div><div>  res@cnLinesOn         = False         ; Turn off contour lines</div><div>  res@cnFillPalette       = "MPL_YlOrRd"   ; set color map</div><div>  res@tiMainString        = "Overlaying shaded contours on filled contours"</div><div>;  res@cnFillMode = "RasterFill"</div><div>  res@cnLevelSelectionMode =  "ManualLevels"</div><div>  res@cnMinLevelValF       = 0.0</div><div>  res@cnMaxLevelValF       = 5.0</div><div>  res@cnLevelSpacingF      = 0.5</div><div><br></div><div>;   res@gsnAddCyclic     = False</div><div>   res@mpMinLatF    =   -10.0               ; only plot 30S to 30N</div><div>   res@mpMaxLatF    =  54.0</div><div>   res@mpMinLonF    = 30.0              ; only plot 30S to 30N</div><div>   res@mpMaxLonF    = 100.0</div><div><br></div><div>  plot = gsn_csm_contour_map(wks,rain,res)</div><div><br></div><div>  opt = True</div><div>  opt@gsnShadeFillType = "pattern"      ; pattern fill</div><div>  opt@gsnShadeHigh = 2                  ; use pattern #2</div><div>  opt@gsnShadeLow = 17                  ; use pattern #17</div><div>  plot2 = gsn_contour_shade(plot,0.5,3.0,opt)</div><div>  overlay(plot,plot2)</div><div><br></div><div>  draw(plot)</div><div>  frame(wks)</div><div>end</div></div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailman/listinfo/ncl-talk</a><br>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailman/listinfo/ncl-talk</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist,  </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a>   </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>