[ncl-talk] 95% confidence interval
Adam Phillips
asphilli at ucar.edu
Tue Feb 5 13:15:33 MST 2019
Hi Kunal,
Thank you for sending along an easy-to-run script so one can easily test. I
recommended that you take out your mask statements, as there was no need to
use those statements (and you were masking all values = 100). Removing
those lines showed what the issue is. I altered the script to simply plot
the unmasked significance array in raster mode with your 95-100 by 1
contours shown, and have attached the results here. As you can see, most
of the plot is equal to 100. The grid cells in purple are less than 95, and
thus not considered significant at the 95% level. These areas coincide with
your correlation values being near 0 (in the plot you originally sent).
Seems reasonable. Thus, as far as the graphics go there is nothing
incorrect with what is being plotted. The areas that you thought were
greater than 95% were actually less than 95%. Here are the resources I set
to get the attached plot:
res2=True
res2 at gsnLeftString = ""
res2 at gsnRightString = ""
res2 at gsnDraw = False ; Do not draw plot
res2 at gsnFrame = False ; Do not advance frome
res2 at cnLinesOn = True ; turn off contour lines
res2 at cnLevelSelectionMode = "ManualLevels" ; manually specify contour
levels
res2 at cnMinLevelValF = 95 ; min level
res2 at cnMaxLevelValF = 100 ; max level
res2 at cnLevelSpacingF = 1 ; contour interval
res2 at cnFillOn = True
res2 at cnFillMode = "RasterFill"
plotb=gsn_csm_contour(wks,sig_Dec, res2) ; contours are at 90,100
draw(plotb)
frame(wks)
Adam
On Mon, Feb 4, 2019 at 10:44 PM Kunal Bali <kunal.bali9 at gmail.com> wrote:
> Thanks for the suggestions sir and I modified the script accordingly, but
> still, I couldn't able to plot 95% CI.
>
> I attached the original data with my original script. so please provide
> some information on that.
>
> thanks
>
>
>
>
> ---
> Kunal Bali
>
>
>
>
>
>
> On Tue, Feb 5, 2019 at 4:05 AM Adam Phillips <asphilli at ucar.edu> wrote:
>
>> Hi Kunal,
>> I do not have any experience with the rtest function, but I do know that
>> you should not need to mask your sig_Dec array. Also note that you are
>> creating contours from 90 to 100 by 1, and that you do not really need to
>> use gsn_contour_shade.
>> Try this:
>>
>> prob_Dec=rtest(ccr,24,0)
>> sig_Dec =100*(1-prob_Dec)
>> copy_VarAtts(ts2, sig_Dec)
>> copy_VarCoords_1(ts1,sig_Dec)
>>
>> res2=True
>> res2 at gsnLeftString = ""
>> res2 at gsnRightString = ""
>> res2 at gsnDraw = False ; Do not draw plot
>> res2 at gsnFrame = False ; Do not advance frome
>> res2 at cnLinesOn = False ; turn off contour lines
>> res2 at lbLabelBarOn = False ; turn
>> off label bar
>> res2 at cnFillColor = "black"
>> res2 at cnLevelSelectionMode = "ExplicitLevels" ; explicitly specify
>> contour levels
>> res2 at cnLevels = 95. ; set one contour: 95
>> res2 at cnMonoFillPattern = False
>> res2 at cnFillPatterns = (/0,16/) ; all values .lt.95 set to full
>> fill, values .ge.95 = fill pattern 16
>> res2 at cnMonoFillColor = False
>> res2 at cnFillColors = (/"transparent","black"/) ; set all values .lt.95
>> = transparent, all values .ge.95 = black
>>
>> plotc=gsn_csm_contour(wks,sig_Dec, res2) ; contour is at 95
>>
>> If that does not work let ncl-talk know, and send along your sig_Dec
>> array (in a .nc file) so everyone can look at the array.
>> Adam
>>
>> On Sat, Feb 2, 2019 at 10:14 AM Kunal Bali <kunal.bali9 at gmail.com> wrote:
>>
>>> Dear NCL users,
>>>
>>> for computing 95% CI, I used the following code.
>>> In that, I am trying to first calculate the 95% CI and then overlay
>>> (with pattern/shading fill) with the other plot. But I am not getting the
>>> 95% area over the high correlation area. So, could you please let me know
>>> whether I am using the correct code or not.
>>> The result is also attached herewith.
>>>
>>>
>>> ;**********************************************
>>> ;Calculating significance
>>> ;**********************************************
>>>
>>> prob_Dec=rtest(ccr,24,0)
>>> sig_Dec =100*(1-prob_Dec)
>>>
>>> printVarSummary(sig_Dec)
>>>
>>> copy_VarAtts(ts2, sig_Dec)
>>> copy_VarCoords_1(ts1,sig_Dec)
>>>
>>> sig_Dec = mask(sig_Dec, sig_Dec.ge.100,False)
>>> sig_Dec = mask(sig_Dec, sig_Dec.lt.90,False)
>>>
>>>
>>> res2=True
>>> res2 at gsnLeftString = ""
>>> res2 at gsnRightString = ""
>>> res2 at gsnDraw = False ; Do not draw plot
>>> res2 at gsnFrame = False ; Do not advance frome
>>> ;res2 at cnMonoFillColor = False
>>> res2 at cnLinesOn = False ; turn off contour lines
>>> res2 at lbLabelBarOn = False ; turn
>>> off label bar
>>> res2 at cnFillColor = "black"
>>> res2 at cnLevelSelectionMode = "ManualLevels" ; manually specify
>>> contour levels
>>> res2 at cnMinLevelValF = 90 ; min level
>>> res2 at cnMaxLevelValF = 100 ; max level
>>> res2 at cnLevelSpacingF = 1 ; contour interval
>>> res2 at gsnSpreadColors = False
>>>
>>>
>>> plotB=gsn_csm_contour(wks,sig_Dec, res2) ; contours are at 90,100
>>>
>>> opt = True
>>> opt at gsnShadeFillType = "pattern" ; pattern fill
>>> opt at gsnShadeHigh =16 ; use pattern #2
>>> opt at gsnShadeFillDotSizeF = 2
>>> plotc=gsn_contour_shade(plotB,-999.,90.,opt)
>>>
>>>
>>> pmres = True
>>> pmres at gsMarkerColor = "white" ;-- marker color
>>> pmres at gsMarkerSizeF = 50 ;-- set size of marker
>>> pmres at gsLineThicknessF = 46. ;-- marker line thickness
>>> pmres at gsMarkerIndex = 1
>>> pmres at gsFillColor = "white"
>>>
>>>
>>> SUMMARY:
>>>
>>> Variable: ts1
>>>
>>> Type: float
>>>
>>> Total Size: 389486592 bytes
>>>
>>> 97371648 values
>>>
>>> Number of Dimensions: 3
>>>
>>> Dimensions and sizes: [lat | 2112] x [lon | 1921] x [time | 24]
>>>
>>> Coordinates:
>>>
>>> lat: [5.0078125..37.9921875]
>>>
>>> lon: [ 68.. 98]
>>>
>>> time: [9465090..9465113]
>>>
>>> Number Of Attributes: 8
>>>
>>> vmin : -1e+15
>>>
>>> vmax : 1e+15
>>>
>>> fmissing_value : 1e+15
>>>
>>> missing_value : 1e+15
>>>
>>> _FillValue : 1e+15
>>>
>>> units : kg m-3
>>>
>>>
>>>
>>> Variable: ts2
>>>
>>> Type: float
>>>
>>> Total Size: 389486592 bytes
>>>
>>> 97371648 values
>>>
>>> Number of Dimensions: 3
>>>
>>> Dimensions and sizes: [lat | 2112] x [lon | 1921] x [time | 24]
>>>
>>> Coordinates:
>>>
>>> lat: [5.0078125..37.9921875]
>>>
>>> lon: [ 68.. 98]
>>>
>>> time: [9466530..9466553]
>>>
>>> Number Of Attributes: 8
>>>
>>> vmin : -1e+15
>>>
>>> vmax : 1e+15
>>>
>>> fmissing_value : 1e+15
>>>
>>> missing_value : 1e+15
>>>
>>> _FillValue : 1e+15
>>>
>>> units : m
>>>
>>>
>>>
>>> Variable: ccr
>>>
>>> Type: float
>>>
>>> Total Size: 16228608 bytes
>>>
>>> 4057152 values
>>>
>>> Number of Dimensions: 2
>>>
>>> Dimensions and sizes: [2112] x [1921]
>>>
>>> Coordinates:
>>>
>>> Number Of Attributes: 1
>>>
>>> _FillValue : 1e+15
>>>
>>> (0) min=-0.996108 max=0.325499
>>>
>>>
>>> Variable: sig_Dec
>>>
>>> Type: float
>>>
>>> Total Size: 16228608 bytes
>>>
>>> 4057152 values
>>>
>>> Number of Dimensions: 2
>>>
>>> Dimensions and sizes: [2112] x [1921]
>>>
>>> Coordinates:
>>>
>>>
>>>
>>>
>>> ---
>>> Kunal
>>>
>>>
>>>
>>> _______________________________________________
>>> 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>
>>
> _______________________________________________
> 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/20190205/acec3a4d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sig.png
Type: image/png
Size: 35212 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190205/acec3a4d/attachment.png>
More information about the ncl-talk
mailing list