# Re: [ferret_users] about loops and listing...

```Hi Otacilio,
A quick start on an answer. Others may have more to add:

```
I think you should be able to do this without the repeat loop. If I understand your question correctly, you want the variable med6, and it's computed from the variable media which is a variable that's defined on a time axis with units of hours. Is that correct?
```
Then define the variable

yes? let med6 = media-media[l=@shf:6]

! Now, this would list one value per line,

yes? let site = "Acarau"

```
```
```
and you could just use an editor to put the values on a line. Or you could get a listing with all the values on one line as follows. It's a bit awkward, but will work
```
yes? list
```
list/form=('Acarau', 14f8.4) med6[7], med6[13], med6[19], med6[25], med6[31], ...
```

And the indices to use in your script can be computed by this:

yes? let tt = t[t=1:85]
yes? list tt[l=7:85:6]
VARIABLE : T[T=1:85]
regrid: 6 delta on T
SUBSET   : 14 points (T)
7    /  1:   7.00
13   /  2:  13.00
19   /  3:  19.00
25   /  4:  25.00
31   /  5:  31.00
37   /  6:  37.00
43   /  7:  43.00
49   /  8:  49.00
55   /  9:  55.00
61   / 10:  61.00
67   / 11:  67.00
73   / 12:  73.00
79   / 13:  79.00
85   / 14:  85.00

Otacilio Leandro wrote:
```
```Hello to everyone,

```
I'm trying to wirte a script that gives me precipitaion over certain sites (39 sites) and i need the means over 6 and 24 hours of precipitation over those site as well.
```
I've made a script that gives me:

I / *:    "Acarau" "dia=0" "hora=03"  0.2029
I / *:    "Acarau" "dia=0" "hora=09"  0.3002
I / *:    "Acarau" "dia=0" "hora=15"  0.2963
I / *:    "Acarau" "dia=0" "hora=21"  0.1371
I / *:    "Acarau" "dia=1" "hora=03"  0.01867
I / *:    "Acarau" "dia=1" "hora=09"  0.01743
I / *:    "Acarau" "dia=1" "hora=15"  0.003194
I / *:    "Acarau" "dia=1" "hora=21"  0.09149
I / *:    "Acarau" "dia=2" "hora=03"  0.08146
I / *:    "Acarau" "dia=2" "hora=09"  0.2907
I / *:    "Acarau" "dia=2" "hora=15"  0.2202
I / *:    "Acarau" "dia=2" "hora=21"  0.2775
I / *:    "Acarau" "dia=3" "hora=03"  0.1548
I / *:    "Acarau" "dia=3" "hora=09"  0.4112

and I'de like to write these results at one line only like:

"Acarau"  0.2029 0.3002  0.2963 0.1371 and so on...

```
The script that i'm using now is (its just a part of it, responsible for this list):
```
repeat/range=7:85:6/name=c ( \
let ndia = int((c-4)/24) ; \
let hora = (c-4)-ndia*24; if `hora lt 10` then let hora = "0`hora`" ; \
```
let med6 = media[l=`c`]-media[l=`c-6`] ; \ ! med6 = media de 6 horas do total acumulado
```let time = "hora=`hora`" ; \
let time2 = "dia=`ndia`" ; \

Where Acarau is the name of the 1st site, dia = day and hora = hour

I appreciate the help

--
Ms. Otacilio Leandro de Menezes Neto
Grupo de Modelagem Atmosférica
Departamento de Meteorologia e Oceanografia
Fundação Cearense de Meteorologia e Recursos Hídricos
Av. Rui Barbosa 1246 - CEP 60115-221
Fortaleza, Ceará
Fone: (85) 3101-1106 / 3101-1126
```
```
```