source: trunk/SRC/Matrix/congridseb.pro @ 133

Last change on this file since 133 was 133, checked in by navarro, 18 years ago

english and nicer header (1)

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5; @file_comment
6; Like congrid but here, it works...
7;        example:
8;IDL> print, congrid([[1,2,3,4],[5,6,7,8]],12,4)
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
13;IDL> print, rebin([[1,2,3,4],[5,6,7,8]],12,4)
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
18;IDL> print, congridseb([[1,2,3,4],[5,6,7,8]],12,4)
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;
24; @categories utilities
25;
26; @param tableau {in}{required} A table 1 ou 2d
27;
28; @param x {in}{required} dimension in x of the result which must be
29;                         a multiple of the dimension in x of the table.
30;
31; @param y {in}{required} dimension in y of the result which must be
32;                         a multiple of the dimension in y of the table.
33;
34; @returns res a table dim x * y
35;
36; @history Sebastien Masson (smasson@lodyc.jussieu.fr)
37;                      20/3/98
38;                      18/6/1999 supression d''une horrible boucle
39;
40; @version $Id$
41;
42;-
43;------------------------------------------------------------
44;------------------------------------------------------------
45;------------------------------------------------------------
46function congridseb, tableau, x, y
47;
48  compile_opt idl2, strictarrsubs
49;
50   res=tableau
51   taille = size(tableau)
52   CASE N_PARAMS() OF
53      2: begin
54         res=replicate(1,1.*x/taille[1])#res[*]
55         return, res[*]
56      end
57      3: begin
58         res = transpose(res)
59         res = replicate(1, 1.*y/taille[2])#res[*]
60         res = reform(res, y, taille[1], /over)
61         res = transpose(res)
62         res = replicate(1, 1.*x/taille[1])#res[*]
63        return, reform(res, x,y, /overwrite)
64      end
65      else: return, report('Mauvais nombre de parametre dans l''appel de CONGRIDSEB')
66   endcase           
67end
Note: See TracBrowser for help on using the repository browser.