[ncl-talk] ncl does not implement color pallete for opt@ in panel plot

Mary Haley haley at ucar.edu
Tue Jun 21 09:31:52 MDT 2016


Saurabh,

I think the problem is that you've misspelled "gsnSpreadColors". You have
it as "gsnSpreadcolors" (small 'c').

You should have gotten an error:

warning:gsnSpreadcolors is not a valid resource in wrf_contour at this time=

It's important to pay attention to these errors because they will indicate
if you are misspelling a resource or else applying a resource that it
doesn't recognize.
There are a number of other things wrong with this code which go beyond the
color issue.
The first is that you are calling "wrf_contour" with resources that have
nothing to do with WRF contour plots and will likely give you errors.
These are the resources:

  opts at mpDataBaseVersion = "MediumRes"
  opts at mpOutlineOn = True
  opts at gsLineColor      = "Black"
  opts at gsLineThicknessF= 3.0
  opts at gsnLeftString   = ""
  opts at gsnRightString = ""
  opts at txFontHeightF            = 0.05
  opts at pmTickMarkDisplayMode = "Always"

The first two resources are for map plots only.

The "gs" resources are for when you are adding polylines to a plot via
gsn_add_polyline, gsn_polyline, or gsn_polyline_ndc.

The "gsnLeft/RightString" resources are not recognized by wrf_contour.

"txFontHeightF" is for text strings (gsn_text, gsn_text_ndc, etc).

 "pmTickMarkDisplayMode" is not recognized by wrf_contour.

You should have gotten error messages for all of these.

The second is that you have these two resources:

  opts at sfXArray = lon2d
  opts at sfYArray = lat2d

but these should not be added, because when you use wrf_contour in
conjunction with wrf_map_overlays, it uses the map projection information
on the file to get the correct plot.  If you include these two resources,
you will likely confuse things. I suggest removing them.

--Mary


On Mon, Jun 20, 2016 at 9:42 AM, Saurabh Singh <saurabhsingh123op at gmail.com>
wrote:

> Dear ncl
>
> I am trying to use color palette for opts resource but I am just getting
> black and white screen however in the same panel plot it was implemented on
> res at . ncl version 6.3.0; I don't understand what is going wrong
>
> cl = (/2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16/)
>  opts at gsnMaximize    =False
>   opts at mpDataBaseVersion = "MediumRes"
>   opts at sfXArray = lon2d
>   opts at sfYArray = lat2d
>   opts at cnFillOn = True
>   opts at mpOutlineOn = True
>   opts at gsLineColor      = "Black"
>   opts at FieldTitle= "WRF-SON"
>   opts at NoHeaderFooter = True
>   opts at gsLineThicknessF= 3.0
>   opts at gsnSpreadcolors =False
>   opts at cnSpanFillPalette        = True
>   opts at gsnLeftString         = ""       ; turn off subtitles
>   opts at gsnRightString        = ""
>   ;opts at gsnCenterString       = "WRF"
>   opts at lbLabelBarOn = False
>   opts at lbTitleOn = False
>   opts at txFontHeightF            = 0.05
>   opts at cnInfoLabelFontHeightF   = 0.02
>   opts at cnLevelSelectionMode = "ExplicitLevels"
>   opts at pmTickMarkDisplayMode = "Always"
>   opts at cnLevels     = cl
>   opts at cnFillPalette = "precip3_16lev"
>
>
>   contour = wrf_contour(b,wks,full(:,:),opts)
>
>   plot(0) = wrf_map_overlays(b,wks,(/contour/),pltres,mpres)
>
>  res                =True
>  res at cnFillOn       =True
>  ;res at gsnMaximize    =True
>  ;res at tiMainString   ="this is my first trmm plot"
>  res at mpMinLatF    = latS     ; range to zoom in on
>  res at mpMaxLatF    = latN
>  res at mpMinLonF    = lonL
>  res at mpMaxLonF    = lonR
>  res at PanelPlot = True
> ; res at pmLabelBarOrthogonalPosF = 0.30
>  res at mpDataBaseVersion = "LowRes"
>  res at gsnAddCyclic =False
>  res at vpWidthF =0.88
>  res at vpHeightF =0.88
>  res at gsnLeftString         = "TRMM-SON"       ; turn off subtitles
>   res at gsnRightString        = ""
>   res at gsnCenterString       = ""
>  res at cnLevelSelectionMode = "ExplicitLevels"
>  res at gsnStringFontHeightF = 0.025
>  res at lbLabelBarOn = False
>   res at pmTickMarkDisplayMode = "Always"
>   res at cnInfoLabelFontHeightF   = 0.0001
>  ;res at tmXBLabelFontHeightF   = 0.005
>    res at tiMainFontHeightF   = 0.00025
>  res at NoHeaderFooter = True
>  res at FieldTitle= "TRMM"
>    res at cnInfoLabelFontHeightF   = 0.0001
>  res at cnLevels     = cl
>  cl = (/2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16/)
>  res at cnFillPalette = "precip3_16lev"
>  ;res at cnFillColors         =
> (/"white","honeydew2","honeydew3","LightSkyBlue3","LightSkyBlue",\
>     ;
> "darkslategray1","PaleGreen","lightseagreen","Yellow","khaki4",\
>      ;        "Brown","magenta"/)
>
>
>  plot(1) = gsn_csm_contour_map(wks,rain2,res)
>
>
>
> -
> With regards
> Saurabh Kumar singh
>
>  *P** : * *Please consider the environment before printing this e-mail*
>
>
>
>
> _______________________________________________
> 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/20160621/49593894/attachment.html 


More information about the ncl-talk mailing list