[ncl-talk] An issue with shaded contours in NCL6.4.0

Mary Haley haley at ucar.edu
Wed Jun 27 09:56:55 MDT 2018


Hi Saji,

I was able to reproduce the problem with NCL V6.4.0, and verified that
6.5.0 (in testing right now) also has the issue.

One thing I did note is that if you set:

res at cnFillMode = "RasterFill"
res at cnRasterSmoothingOn = True

you get a very similar plot and it works with 6.3.0 or 6.4.0.

Also, with the original smoothing, if you set cnSmoothingDistanceF to
0.004, then the plot is correct with NCL V6.4.0.

I've attached a modified version of your original script that shows the
results with raster smoothing and with setting different values for
cnSmoothingDistanceF.  Hopefully you can use one of these as a work-around,
if you need to use NCL V6.4.0.

I've reported this issue in ticket NCL-2759. Thanks for providing the files
and the script.

--Mary


On Mon, Jun 25, 2018 at 7:23 PM, Saji Hameed <saji.nh at gmail.com> wrote:

> Hi Mary,
>
> Thank you for checking this. I have uploaded two files (
> saji_rain_jun-sep.nc, saji_landsea_mask.nc) to ftp.cgd.ucar.edu.
> The corresponding NCL script is below (I noted that the issue appears only
> when using the option cnSmoothingOn = True
>
> Best,
> saji
>
> lt1 = 5
> lt2 = 25
> ln1 = 60
> ln2 = 90
>
> fin = addfile("saji_rain_jun-sep.nc","r")
> fmk = addfile("saji_landsea_mask.nc","r")
> rain = fin->var(:,{lt1:lt2},{ln1:ln2})
> msk = fmk->ls_mask({lt1:lt2},{ln1:ln2})
> lmsk =  conform(rain,msk,(/1,2/))
>
> rain_masked = rain
> rain_masked = (/where(lmsk.eq.1, rain at _FillValue,rain) /)
> rjja_masked = dim_avg_n_Wrap(rain_masked,0)
>
> wks = gsn_open_wks("x11","mask_fig")
> gsn_define_colormap(wks,"rainbow")
> res = True
> opt = True
> res at mpMinLatF = lt1
> res at mpMaxLatF = lt2
> res at mpMinLonF = ln1
> res at mpMaxLonF = ln2
> res at gsnAddCyclic = False
> res at cnFillOn              = True
> res at cnLinesOn             = False
> res at cnSmoothingOn   = True     ; <--- The problem is with this one
> plt = gsn_csm_contour_map(wks,rjja_masked,res)
> ; ----- the following one also has the strange issue that I reported ---
> plt = gsn_csm_contour_map(wks,rain_masked(3,:,:),res) ; only the data for
> the last time step
>
>
>
> On Tue, Jun 26, 2018 at 12:14 AM, Mary Haley <haley at ucar.edu> wrote:
>
>> Hi Saji,
>>
>> This is indeed strange.
>>
>> Would it be possible for you to include a script and your data so we can
>> look at the problem here? I especially want to see how the masking is being
>> done, and I can test it using our 6.5.0 beta version.
>>
>> You can use our ftp for this, or put the files on your own site:
>>
>> http://www.ncl.ucar.edu/ftp_files.shtml
>>
>> Thanks,
>>
>> --Mary
>>
>>
>> On Sun, Jun 24, 2018 at 8:02 PM, Saji Hameed <saji.nh at gmail.com> wrote:
>>
>>> Dear NCL developers,
>>>
>>> I would like to report a rather strange issue that appears in version
>>> 6.4.0 of NCL.
>>> The issue is related to shaded contours. For me, the issue happens when
>>> using a dataset for which a mask was applied to "undefine" values over a
>>> portion of the
>>> domain.
>>>
>>> I have attached four figures to illustrate the issue (two of these were
>>> made with
>>> NCL version 6.3.0, and the other two with NCL 6.4.0).
>>>
>>> nomask_ncl6.4.png and nomask_ncl6.3.png are plots of rainfall made using
>>> NCL 6.4.0 and NCL 6.3.0 respectively. There are two panels, with the top
>>> showing a shaded contour plot, and the bottom a simple contour plot.
>>> In the cases shown above, all data in the domain were used. There are no
>>> issues with both the above mentioned plots (they are also identical to each
>>> other, as expected).
>>>
>>> In the next set of plots, I have masked the data over land areas. Once I
>>> do this, I get
>>> unexpected colors (white) for some contour levels (between 10 and 12)
>>> only when using NCL6.4.0.
>>> There is no issue with NCL6.3.0, which plots the data without any
>>> apparent
>>> problems.
>>>
>>> I did note this issue with other plots, but at that time I thought that
>>> I was overusing colors on my desktop, and my OS could not allocate enough
>>> colors to NCL. But only today, I figured out that this is seemingly related
>>> to use of a mask to undefine
>>> portions of the data domain.
>>>
>>> For the time being, I will use NCL6.3.0, and hope that the source of
>>> this issue
>>> can be found and fixed.
>>>
>>> Best regards,
>>> saji
>>>
>>> _______________________________________________
>>> 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/20180627/1a9b4e6e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: contour_smoothing_bug.000003.png
Type: image/png
Size: 160992 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180627/1a9b4e6e/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: contour_smoothing_bug.000001.png
Type: image/png
Size: 123090 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180627/1a9b4e6e/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: contour_smoothing_bug.000002.png
Type: image/png
Size: 100891 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180627/1a9b4e6e/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: contour_bug_jira2759.ncl
Type: application/octet-stream
Size: 3539 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180627/1a9b4e6e/attachment-0001.obj>


More information about the ncl-talk mailing list