[ncl-talk] confused about plotting t-values (manually)

Noelia otero noeli1680 at gmail.com
Thu Oct 20 01:26:42 MDT 2016


Hi Mary,



I sent a couple of questions few days ago (from gmail) , and I was reading
about some problems regarding the mail list, so I thought that maybe my
mail has not been received …(I can not see it in the mail list). That's why
I also added your email addressee  (sorry for the inconvenience).


I just wanted to re-send my question (see below), in case you can give me a
suggestion.



Thanks in advance!





I'm doing a composite and I'm plotting significant areas (of anomalies).
For that, I computed the t-values manually, and then I was trying to add
contour for those significant values. However, I'm a bit confused..since if
I used gsn_contour_shade for the values greater that the critical value (in
my case) it seems not to work well...so, I 'd like to ask if anyone have a
suggestion. This is part of my code:





     ;Average over the period

      compos_mera = dim_avg(compos_era(lat|:,lon|:,time|:)) ;reordering

      compos_mera!0 = "lat"

      compos_mera!1 = "lon"

      compos_mera&lat = lat

      compos_mera&lon = lon



      ;std

      composStd = dim_stddev_Wrap(compos_era(lat|:, lon|:, time|:)) ;

      composStd at _FillValue = -999

      composVar = dim_variance_n (compos_era,0)

      composVar at _FillValue = -999

      n = dimsizes(timeE) ;number of observations



      ;Compute t-student val for significant

      Scom = composStd/(sqrt(n))

      Scom at _FillValue=-999

      mu = 0 ; set the value to see how anomalies are significantly
different from zero

      tval = (compos_mera - mu)/where(Scom.ne.0, Scom, Scom at _FillValue)
;avoid diving by zero

     abstval= abs(tval)

    ;see table ttest 0.05 2-tailed

      cv = 1.960 ;critival value according to the tables





    ;-------Starting plot------



      res                = True              ; plot mods desired

      res at mpProjection   = "LambertConformal"; choose projection

      res at mpFillOn       = False             ; turn off map fill

      res at cnFillOn       = True              ; turn on color

      res at cnLinesOn      = False             ; turn off contour lines

      res at lbLabelBarOn   = True

      res at gsnDraw        = False

      res at gsnFrame       = False

      res at gsnAddCyclic = False             ; regional plot

      res at gsnMaximize  = True              ; enlarge plot

      res at mpMinLatF    = 30                ; min lat to mask

      res at mpMaxLatF    = 75                ; max lat to mask

      res at mpMinLonF    = -20               ; min lon to mask

      res at mpMaxLonF    = 40                ; max lon to mask

      res at gsnMaskLambertConformal = True            ; turn on lc masking

      res at gsnMaskLambertConformalOutlineOn  = False ; turns off outline



  ;----Plot 2plot (significant values )----

      ; generate shadow plot to overlay

      res2 = True

      res2 at gsnAddCyclic = False

      res2 at gsnDraw = False

      res2 at gsnFrame = False

      res2 at cnInfoLabelOn = False

      res2 at cnLinesOn      = False       ; do not draw contour lines

      res2 at cnFillScaleF = 0.9



      opt = True

      opt at gsnShadeFillType = "pattern"

      opt at gsnShadeHigh = 10





      plot= gsn_csm_contour_map(wks, compos_mera,res)

      plot2 = gsn_csm_contour(wks,abstval,res2)

      plot2= gsn_contour_shade(plot2,-999,cv,opt)



      overlay (plot, plot2)





I also tried to computed the p-values and then make the plot, as follows:



      dim_s = dimsizes(tval) ;lat x lon

      df = new((/dim_s(0),dim_s(1)/),"integer")

      df = n-1

      beta_b = new((/dim_s(0),dim_s(1)/),"float")    ; preallocate space
for beta_b

      beta_b = 0.5                                                    ; set
entire beta_b array to 0.5, the      suggested value of beta_b

      ; according to betainc documentation



      prob = betainc( df/(df+tval^2), df/2.0, beta_b)

      ; Now set up for significant at 0.05





      opt = True

      opt at gsnShadeFillType = "pattern"

      opt at gsnShadeLow = 10



      plot= gsn_csm_contour_map(wks,compos_mera,res)

      plot2 = gsn_csm_contour(wks,prob,res2)

      plot2= gsn_contour_shade(plot2,0.05,-999,opt)



Both ways should be OK, am I wrong? What am I missing here, because looking
at the values, there are significant values, but I don't know why I can't
see it.





Also, regarding my other question, if I want to use bootstrap for showing
significant anomalies…anyone could give an idea about how to use it? I was
wondering if there would be any example about that.




Thanks again!



Best



Noelia.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161020/fab04fc0/attachment.html 


More information about the ncl-talk mailing list