[ncl-talk] problems when using the "res at cnFillPalette = "BlGrYeOrReVi200""

ZUO Ziping zzuoaa at connect.ust.hk
Mon May 10 00:10:38 MDT 2021


Dear ncl-team,

The other day when I was trying to use the colors in the "BlGrYeOrReVi200", I use the res at cnFillPalette = "BlGrYeOrReVi200". However, it kept reminding me "warning:ContourPlotSetValues: color index (204) exceeds size of palette, defaulting to foreground color for entry (12)".
But when I changed the instruction to gsn_define_colormap(wks,"BlGrYeOrReVi200"), it works fine. I'd like to ask the reason for these two instructions. The following is my full script.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

begin

  DATADir = "/disk/wrfout/"
  FILES = systemfunc (" ls -1 " + DATADir + "wrfout_d04_2020-06* ")
  numFILES = dimsizes(FILES)
  print("numFILES = " + numFILES)
  print(FILES)
  print (" ")

  type = "pdf"
  wks = gsn_open_wks(type,"average_temp")

  res = True
  res at MainTitle                   = "REAL-TIME WRF"
  res at Footer = False

  pltres = True
  pltres at PanelPlot = True
  pltres at FramePlot = False

  mpres = True
  mpres at mpDataBaseVersion = "HighRes"
  mpres at mpGeophysicalLineColor = "Black"
  mpres at mpGridLineColor = "Black"
  mpres at mpDataResolution = "Finest"

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  a = addfiles(FILES+".nc","r")

  times = wrf_user_getvar(a,"times",-1)  ; get all times in the file
  ntimes = dimsizes(times)         ; number of times in the file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


do k = 0,23,1
    meantemp = new((/162,213/),float)
        meantemp = 0
        temp = new((/ntimes,162,213/),float)

   do it = k,ntimes-1,24             ; TIME LOOP
      print("Working on time: " + times(it) )
          fi = addfile(FILES(it),"r")
          T_2 = fi ->T2     ; T2 in Kelvin
      tc2 = T_2-273.16                  ; T2 in C
          temp(it,:,:) = tc2
          meantemp(:,:) = meantemp(:,:)+temp(it,:,:)
        end do

        meantemp(:,:) = meantemp(:,:)/30

        opts = res
    opts at cnFillOn = True
    opts at ContourParameters = (/23,37,1/)
    opts at cnFillPalette = "BlGrYeOrReVi200"
    contour_FLX = wrf_contour(a[k],wks,meantemp,opts)
    delete(opts)

        plot = wrf_map_overlays(a[k],wks,contour_FLX,pltres,mpres)

end do        ; END OF TIME LOOP

end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Thank you for your time!

Best regards
Zoe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210510/fbd519d5/attachment.html>


More information about the ncl-talk mailing list