[Thread Prev][Thread Next][Index]

[ferret_users] A request for variable construction



Hi to all.

In ferret, you can can construct a variable variable from scratch with something like A=I[I=1:5]  :

yes? LIST I[I=1:5]
             VARIABLE : I
                        axis ABSTRACT
             SUBSET   : 5 points (X)
 1   / 1:  1.000
 2   / 2:  2.000
 3   / 3:  3.000
 4   / 4:  4.000
 5   / 5:  5.000

You can limit the range :

yes? LIST I[I=3:5]
             VARIABLE : I
                        axis ABSTRACT
             SUBSET   : 3 points (X)
 3   / 3:  3.000
 4   / 4:  4.000
 5   / 5:  5.000

But you can not extend before zero : 

yes? LIST I[I=0:5]
             VARIABLE : I
                        axis ABSTRACT
             SUBSET   : 5 points (X)
 1   / 1:  1.000
 2   / 2:  2.000
 3   / 3:  3.000
 4   / 4:  4.000
 5   / 5:  5.000

Neither can you skip values : 
yes? LIST I[I=1:6:2]
             VARIABLE : I
                        axis (AX004)
             SUBSET   : 3 points (X)
 1   / 1:  1.000
 3   / 2:  2.000
 5   / 3:  3.000


Of course, we got an obvious and simple solution to construct these variables :
yes? LIST 2*I[I=1:4]-2
             VARIABLE : 2*I[I=1:4]-2
             SUBSET   : 4 points (X)
 1   / 1:  0.000
 2   / 2:  2.000
 3   / 3:  4.000
 4   / 4:  6.000


But we could have simpler and clearer scripts if the _expression_ I[0:6:2] could give directly this result.

Best regards,

Olivier

— 
Olivier Marti  - LSCE Bât 714 p. 1049
MERMAID Team
Normal situation :  +33 1 69 08 77 27 
Corona lockdown  :  +33 6 45 36 43 74

Attachment: smime.p7s
Description: S/MIME cryptographic signature


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

Privacy Policy | Disclaimer | Accessibility Statement