[ncl-talk] Do not show significance level in a correlation map
Adam Phillips
asphilli at ucar.edu
Tue Jan 16 13:08:36 MST 2024
Hi Jalal,
I was able to plug in a monthly SST dataset that I have here, so I was able
to run your script. So I think what is happening is that the stippling is
so small/faint/sparse that it is hard to see it. I made two changes to your
script:
1 - I was getting stippling over land as the rtest function was seemingly
not recognizing the _FillValue of the input array. (I find this strange,
but have not used rtest before.) To fix this, I put in a where statement
and added the _FillValue attribute to your p array:
p = rtest(r_sst,42,0)
* p at _FillValue = 1.e20*
copy_VarCoords(r_sst, p)
* p = where(ismissing(r_sst),p at _FillValue,p)*
2 - I modified/added the following gsn_contour_shade options to make the
stippling more visible:
* opt at gsnShadeFillScaleF = 0.25 ; add extra density
opt at gsnShadeFillDotSizeF = 0.0015*
I have attached the modified script, along with the plot that I am getting.
Hope that helps!
Best,
Adam
On Mon, Jan 15, 2024 at 8:58 PM Md. Jalal Uddin <dmjalal90 at gmail.com> wrote:
> Thank you very much, sir. I used the following resources:
>
> opt = True
> opt at gsnShadeFillType = "pattern"
> opt at gsnShadeLow = 17 ; stipple
> opt at gsnShadeFillScaleF = 0.5 ; add extra density
>
> plot = gsn_csm_contour_map(wks,r_sst, res) ; create plot
> plot2 = gsn_csm_contour(wks,p, res2)
> plot2 = gsn_contour_shade(plot2,0.05,999.,opt)\
>
> overlay (plot, plot2)
>
> draw(plot)
> frame(wks)
>
> However, I did not get output as stipple areas where p value is less than
> 0.05. I added the full code including Nino data in the attachment. Should I
> send the SST data (sst.mon.mean.nc) via ftp?
>
> On Sat, 13 Jan 2024 at 06:55, Adam Phillips <asphilli at ucar.edu> wrote:
>
>> Hi Jalal,
>> As you are pattern filling, and the default is color filling, you need to
>> set:
>> opt at gsnShadeFillType = "pattern"
>> I am also unclear what you mean by this statement:
>> "...to show the significance level as a shaded pattern where p value is
>> less than 0.05 and 0.01"
>>
>> Do you want to stipple areas less than .05? If so the following code
>> should do that:
>> opt = True
>> opt at gsnShade*Low* = 17 ; stipple
>> opt at gsnShadeFillScaleF = 0.5 ; add extra density
>> plot2 = gsn_contour_shade(plot2,0.05,999.,opt)
>>
>> If instead you want to stipple areas less than .01, you will need to
>> modify the contour levels in your res2 resource list to have a contour at
>> .01:
>> res2 at cnMinLevelValF = 0.00 ; set min contour level
>> res2 at cnMaxLevelValF = .10 ; set max contour level
>> res2 at cnLevelSpacingF = 0.01 ; set contour spacing
>>
>> opt = True
>> opt at gsnShade*Low* = 17 ; stipple
>> opt at gsnShadeFillScaleF = 0.5 ; add extra density
>> plot2 = gsn_contour_shade(plot2,0.01,999.,opt)\
>>
>> Hope that answers your question. As always please respond to the ncl-talk
>> email list with further questions.
>> Best,
>> Adam
>>
>> On Fri, Jan 5, 2024 at 6:15 AM Md. Jalal Uddin via ncl-talk <
>> ncl-talk at mailman.ucar.edu> wrote:
>>
>>> Dear all,
>>>
>>> I have tried to use the gsn_contour_shade function to show the
>>> significance level as a shaded pattern where p value is less than 0.05 and
>>> 0.01. However, the output map does not show the shaded areas (please see
>>> the attached map).
>>>
>>> Here are some codes:
>>> r_sst = escorc(ano_nino,ano_sstSON(lat|:,lon|:,time|:)) ;
>>> ccr(lat,lon)
>>> copy_VarCoords(ano_sstSON(0,:,:), r_sst)
>>> r_sst at long_name = "Correlation: r_sst"
>>>
>>> p = rtest(r_sst,42,0)
>>> copy_VarCoords(r_sst, p)
>>>
>>> opt = True
>>> opt at gsnShadeHigh = 17 ; stipple
>>> opt at gsnShadeFillScaleF = 0.5 ; add extra density
>>> opt at gsnShadeFillDotSizeF = 0.002 ; make dots larger
>>>
>>> plot = gsn_csm_contour_map(wks,r_sst, res) ; create plot
>>>
>>> plot2 = gsn_csm_contour(wks,p, res2)
>>> plot2 = gsn_contour_shade(plot2,0.01,0.05,opt)
>>>
>>> overlay (plot, plot2)
>>>
>>> draw(plot)
>>> frame(wks)
>>>
>>> Please find the full code in the attached file.
>>>
>>> Any suggestions would be appreciated.
>>>
>>> --
>>>
>>> *Regards,*
>>>
>>> Dr. Jalal
>>>
>>> *Postdoctoral Researcher,* Typhoon Research Center, Jeju National
>>> University, South Korea
>>>
>>> *PhD* in Atmospheric Physics and Atmospheric Environment, NUIST, China
>>>
>>> *M.Sc.* in Applied Meteorology, NUIST, China
>>>
>>> *B.Sc.* in Disaster Management, PSTU, Bangladesh
>>>
>>> *Founder and Director* of Research Society
>>>
>>> *Website*: https://researchsociety20.org/founder-and-director/
>>>
>>> *E-mails*: founder-and-director at researchsociety20.org
>>>
>>> jalal at jejunu.ac.kr
>>>
>>> 20205103002 at nuist.edu.cn
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at mailman.ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>
>>
>> --
>> Adam Phillips
>> Associate Scientist IV, Climate Analysis Section
>> Climate and Global Dynamics Laboratory
>> National Center for Atmospheric Research
>> www.cgd.ucar.edu/staff/asphilli/
>>
>> <http://www.cgd.ucar.edu/staff/asphilli>
>>
>
>
> --
>
> *Regards,*
>
> Dr. Jalal
>
> *Postdoctoral Researcher,* Typhoon Research Center, Jeju National
> University, South Korea
>
> *PhD* in Atmospheric Physics and Atmospheric Environment, NUIST, China
>
> *M.Sc.* in Applied Meteorology, NUIST, China
>
> *B.Sc.* in Disaster Management, PSTU, Bangladesh
>
> *Founder and Director* of Research Society
>
> *Website*: https://researchsociety20.org/founder-and-director/
>
> *E-mails*: founder-and-director at researchsociety20.org
>
> jalal at jejunu.ac.kr
>
> 20205103002 at nuist.edu.cn
>
--
Adam Phillips
Associate Scientist IV, Climate Analysis Section
Climate and Global Dynamics Laboratory
National Center for Atmospheric Research
www.cgd.ucar.edu/staff/asphilli/
<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20240116/bbc3f472/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sst_corr.ncl
Type: application/octet-stream
Size: 4613 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20240116/bbc3f472/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sst_SepNov_cor.png
Type: image/png
Size: 545972 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20240116/bbc3f472/attachment-0001.png>
More information about the ncl-talk
mailing list