[Thread Prev][Thread Next][Index]

Re: [ferret_users] How to index a new variable?



Hi,
Rather than trying to write loops, look for Ferret transformations or functions that let you define a new variable that captures the operation you want to use.

define axis/x=1:10:1 xax
let array = x[gx=xax]
let array_1 = array[x=@ddb]

If you read the first chapter of the Users Guide, you'll start to see how best to use the program.  Then the next few chapters give details about different aspects of using Ferret.

Ansley

On 8/23/2011 1:24 PM, PaulaOCN Nunes wrote:

Hello,

I want to calculate the resolution on satellite images and need to index new variables, but I can't go through...
To learn the syntax, I tried with a simple vector (from 1 to 10), and then made a loop to create a new vector, as follows:

define axis/x=1:10:1 xax
let array = x[gx=xax]
repeat/i=2:10:1 (\
let array_1  IF I[GX=array] EQ `i` THEN (array[i=`i`]-array[i=`i-1`]); list array, array_1)
list array, array_1

             X: 0.5 to 10.5
 Column  1: ARRAY is X[GX=XAX]
 Column  2: ARRAY_1 is IF I[GX=ARRAY] EQ 10 THEN (ARRAY[I=10]-ARRAY[I=9])
           ARRAY  ARRAY_1
1    /  1:   1.00    ....
2    /  2:   2.00    ....
3    /  3:   3.00    ....
4    /  4:   4.00    ....
5    /  5:   5.00    ....
6    /  6:   6.00    ....
7    /  7:   7.00    ....
8    /  8:   8.00    ....
9    /  9:   9.00    ....
10   / 10:  10.00   1.000

The problem is that the new variable only gets the last value of the loop. Please, would someone help?

Thanks!
Paula Lamosa Nunes

 

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

Privacy Policy | Disclaimer | Accessibility Statement