! bn_ens_promote_global.jnl
! *acm* 6/4/2018   Issue 1667

! When making ensembles, promote global attributes of member
! sets to variables, so can examine, e.g. model_run description.

ensemble fourfiles =  memb2, memb3, memb1, memb4
show data

sh dat/att
sh att .

! List a numeric file variable
list/i=1/j=2/l=1 sst

! and a string file variable
list mystring

! Dataset names collected as a variable on the Ens axis

say `mystring[d=2],return=dset`
list member_dset

! Global attributes promoted to variables on Ens axis


! strings
list model_run

list/e=2:3 model_run

set data fourfiles
show att .

! Title is a global att in only some sets
list title


! investigator is a global att in only some sets, is not in 1st set.
list investigator

! Numeric single-valued attributes become numeric variables.
! any sets that don't have the attribute are represented by missing-value
list number

! Numeric multi-valued attributes become strings listing the values.
! any sets that don't have the attribute are represented by null string
list numlist

! A global attribute matching a file variable is promoted using a changed name
! Global attribute sst becomes promoted variable sst_g_
list sst_g_

! Multiple ensembles defined
cancel data/all

ensemble f1 = memb2, memb3
ensemble f2 = memb1, memb4

set data f1
show data
list model_run, title

set data f2
show data
list model_run, title, investigator


