Subversion Repositories wimsdev

Rev

Rev 13586 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 reyssat 1
!if $wims_read_parm!=slib_header
13586 bpr 2
  !goto proc
20 reyssat 3
!endif
4161 bpr 4
 
4330 bpr 5
slib_author=Adeline, Grelot; Bernadette, PERRIN-RIOU
4161 bpr 6
 
20 reyssat 7
slib_example=[2,-7,6]\
16287 lemaire 8
[2,-7,6,1]\
20 reyssat 9
[2,-7,6;1,1,4]\
10
[2,1;-7,1;6,4]\
11
[2,-7,6],[1,1,4]
12
 
13
!exit
14
 
15
:proc
16
 
17
!readproc slib/stat/dataproc $wims_read_parm
13586 bpr 18
slib_cnt=!itemcnt item $slib_data
20 reyssat 19
!if $slib_cnt=0
13586 bpr 20
  slib_out=0
20 reyssat 21
!else
13586 bpr 22
  !if $slib_weight<>$empty
23
    slib_d=$empty
24
    !for slib_i =1 to $slib_cnt
25
      slib_w=!item $slib_i of $slib_weight
26
      slib_j=!item $slib_i of $slib_data
27
      slib_r = !values $slib_j for x=1 to $slib_w
28
      slib_d=!append item $slib_r to $slib_d
29
    !next slib_i
30
  slib_data=$slib_d
31
  slib_cnt=!itemcnt item $slib_data
32
  !endif
33
  slib_fml=$empty
20 reyssat 34
 
13586 bpr 35
  !for slib_t in  $slib_data
36
    !!slib_t=!item $slib_i of $slib_data
37
    slib_fml=!append item $[$slib_t] to $slib_fml
38
  !next slib_i
39
  slib_fml=!sort numeric item $slib_fml
40
  !if $[$slib_cnt%2]=1
41
    slib_out=!item $[($slib_cnt+1)/2] of $slib_fml
42
  !else
43
    slib_t1=!item $[$slib_cnt/2] of $slib_fml
44
    slib_t2=!item $[$slib_cnt/2+1] of $slib_fml
45
    slib_out=$[($slib_t1+$slib_t2)/2]
46
  !endif
7692 bpr 47
!endif
20 reyssat 48
slib_out =!trim $slib_out