Re: cnFill problem when all values are between levels

From: Rick Brownrigg <brownrig_at_nyahnyahspammersnyahnyah>
Date: Thu Nov 14 2013 - 14:39:19 MST

OK, I see that too. It apparently only happens on the default cnFillMode, which is "AreaFill"; the plot looks as expected with the other two possibilities, "RasterFill","CellFill". As this would seem to be a bug, I'll file a ticket. In the meantime, hopefully one of the other cnFillModes will get you what you need.

(and as I write this, there's further clarification just posted from Adam on the matter)

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

> Hi Rick,
>
> Could you please try the script and see the values on the label bar. Those two sample values fall in to the second bin that should be blue.
>
> I tried something else to confirm: I get a white plot even if I change the colormap to e.g. ”cosam” and put in values 4.1 and 4.9. If the two values are e.g. 3.9 and 4.1 the plot is fine. So every time the values fall inside two levels, the plot is white.
>
> Antti
>
>
> From: Rick Brownrigg [mailto:brownrig@ucar.edu]
> Sent: Thursday, November 14, 2013 1:48 PM
> To: Pessi Antti ANPE
> Cc: ncl-talk@ucar.edu
> Subject: Re: cnFill problem when all values are between levels
>
> 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 14:39:27 2013

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