[ncl-talk] Contour plot fill error with low values

Adam Phillips asphilli at ucar.edu
Mon Jul 30 11:32:16 MDT 2018


Hi Guido,
That does seem odd, and not the behavior that one would expect. One of the
NCL developers would have to speak as to if that is the intended graphical
outcome. Two possible solutions:
1 - When the array does not have a max greater than the first contour
level, set the array for that timestep to _FillValue
2 - When the array does not have a max greater than the first contour
level, skip the plotting.

Demonstration of solution 2:
do time_i=1,dimsizes(time)-1
 ResC at gsnCenterString= "Forecast for "+cd_string(time(time_i), "%d %c.
%Y")+" at "+cd_string(time(time_i), "%H:%M")+" UTC"
 wks =
gsn_open_wks(wkstype,folder_output+"precip_clouds_"+date_string(time_i))

 plot = gsn_csm_contour_map(wks,clcl(time_i,:,:),ResC)
 if (max(clch(time_i,:,:).ge.ResC3 at cnMinLevelValF) then
    over_clouds=gsn_csm_contour(wks,clch(time_i,:,:), ResC3)
    overlay(plot,over_clouds)
 end if
  if (max(rain(time_i,:,:).ge.ResC2 at cnLevels(0)) then
   over=gsn_csm_contour(wks, rain(time_i,:,:), ResC2)
   overlay(plot,over)
  end if
 draw(plot)
 frame(wks)
end do

Hope that helps!
Adam




On Wed, Jul 25, 2018 at 1:02 AM Guido Cioni <guidocioni at gmail.com> wrote:

> Bumping up this issue in case it was lost in translation.
>
> On 9. Jul 2018, at 12:13, Guido Cioni <guidocioni at gmail.com> wrote:
>
> Dear all,
> I've been struggling with this problem for a while now, and that led me to
> believe that I may have discovered a bug or at least an unexpected
> behaviour.
>
> Little bit of background. I process NWP model output daily for my website
> and among the multiple plots that I do with NCL there is one that uses mid-
> low-level clouds, precip. and snow on the same map. Now, what happens
> sometimes is that values of either rain or snow are really small or even 0.
> Although I have fixed explicit levels, this causes the plotting routine to
> produce the warning
>
> warning:ContourPlotSetValues: Data values out of range of levels set by
> EXPLICITLEVELS mode
>
> and fill the entire contour area with a single color, as you can see in
> the animation that I'm attaching. This basically covers everything on the
> plot, making any interpretation of the results impossible. I think that,
> even in the case of low values, the entire area should stay transparent...
>
> <output.gif>
> Is there any way to fix this?
>
> I'm attaching an example script.
> <plot_rain_clouds_nord.ncl>
> Cheers
>
> Guido Cioni
> http://guidocioni.altervista.org
>
>
>
> Guido Cioni
> http://guidocioni.altervista.org
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180730/222b023d/attachment.html>


More information about the ncl-talk mailing list