[ncl-talk] NCL functions month_to_annual and

Sri Nandini snandini at marum.de
Wed Jan 24 09:26:41 MST 2018


Hello

I am trying to understand the plotting outcomes of using NCL functions like month_to_annual and dim_avg_n_Wrap.

If i just use the month_to_annual function in this script, then my plot looks like see attached named T2M_month_to_annual.pdf, otherwise if i use month_to_annual and then dim_avg_n_Wrap my plot looks like T2m_dim_avg_n_Wrap.pdf.

Could someone please explain the difference to me? 
All i wish to do is look at the annual mean values of T2m. 

Much appreciated

My script looks like this:

; ==============================================================
; Open the file: Read only the user specified period 
; ==============================================================
f= addfile("T2M_NC.nc", "r")                         ;Model Control

TIME     = f->time
  YYYY   = cd_calendar(TIME,-1)/100                  ; entire file
  iYYYY  = ind(YYYY.ge.yrStrt .and. YYYY.le.yrLast)
T41      = f->TREFHT(iYYYY,:,:)
printVarSummary(T41)                                 ; (time, lat,lon)
T4       = lonFlip(T41)
printVarSummary(T4)                                  ; (time, lat,lon)
T4 at _FillValue = -9.96921e+36     

T2M = month_to_annual(T4, 1)                         ; average over the 0th dim
printVarSummary(T2M)                                 ; (time,lat,lon) 

aveX    = dim_avg_n_Wrap(T2M,0)  
printVarSummary(aveX)                                ; (lat,lon)

varX = dim_variance_n_Wrap(T2M,0)                    ; compute variance the 0th dim
printVarSummary(varX)                                ; (lat,lon) 
;==============================================================================

f2= addfile("T2M_C.nc", "r")                           ;Current Caspian

TIME2     = f2->time
  YYYY2   = cd_calendar(TIME2,-1)/100                   ; entire file
  iYYYY2  = ind(YYYY2.ge.yrStrt .and. YYYY2.le.yrLast)
air22     = f2->TREFHT(iYYYY2,:,:)
air2      = lonFlip(air22)
printVarSummary(air2)                                   ; (time, lat,lon)
air2 at _FillValue = -9.96921e+36                              

T2M_CC = month_to_annual(air2,1)                        ; average over the 0th dim
printVarSummary(T2M_CC)                                 ; (time,lat,lon) 

aveY    = dim_avg_n_Wrap(T2M_CC,0)  
printVarSummary(aveY)                                   ; (lat,lon)

varY = dim_variance_n_Wrap(T2M_CC,0) ; compute variance
printVarSummary(varY)                                   ; (lat,lon) 
;====================================================================
;calculate the T2M difference 
;==================================================================== 
T2diff = new(dimsizes(T2M),typeof(T2M),T2M at _FillValue)
;printVarSummary(T2diff)                                 
copy_VarMeta(T2M,T2diff)
;printVarSummary(T2diff)                                 
T2diff=T2M_CC-T2M
; printVarSummary(T2diff)                          ; (lat,lon) 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180124/74fb11e0/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: T2M_month_to_annual.pdf
Type: application/pdf
Size: 161841 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180124/74fb11e0/attachment-0002.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: T2M_dim_avg_n_Wrap.pdf
Type: application/pdf
Size: 165789 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180124/74fb11e0/attachment-0003.pdf>


More information about the ncl-talk mailing list