[ncl-talk] P Value Plot (contour) in NCL

Atul Saini atulsainimail at gmail.com
Sat Nov 21 07:15:17 MST 2020


I hope the code given below (in blue) is fine to get the correct P-values.
Please confirm.


begin

; specify file names (input&output, netCDF)
  pathin =
"./media/atul/Seagate_Atul/IGS_MonsoonOnsetPaper/Result/1_SD/fldmean_allyears/ttest_datafiles/"
                 ; directory
  fin1 = "File1.nc"  ; input file name #1
  fin2 = "File2.nc"  ; input file name #2
  ;fout = "signif_eraint_t2m_DJF"      ; output file name
  ;foutnc = fout+".nc"

; open input files
  in1 = addfile(pathin+fin1,"r")
  in2 = addfile(pathin+fin2,"r")

; read data
  tmp1 = in1->rf
  tmp2 = in2->rf

; t-test
  xtmp = tmp1(lat|:,lon|:,time|:)
  ytmp = tmp2(lat|:,lon|:,time|:)
  ;xtmp = tmp1(latitude|:,longitude|:,time|:)
  ;ytmp = tmp2(latitude|:,longitude|:,time|:)
  Xave = dim_avg_Wrap(xtmp)
  Yave = dim_avg_Wrap(ytmp)
  Xvar = dim_variance(xtmp)
  Yvar = dim_variance(ytmp)
  Xs   = dimsizes(tmp1(0,0,:))
  Ys   = dimsizes(tmp2(0,0,:))
  iflag    = False  ; population variance similar
  tval_opt = False  ; p-value only
  prob = ttest(Xave,Xvar,Xs,Yave,Yvar,Ys,iflag,tval_opt)



Regards,

*                                   Mob. No. +91-8130662361 /
+91-9868636507*
*
https://www.researchgate.net/profile/Atul_Saini3
<https://www.researchgate.net/profile/Atul_Saini3>*



On Sat, Nov 21, 2020 at 7:28 PM Atul Saini <atulsainimail at gmail.com> wrote:

> Herewith this mail I attached datafiles of two different periods.
>
> One is controlled and another one uncontrolled. (File 1 and File 2
> attached)
>
> Please help me with a sample script to plot the p-value < 0.1 on the map
> with different colours.
>
> I have tried Example 4 given on the
> https://www.ncl.ucar.edu/Document/Functions/Built-in/ttest.shtml web-link.
>
> But it is not helping me.
>
> Your guidance to solve the issue is very important.
>
> Regards,
>
> *                                   Mob. No. +91-8130662361 /
> +91-9868636507*
> *
> https://www.researchgate.net/profile/Atul_Saini3
> <https://www.researchgate.net/profile/Atul_Saini3>*
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201121/52fb3c50/attachment.html>


More information about the ncl-talk mailing list