! bn_eof_4d.jnl
! test EOFs on XYZT grids

! In version 6.8 (double precision), the old eof functions are not available
! Run the script calling eofsvd functions and exit, leaving old eof function calls.

! dataset with 4 dimensions; compute EOF at each vertical level.

use gt4d011.cdf

let eofsp = eofsvd_space (temp[i=91:95,j=36:40,k=1:4])
save/file=eofsp.cdf/clobber eofsp

can data/all
can var/all
use eofsp

set view ul
shade eofsp[k=1,l=1]
list eofsp[k=1,l=1]
set view ur
shade eofsp[k=2,l=1]
list eofsp[k=2,l=1]

set view ll
shade eofsp[k=3,l=1]
list eofsp[k=3,l=1]
set view lr
shade eofsp[k=4,l=1]
list eofsp[k=4,l=1]

can data/all


use gt4d011.cdf

let eofti = eofsvd_tfunc (temp[i=91:95,j=36:40,k=1:10])
save/file=eofti.cdf/clobber eofti

can data/all
can var/all
can view
use eofti

set view ul
plot eofti[i=1,k=1], eofti[i=2,k=1], eofti[i=3,k=1]
list eofti[l=1:5,i=1,k=1]
set view ur
plot eofti[i=1,k=5], eofti[i=2,k=5], eofti[i=3,k=5]
list eofti[l=1:5,i=1,k=5]

set view ll
plot eofti[i=1,k=8], eofti[i=2,k=8], eofti[i=3,k=8]
list eofti[l=1:5,i=1,k=8]
set view lr
plot eofti[i=1,k=4], eofti[i=2,k=10], eofti[i=3,k=10]
list eofti[l=1:5,i=1,k=10]

can data/all



use gt4d011.cdf

let eofst = eofsvd_stat (temp[i=91:95,j=36:40,k=1:10])
save/file=eofst.cdf/clobber eofst

can data/all
can var/all
use eofst

list/nohead/i=1/j=1/k=1:10 eofst   ! # eigenfcns, same at all depths

list/nohead/i=1:5/j=2 eofst[k=1:10:4]  ! pct variance explained

list/nohead/i=1:5/j=3/k=1 eofst  ! eigenvalues
list/nohead/i=1:5/j=3/k=5 eofst
list/nohead/i=1:5/j=3/k=9 eofst

! The functions need updating for double precision Ferret
exit/script
! -----------------------------------------------
! previous commands that called eof_space, eof_stat, eof_tfunc

! dataset with 4 dimensions; compute EOF at each vertical level.

use gt4d011.cdf

let eofsp = eof_space (temp[i=91:95,j=36:40,k=1:4], 1.)
save/file=eofsp.cdf/clobber eofsp

can data/all
can var/all
use eofsp

set view ul
shade eofsp[k=1,l=1]
list eofsp[k=1,l=1]
set view ur
shade eofsp[k=2,l=1]
list eofsp[k=2,l=1]

set view ll
shade eofsp[k=3,l=1]
list eofsp[k=3,l=1]
set view lr
shade eofsp[k=4,l=1]
list eofsp[k=4,l=1]

can data/all


use gt4d011.cdf

let eofti = eof_tfunc (temp[i=91:95,j=36:40,k=1:10], 1.)
save/file=eofti.cdf/clobber eofti

can data/all
can var/all
can view
use eofti

set view ul
plot eofti[i=1,k=1], eofti[i=2,k=1], eofti[i=3,k=1]
list eofti[l=1:5,i=1,k=1]
set view ur
plot eofti[i=1,k=5], eofti[i=2,k=5], eofti[i=3,k=5]
list eofti[l=1:5,i=1,k=5]

set view ll
plot eofti[i=1,k=8], eofti[i=2,k=8], eofti[i=3,k=8]
list eofti[l=1:5,i=1,k=8]
set view lr
plot eofti[i=1,k=4], eofti[i=2,k=10], eofti[i=3,k=10]
list eofti[l=1:5,i=1,k=10]

can data/all



use gt4d011.cdf

let eofst = eof_stat (temp[i=91:95,j=36:40,k=1:10], 1.)
save/file=eofst.cdf/clobber eofst

can data/all
can var/all
use eofst

list/nohead/i=1/j=1/k=1:10 eofst   ! # eigenfcns, same at all depths

list/nohead/i=1:5/j=2 eofst[k=1:10:4]  ! pct variance explained

list/nohead/i=1:5/j=3/k=1 eofst  ! eigenvalues
list/nohead/i=1:5/j=3/k=5 eofst
list/nohead/i=1:5/j=3/k=9 eofst


