Re: color shading for specified range

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Wed Mar 26 2014 - 15:50:24 MDT

Hi Basit,
See example #3 here:
http://www.ncl.ucar.edu/Applications/color.shtml#ex3

You can specify the colors used in your color fill using cnFillColors:

gsn_define_colormap(wks,"ncl_default") ; not needed in v6.1.2
res@cnLevelSelectionMode = "ExplicitLevels" ; or can use ManualLevels
res@cnLevels = (/-6,-1,1,6/) ; set contour levels
res@cnFillColors = (/30,100,-1,190,230/) ; -1 = transparent
; colors =
http://www.ncl.ucar.edu/Document/Graphics/ColorTables/ncl_default.shtml

In v6.2.0, you will be able to use gsn_contour_shade to do this:
http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_contour_shade.shtml

(Currently gsn_contour_shade does not allow you to shade both the high
and the low regions at the same time.)

Hope that helps. If not, please respond back to the ncl-talk email list.
Adam

On 03/26/2014 07:48 AM, BasitAli Khan wrote:
> Hi folks,
>
> I am trying to plot a specified range of vertical velocity in shading
> from -6 to -1 and 1 to 6. I don't want any shading between -1 and 1.
> I tried explicit levels with explicit mode but it still plots shading
> for the unwanted range. I then replaced the unwanted range with
> missing values as follows:
>
> wa_plane = where((.not.ismissing(wa_plane).and. wa_plane .lt. 1.)
> .and. (.not.ismissing(wa_plane) .and. wa_plane .gt.
> -1.),wa_plane@_FillValue,wa_plane)
>
> But then my code crashed with the following error message
> fatal:The result of the conditional expression yields a missing value.
> NCL can not determine branch, see ismissing function
>
> I then tried another workaround as follows:
>
> dims_wa = dimsizes(wa_plane)
> do jj= 0, dims_wa(0)-1
> do ii = 0, dims_wa(1)-1
> if (.not.ismissing(wa_plane(jj,ii))
> .and. (wa_plane(jj,ii) .gt. -1.) .and.(wa_plane(jj,ii) .lt. 1.) ) then
> wa_plane(jj,ii)=wa_plane@_FillValue
> end if
> end do
> end do
>
>
> Still no luck. I would greatly appreciate if anyone could help me with
> some tips on this.
>
> Best regards,
> b:)
> ----
>
> Basit A. Khan, Ph.D.
>
> Postdoctoral Research Fellow
>
> Division of Physical Sciences & Engineering
>
> Office# 3204, Level 3, Building 1,
>
> King Abdullah University of Science & Technology
>
> 4700 King Abdullah Blvd, Box 2753, Thuwal 23955 --6900,
>
> Kingdom of Saudi Arabia.
>
> Office: +966(0)2 808 0276, Mobile: +966(0)5 0860 3617
>
> E-mail: basitali.khan@kaust.edu.sa <mailto:basitali.khan@kaust.edu.sa>
>
> Skype name: basit.a.khan
>
> ------------------------------------------------------------------------
>
> This message and its contents including attachments are intended
> solely for the original recipient. If you are not the intended
> recipient or have received this message in error, please notify me
> immediately and delete this message from your computer system. Any
> unauthorized use or distribution is prohibited. Please consider the
> environment before printing this email.
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
______________________________________________________________
Adam Phillips                                asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division       (303) 497-1726
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/staff/asphilli

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Mar 26 15:50:37 2014

This archive was generated by hypermail 2.1.8 : Mon Mar 31 2014 - 11:47:09 MDT