[ncl-talk] Spatial plot for Significance of Linear Trend

Sri Nandini snandini at marum.de
Wed Mar 7 04:00:09 MST 2018


Hello
 Using the given code, i attach the 2 pltos i get from doing trend analysis on T2m and getting the significance. IT seems really small and i am not convinced these are the right values.
Could someone please have a look at the script below which i used and confirm i use the right scripting for getting getting significance of and linear trends for plotting.
Much appreciated

Here is the part of my code that works:

yrStrt = 2020
yrLast = 2099
;===================================================================
f= addfile("T2M_45.nc", "r") ;
time   = f->time
YYYY   = cd_calendar(time,-1)/100                                              ; entire file
iYYYY  = ind(YYYY.ge.yrStrt .and. YYYY.le.yrLast)
T2    = f->TREFHT(iYYYY,:,:)
printVarSummary(T2)                                                            ; (time, lat,lon)
T2=T2-273.15
T2 at _FillValue = -9.96921e+36       
T2 at units= "degC"
printVarSummary(T2)                                                            ; (time, lat,lon)

;=======================================================================
;Very important to give the year dimension its cordinates
;=======================================================================
  yyyymm = cd_calendar(T2&time, -1)
   yyyy   = yyyymm/100

   dimx = dimsizes(T2)
   ntim = dimx(0)                ; all years and months
   nlat = dimx(1)
   mlon = dimx(2)

   year  = ispan(yyyy(0), yyyy(ntim-1), 1)
   nyrs  = dimsizes(year)

;=========================================================================
 T2mm    = month_to_annual(T2, 1) 
 T2mm&year  = year
 printVarSummary(T2mm)   
;=============================================================
; Calculate the regression coefficients (slopes)    
;=============================================================
  
tarr1 = T2mm(lat|:,lon|:,year|:)   
     printVarSummary(tarr1)   
                                                         ; (time, lat,lon)        
tttt1 = dtrend_msg(ispan(0,dimsizes(tarr1&year)-1,1),tarr1,True,True)   
        printVarSummary(tttt1)   
finobs1 = tarr1(:,:,0)                                         
finobs_rtt1 = finobs1                                            
finobs1 = (/ onedtond(tttt1 at slope, (/dimsizes(tarr1&lat),dimsizes(tarr1&lon)/) ) /)   ; reform the slope attribute to 2D (lat x lon) array. This will be used for plotting the trend
       printVarSummary(finobs1)    

tval1 = tarr1(:,:,0) 
df1 = tarr1(:,:,0)                                                                                             
rc1 = regcoef(ispan(0,dimsizes(tarr1&year)-1,1),tarr1,tval1,df1)                           ; tval and df are filled in by regcoef

df1 = equiv_sample_size(tarr1,0.05,0)                                                       ; Optional! over rule df returned from regcoef. 

df1 = df1-2                                                                            ;regcoef/equiv_sample_size return N, need N-2
beta_b1 = tval1
beta_b1 = 0.5

printVarSummary(df1)                                                                 ;lat,lon  
printVarSummary(tval1)                                                               ;lat,lon 

 finobs_rtt1 = (/ (1.-betainc(df1/(df1+tval1^2), df1/2.0, beta_b1))*100. /) ; significance of trends expressed from 0 to 100%
printVarSummary(finobs_rtt1)       
;print(finobs_rtt1)                                        ; (time, lat,lon)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180307/8d472b5d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: T2mTrend_RCP.pdf
Type: application/pdf
Size: 915467 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180307/8d472b5d/attachment-0001.pdf>


More information about the ncl-talk mailing list