[ncl-talk] computing the model SOI index

Sri nandini bax8609 at uni-hamburg.de
Tue Apr 13 09:34:12 MDT 2021


Hello dear ncl-users,

I am trying to compute the model SOI index to draw a timeseries plot. I 
have studies the examples on the ncl page for indices_soi_1.ncl and 
indices_soi_2.ncl , and made my script as per the methods here. But each 
time an error occurs when reading the time: fatal:An error occurred 
reading YYYY

Variable: TIME
Type: double
Total Size: 14976 bytes
             1872 values
Number of Dimensions: 1
Dimensions and sizes:    [time | 1872]
Coordinates:
             time: [18500131.99444444..20051231.99444444]
Number Of Attributes: 4
   standard_name :    time
   units :    hours since 1850-01-31 23:15:00
   calendar :    standard
   axis :    T

Variable: YYYY
Type: integer
Total Size: 7488 bytes
             1872 values
Number of Dimensions: 1
Dimensions and sizes:    [1872]

Could someone reply to me offline, or help point me to a query or 
ncl-talk which already solved this or i can also transfer my datafile 
via ftp? Below is my script.

; =============================================================
   latT    = -17.6         ; Tahiti
   lonT    = 210.75
   latD    = -12.5         ; Darwin
   lonD    = 130.83

   PLOT    = True
   pltType = "png"         ; send graphics to PNG file
   pltDir  = "./"          ; dir to which plots are sent

   pltName = "indices_soi"
   yrStrt  = 1950          ; manually specify for convenience
   yrLast  = 2010          ; 20th century ends 2010

   clStrt  = 1950          ; reference climatology for SOI
   clLast  = 1979
; ======================End User 
Input=======================================
   nmos   = 12
   nyrs   = yrLast-yrStrt+1

   fslp   = addfile("hist_1850-2005_ens_1-100.slp.nc", "r")
   slp    = fslp->slp
   printVarSummary(slp)
   TIME   = fslp->time
   printVarSummary(TIME)
   ;YYYYMM = cd_calendar(TIME, -1) ;error here

   YYYY   = cd_calendar(TIME,-2)/100

   tStrt  = ind(YYYY .eq. (yrStrt*100 +  1))       ; indices 20th century
   tLast  = ind(YYYY .eq. (yrLast*100 + 12))       ; relative to entire 
dataset

   yyyymm = YYYY(tStrt:tLast)
   tStrtP = ind(yyyymm .eq. (yrStrtP*100+  1))       ; relative to 
yrStrt, yrLast
   tLastP = ind(yyyymm .eq. (yrLastP*100+ 12))

   T      = short2flt(fslp->slp(1632:1871,:,{latT},{lonT}))
   D      = short2flt(fslp->slp(1632:1871,:,{latD},{lonD}))
   printVarSummary(T)
   printVarSummary(D)
   T&time = yyyymm                                   ; convenience
   D&time = yyyymm

   tClmStrt = ind(yyyymm.eq.(clStrt*100 +  1))       ; index for clStrt
   tClmLast = ind(yyyymm.eq.(clLast*100 + 12))       ; index for clStrt
   printVarSummary(tClmStrt)
   printVarSummary(tClmLast)
   TClm   = new ( nmos, typeof(T), T at _FillValue)     ; monthly climatologies
   DClm   = new ( nmos, typeof(D), D at _FillValue)

   do nmo=0,nmos-1
    ;do n=0,99                                 ; reference clm for each 
month and each ensemble member?
      TClm(nmo) = avg(T(tClmStrt+nmo:tClmLast:nmos))
      DClm(nmo) = avg(D(tClmStrt+nmo:tClmLast:nmos))
   end do
  end do
   printVarSummary(TClm)
   printVarSummary(DClm)
   TAnom    = T
   DAnom    = D
   do nmo=0,nmos-1                                   ; anomalies 
reference clim
      TAnom(nmo::nmos) = T(nmo::nmos) - TClm(nmo)
      DAnom(nmo::nmos) = D(nmo::nmos) - DClm(nmo)
   end do
   printVarSummary(TAnom)
   printVarSummary(DAnom)

   TAnomStd   = stddev(TAnom(tClmStrt:tClmLast))     ; stddev of 
anomalies over clStrt & clLast
   DAnomStd   = stddev(DAnom(tClmStrt:tClmLast))
   printVarSummary(TAnomStd)
printVarSummary(DAnomStd) ; signal and noise
   soi_signal = (TAnom/TAnomStd) - (DAnom/DAnomStd)  ; (ntim)
   copy_VarCoords(TAnom, soi_signal)
   soi_signal at long_name = "SOI: 20th Century Reanalysis: "+yrStrt+"-"+yrLast
   printVarSummary(soi_signal)

;=======================================
; lag-0 correlation
;=======================================

   rslp  = escorc(soi_signal,slp(lat|:,lon|:,ens:|,time|:))
   copy_VarCoords(slp(0,:,:,:), rslp)
   rslp at long_name = "Correlation: SOI-SLP: "+yrStrt+"-"+yrLast
   printVarSummary(rslp)

Best

Sri

-- 
Dr. Sri, Nandini-Weiss
Research Associate

Universität Hamburg
Center for Earth System Research and Sustainability (CEN)
Cluster of Excellence 'Climate, Climatic Change, and Society' (CLICCS)

Bundesstrasse 53, 20146 Hamburg



More information about the ncl-talk mailing list