Re: cnFill problem when all values are between levels

From: Rick Brownrigg <brownrig_at_nyahnyahspammersnyahnyah>
Date: Thu Nov 14 2013 - 13:47:56 MST

Hi,

With that particular colormap, I might expect the result to be a white plot. All your contour values fall into the first bin, and it seems like that first bin should be mapped to one of the first few colors of the colormap, all of which are white or very nearly white shades of blue (?)

Rick

On Nov 14, 2013, at 1:26 PM, antti.pessi@vaisala.com wrote:

> Hello,
>
> I have seen this problem when all the values fall between two contour levels. The script doesn’t give any error message, but doesn’t plot anything either. For example, the script below (modified sample script conLev_5.ncl from NCL web site) should plot a blue field all over, but instead plots white field.
>
> Is this a bug or is there some resource or hack that I can use?
>
> Thanks,
> Antti
>
>
> ; ===========================================
> ; conLev_5.ncl
> ;
> ; Concepts illustrated:
> ; - Creating contours for a constant field
> ; - Explicitly setting contour levels
> ; - Explicitly setting the fill colors for contours
> ; - Centering labels with respect to labelbar boxes
> ; ===========================================
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> ;----------------------------------------------------------------------
> ; Main code
> ;----------------------------------------------------------------------
> begin
> ;---Create a dummy array that will initially contain all missing values
> x = new((/33,33/),float)
>
> ;---Fill in values to make a square
>
> x(0:32,0:16) = 1.1
> x(0:32,17:32) = 1.2
>
> ;---Set all missing values to some non-missing value
> x = where(ismissing(x),50,x)
>
> wks = gsn_open_wks ("png", "conLev")
>
> res = True
> res@gsnMaximize = True
>
> res@cnFillOn = True
> res@cnLinesOn = False
> res@cnLineLabelsOn = False
> res@cnLineLabelBackgroundColor = -1
>
> cmap_rad = read_colormap_file("WhiteBlueGreenYellowRed")
> ; cmap_rad(0,3) = 0.0 ; Fully transparent
> res@cnFillPalette = cmap_rad
> res@cnLevelSelectionMode = "ExplicitLevels"
> res@cnLevels = ispan(1,5,1)
>
> plot = gsn_csm_contour(wks, x, res)
>
> end
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Nov 14 13:48:07 2013

This archive was generated by hypermail 2.1.8 : Fri Nov 22 2013 - 09:36:32 MST