[ncl-talk] 95% confidence interval

Adam Phillips asphilli at ucar.edu
Mon Feb 4 15:35:00 MST 2019


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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190204/db2bf617/attachment.html>


More information about the ncl-talk mailing list