[ncl-talk] RasterFill and MissingValFill

Adam Phillips asphilli at ucar.edu
Fri Nov 20 10:44:42 MST 2015


Hi Evelyn,
Dave is exactly correct in what is going on here. The contouring/shading
for the missing areas are being drawn correctly regardless of the setting
of cnFIllMode. The missing value perimeter line is being drawn at the
center of the grid cells *next to* grid cells set to _FIllValue regardless
of the setting of cnFIllMode. When you set cnFillMode = "RasterFill" NCL
does not need to look at neighboring grid cells for shading and can shade
the whole cell, thus decreasing the shaded missing areas.

The question then is should NCL change the position of the missing value
perimeter line depending on the setting of cnFillMode? That would likely
create as many questions as the current set up.

Thanks for sending a short easy-to-read script and your data files. That
always makes testing things easier. I do have a solution for you. I created
a second plot where cnFillColor is set to transparent and cnFillMode =
"AreaFill". Thus, the only aspect of the original plot being drawn is the
missing value shading and perimeter line. I then overlay this plot on the
original plot. See the attached script and resulting output graphic. Note
that if you are going to frequently switch between a setting of RasterFill
and AreaFill it might be good to put the overlay plot coding into a
user-defined function instead of an if statement like I did.

Hope that all makes sense. If you have any questions let ncl-talk know. And
thanks to Dave for chiming in and identifying what was going on.
Adam


On Thu, Nov 19, 2015 at 4:45 PM, Dave Allured - NOAA Affiliate <
dave.allured at noaa.gov> wrote:

> Adam,
>
> I think this is a very old issue; I have seen this before with
> RasterFill.  Actually there IS a difference in how missing values are
> shaded, and it is normal.  The problem is with the the perimeter lines, not
> the missing value shading.
>
> Missing value areas are drawn correctly in both modes, it is just that the
> area shaded for non-missing data is naturally larger in RasterFill mode
> than in AreaFill mode.  RasterFill draws the normal shaded data areas an
> extra 1/2 cell width into missing value regions.
>
> As far as I can remember, the missing value perimeter line has ALWAYS
> followed edges as generated by AreaFill, regardless of alternate cnFillMode
> settings.  I do not know whether there was ever any intention of changing
> the perimeter line to follow the cnFillMode, or whether this was just a
> feature intended only for normal AreaFill mode.  I did not find any clues
> in ContourPlot documentation.  HTH.
>
> --Dave
>
>
> On Wed, Nov 18, 2015 at 4:45 PM, Adam Phillips <asphilli at ucar.edu> wrote:
>
>> Hi Evelyn,
>> There should not be any difference in how the missing values are shaded.
>> Can you send us a simplified version of your script and data files so we
>> can take a look?  If the data files are too big to send over ncl-talk you
>> can use our ftp site:
>> http://www.ncl.ucar.edu/report_bug.shtml#HowToFTP
>> Also, please let us know what version of NCL you are using..
>> Adam
>>
>> On Tue, Nov 17, 2015 at 2:50 PM, Evelyn Grell - NOAA Affiliate <
>> evelyn.grell at noaa.gov> wrote:
>>
>>> Hi,
>>>
>>> I am plotting cross-sections and was filling the area below ground with
>>> a gray fill, more or less representing the terrain.  This seemed to be
>>> working fine until I plotted a field using cnFillMode  = "RasterFill".  In
>>> that case, the "missing" perimeter line is in the same place, but the gray
>>> fill does not cover the entire area under the perimeter line.  See attached
>>> plots.
>>> Since I would like to compare plots -- some with rasterfill and some
>>> with the default areafill, it is awkward to explain why the terrain looks
>>> different.  Is there a way around this?  I can remove the perimeter line,
>>> but the gray-filled area is different.
>>>
>>> Relevant resources:
>>>
>>>      res at cnMissingValPerimOn     = True
>>>      res at cnMissingValFillColor   = "gray"
>>>      res at cnMissingValFillPattern = 0
>>>
>>> The only difference between plots is whether this line is used:
>>>      resDBZ at cnFillMode      = "RasterFill"
>>>
>>> Thanks,
>>> Evelyn
>>>
>>


-- 
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/20151120/9cf16fb4/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xs_refl_test_raster.png
Type: image/png
Size: 103841 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151120/9cf16fb4/attachment.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot_xs_rastertest.ncl
Type: text/x-ncl
Size: 5341 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151120/9cf16fb4/attachment.bin 


More information about the ncl-talk mailing list