[Thread Prev][Thread Next][Index]

[ferret_users] referencing to datasets relative to current


I have 2*N datasets loaded, N of the sort that contain variable A, and
N sets that contain B.  I want to combine these in certain variable
definitions,  like:

    let N = 5
    let myvar = A[d=1] + B[d=`N+1`]
     !-> DEFINE VARIABLE myvar = A[d=1] + B[d=6]
    set data 1
    let myvar = A + B[d=`N+1`]
     !-> DEFINE VARIABLE myvar = A + B[d=6]

My script always sets the data set to any of {1..N}, so it doesn't have
to be 1.  I can get the dataset number with the dsetnum return value
of A, but as the backtics below are immediately evaluated, the
definition is not updated after changing datasets:

    set data 1
    let dset_num = `A,return=dsetnum`
    let myvar = A + B[d=`N+dset_num`]
    sh var myvar
     MYVAR = A + B[D=6]
    set data 5
    sh var myvar
     MYVAR = A + B[D=6]

However, I want to to get the result

     MYVAR = A + B[D=10]

while not redefining dset_num.  I could make dset_num a symbol, so
that it is evaluated later on, but that results in embedded backtic

Is it at all possible what I want?


Laboratoire des Sciences du Climat et l'Environnement (LSCE)
Tel: +33 1 6908 3876
Www: http://www.lsce.ipsl.fr/Pisp/marco.van-hulten/

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement