[2] | 1 | ;------------------------------------------------------------ |
---|
| 2 | ;------------------------------------------------------------ |
---|
| 3 | ;------------------------------------------------------------ |
---|
| 4 | ;+ |
---|
[136] | 5 | ; @file_comments |
---|
[133] | 6 | ; Like congrid but here, it works... |
---|
| 7 | ; example: |
---|
[136] | 8 | ; IDL> print, congrid([[1,2,3,4],[5,6,7,8]],12,4) |
---|
[2] | 9 | ; 1 1 1 2 2 2 3 3 3 3 4 4 |
---|
| 10 | ; 1 1 1 2 2 2 3 3 3 3 4 4 |
---|
| 11 | ; 5 5 5 6 6 6 7 7 7 7 8 8 |
---|
| 12 | ; 5 5 5 6 6 6 7 7 7 7 8 8 |
---|
[136] | 13 | ; IDL> print, rebin([[1,2,3,4],[5,6,7,8]],12,4) |
---|
[2] | 14 | ; 1 1 1 2 2 2 3 3 3 4 4 4 |
---|
| 15 | ; 3 3 3 4 4 4 5 5 5 6 6 6 |
---|
| 16 | ; 5 5 5 6 6 6 7 7 7 8 8 8 |
---|
| 17 | ; 5 5 5 6 6 6 7 7 7 8 8 8 |
---|
[136] | 18 | ; IDL> print, congridseb([[1,2,3,4],[5,6,7,8]],12,4) |
---|
[2] | 19 | ; 1 1 1 2 2 2 3 3 3 4 4 4 |
---|
| 20 | ; 1 1 1 2 2 2 3 3 3 4 4 4 |
---|
| 21 | ; 5 5 5 6 6 6 7 7 7 8 8 8 |
---|
| 22 | ; 5 5 5 6 6 6 7 7 7 8 8 8 |
---|
| 23 | ; |
---|
[133] | 24 | ; @categories utilities |
---|
[2] | 25 | ; |
---|
[136] | 26 | ; @param tableau {in}{required} |
---|
| 27 | ; A table 1 ou 2d |
---|
[2] | 28 | ; |
---|
[136] | 29 | ; @param x {in}{required} |
---|
| 30 | ; dimension in x of the result which must be |
---|
| 31 | ; a multiple of the dimension in x of the table. |
---|
[2] | 32 | ; |
---|
[136] | 33 | ; @param y {in}{required} |
---|
| 34 | ; dimension in y of the result which must be |
---|
| 35 | ; a multiple of the dimension in y of the table. |
---|
[2] | 36 | ; |
---|
[136] | 37 | ; @returns |
---|
| 38 | ; a table dim x * y |
---|
[2] | 39 | ; |
---|
[136] | 40 | ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
[133] | 41 | ; 20/3/98 |
---|
| 42 | ; 18/6/1999 supression d''une horrible boucle |
---|
[2] | 43 | ; |
---|
[133] | 44 | ; @version $Id$ |
---|
[2] | 45 | ; |
---|
| 46 | ;- |
---|
| 47 | ;------------------------------------------------------------ |
---|
| 48 | ;------------------------------------------------------------ |
---|
| 49 | ;------------------------------------------------------------ |
---|
| 50 | function congridseb, tableau, x, y |
---|
[114] | 51 | ; |
---|
| 52 | compile_opt idl2, strictarrsubs |
---|
| 53 | ; |
---|
[2] | 54 | res=tableau |
---|
| 55 | taille = size(tableau) |
---|
| 56 | CASE N_PARAMS() OF |
---|
| 57 | 2: begin |
---|
| 58 | res=replicate(1,1.*x/taille[1])#res[*] |
---|
| 59 | return, res[*] |
---|
| 60 | end |
---|
| 61 | 3: begin |
---|
| 62 | res = transpose(res) |
---|
| 63 | res = replicate(1, 1.*y/taille[2])#res[*] |
---|
| 64 | res = reform(res, y, taille[1], /over) |
---|
| 65 | res = transpose(res) |
---|
| 66 | res = replicate(1, 1.*x/taille[1])#res[*] |
---|
| 67 | return, reform(res, x,y, /overwrite) |
---|
| 68 | end |
---|
| 69 | else: return, report('Mauvais nombre de parametre dans l''appel de CONGRIDSEB') |
---|
[136] | 70 | endcase |
---|
[2] | 71 | end |
---|