cnFill problem when all values are between levels

From: <antti.pessi_at_nyahnyahspammersnyahnyah>
Date: Thu Nov 14 2013 - 13:26:31 MST

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
Received on Thu Nov 14 13:26:51 2013

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