[ncl-talk] how does interpolation work in contour plot?

Dennis Shea shea at ucar.edu
Thu Oct 31 20:55:17 MDT 2019


You have 4 categories [classifications; seasons].

I agree with Will's suggestion to use "RasterFill.
A general approach for categorical data:

See: *http://www.ncl.ucar.edu/Applications/classification.shtml*
<http://www.ncl.ucar.edu/Applications/classification.shtml>

One example is 'kinda' like what you want:  hdf4eos_5.ncl

  res                  = True               ; plot mods desired
  res at gsnMaximize      = True
  res at gsnAddCyclic     = False

  res at cnFillOn         = True               ; color fill
  res at cnFillMode       = "RasterFill"       ; Raster Mode
  res at cnLinesOn        =  False             ; Turn off contour lines
;;res at cnLevelSelectionMode = "ExplicitLevels"   ; set explicit contour levels
;;res at cnLevels             = ispan(1,3,1)       ; one less than needed
  res at cnLevelSelectionMode = "ManualLevels"     ; set manual contour levels
  res at cnMinLevelValF       =   1                ; set min contour level
  res at cnMaxLevelValF       =   3                ; one less than max
  res at cnLevelSpacingF      =   1                ; set contour spacing
  colors = (/"blue"                    \        ; DJF
            ,"red"                     \        ; MAM
            ,"green"                   \        ; JJA
            ,"yellow"                  /)       ; SON
  res at cnFillPalette    = colors             ; set color map
  res at lbLabelPosition  = "Center"           ; label position
  res at lbLabelAlignment = "BoxCenters"       ; label orientation
  res at lbLabelStrings   = (/"DJF","MAM","JJA","SON"/)

=======================
If slow:
  res at trGridType           = "TriangularMesh"   ; *faster* graphic rendering
 ====


On Thu, Oct 31, 2019 at 6:56 PM Will Hobbs via ncl-talk <ncl-talk at ucar.edu>
wrote:

> Hi Lesley
>
>
>
> Sorry, can’t point you to a detailed explanation, but the default
> contouring mode is ‘AreaFill’, and there is a bit of a description under
> the ‘cnFillMode’ resource help entry.
>
>
>
> Have you tried setting cnFillMode = “RasterFill”, with the same explicit
> levels? I suspect it will ‘digitise’ the filling in the way that you want
> (but I don’t know).
>
>
>
> Will
>
>
>
> *From: *ncl-talk <ncl-talk-bounces at ucar.edu> on behalf of Lesley Smith -
> NOAA Affiliate via ncl-talk <ncl-talk at ucar.edu>
> *Reply-To: *Lesley Smith - NOAA Affiliate <lesley.l.smith at noaa.gov>
> *Date: *Friday, 1 November 2019 at 11:49 AM
> *To: *ncl-talk <ncl-talk at ucar.edu>
> *Subject: *[ncl-talk] how does interpolation work in contour plot?
>
>
>
> Hi ncl-talk,
>
> I'm trying to plot the season of the year with maximum precipitation
>
> for each grid-point in the U.S.
>
> I created a matrix of output, dimensioned lat x lon.
>
> There are only 4 possible (integer)values: 1,2,3,4 <--which I checked.
>
> (1 is DJF, 2 is MAM, etc. I'll make this pretty later.)
>
> I get the attached plot, cam1x1_maxx_doy_precip.r01.1901.jpg,
>
> (which I hope you can see) which I believe is correct.
>
> However, I do not understand why there appear to be so many floats
>
> in the plot. Is there some kind of interpolation going on?
>
> When I try to set the contour levels explicitly, 1,2,3,4 I do
>
> not seem to get a correct result.
>
> Thus, it would be awesome if someone could point me to
>
> a page explaining interpolation in contour plots.
>
> Thanks very much!
>
> -Lesley Smith
>
>
>
> University of Tasmania Electronic Communications Policy (December, 2014).
> This email is confidential, and is for the intended recipient only.
> Access, disclosure, copying, distribution, or reliance on any of it by
> anyone outside the intended recipient organisation is prohibited and may be
> a criminal offence. Please delete if obtained in error and email
> confirmation to the sender. The views expressed in this email are not
> necessarily the views of the University of Tasmania, unless clearly
> intended otherwise.
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191031/282456a8/attachment.html>


More information about the ncl-talk mailing list