[ncl-talk] Problematic when changing color palette in the wrf_contour function
Mary Haley
haley at ucar.edu
Tue Jan 20 12:36:36 MST 2015
Hi Lisi,
In general, with the new way of doing color in NCL V6.2.0 and later, we
recommend that people use "cnFillPalette" and not "cnFillColors".
I know this is confusing for people using the wrf_xxx functions, because
internally, I think these functions may still be trying to use the old way
of doing color.
A quick fix for you is to try:
cmap = read_colormap_file("BlWhRe")
cmap_r = cmap(::-1,:)
opts at gsnSpreadColors = False
opts at cnFillPalette = cmap_r
delete(opts at ContourParameters)
opts at ContourParameters = (/ -150., 150., 10. /)
contour_pbl_diff = wrf_contour(pbl_irri,wks,pbl_ir-pbl_no,opts)
plot(2) =
wrf_map_overlays(wrf,wks,(/contour_pbl_diff/),pltres,mpres)
When you use cnFillPalette, this will automatically span the full colormap,
unless you set cnSpanFillPalette to False. By also setting gsnSpreadColors
to False, this effectively turns off the "old" way of doing color in the
internal WRF routines.
--Mary
On Tue, Jan 20, 2015 at 12:06 PM, Lisi Pei <lisipei at msu.edu> wrote:
> Hi There,
>
> I tried a couple of hours already on changing the color table in the
> wrf_contour function. It seems that other than the default color map it is
> problematic to apply any other color maps.
> What I really want to apply is the symmetrical color tables like BlWhRe. I
> scaled my data contour parameter as (/-10.,10.,10./) for example to check
> if this color table displays the white color. It is not. I want to have the
> white color displaying the 0s in the data, would you show me how? And also
> the main problem in applying this color table in the wrf_contour is that
> the offset is significant which means the white color never centers at the
> 0.
> Part of my codes are here:
>
> cmap = read_colormap_file("BlWhRe")
> cmap_r = cmap(::-1,:)
>
> ;opts at gsnSpreadColors = True
> opts at cnFillColors = cmap_r
> delete(opts at ContourParameters)
> opts at ContourParameters = (/ -150., 150., 10. /)
> contour_pbl_diff = wrf_contour(pbl_irri,wks,pbl_ir-pbl_no,opts)
> plot(2) =
> wrf_map_overlays(wrf,wks,(/contour_pbl_diff/),pltres,mpres)
>
> I even tried subset the BlWhRe to select the range centered at the white
> color (36:68,37:67,38:66...) but the offset is still there.
>
> Thanks..
>
>
> L.
>
> _______________________________________________
> ncl-talk mailing list
> 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/20150120/a7298bec/attachment.html
More information about the ncl-talk
mailing list