
Given two series of year-month values, calculate the Southern Oscillation Index.
function sindex_yrmo(
slpt[*][*] : float,
slpd[*][*] : float,
iprnt[1] : integer
)
function snindex_yrmo(
slpt[*][*] : float,
slpd[*][*] : float,
iprnt[1] : integer,
soi_noise[*][*] : float
)
Both of these routines return the attributes long_name, short_name, and units.
begin
nmos = 12 ; number of months
nyrstrt = 1880 ; first year of data
nyrlast = 1997 ; last year with data
nyrs = (nyrlast-nyrstrt+1) ; total number of years
xmsg = -999.9 ; missing value
ncol = nmos+1 ; number of columns
iprnt = 1 ; print soi out
; ================================> ; READ THE ASCII FILES
filet = asciiread ("tahiti.slp",(/nyrs,ncol/), "float")
filed = asciiread ("darwin.slp",(/nyrs,ncol/), "float")
; create vector/arrays
yr = filet(:,0 ) ; vector containing the years
slpt = filet(:,1:) ; tahiti slp
slpd = filed(:,1:) ; darwin slp
slpt@_FillValue = xmsg
slpd@_FillValue = xmsg
soi = sindex_yrmo (slpt,slpd,iprnt)
print("soi@_FillValue=" + soi@_FillValue)
print(soi@long_name)
print(soi@short_name)
print(soi@units)
xoi_noise = new ( (/nyrs,nmos/), float )
xoi = snindex_yrmo(slpt,slpd,iprnt,xoi_noise)
print(xoi@long_name)
print(xoi@short_name)
print(xoi@units)
end
NG4.1 Home, Index, Examples, Glossary, Feedback, Ref Contents, Ref WhereAmI?