source: trunk/SRC/ToBeReviewed/IMAGE/animgif.pro @ 142

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

english and nicer header (2a)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.7 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5;
6; @file_comments
7; Build a gif animation
8;
9; @categories
10; Animated drawings.
11;
12; @param NOMFIC {in}{required}
13; It is the name of the gif file containing the animation.
14;          Comment: this file is placed in the directory defined by iodir.
15;
16; @uses
17; common.pro
18;
19; @restrictions
20; We use the Z buffer to go faster!.
21;              So, if it failed in animgif, you have to do:
22;              IDL> device, /close
23;              IDL> set_plot, 'x'
24;              IDL> retall
25;
26; @restrictions
27; If we want to delete the \ @common,
28;               we have to define manually the picture's size
29;               (variables xsize and ysize) just as iodir.
30;
31; @history
32; Guillaume Roullet (grlod@ipsl.jussieu.fr)
33;          Sebastien Masson (smasson@lodyc.jussieu.fr)
34;          30/4/1999
35;
36; @version
37; $Id$
38;
39;-
40;------------------------------------------------------------
41;------------------------------------------------------------
42;------------------------------------------------------------
43PRO animgif, nomfic
44;
45  compile_opt idl2, strictarrsubs
46;
47@common
48;
49;  It recuperates the color palette and put it in red, green, blue.
50;
51   tvlct,  rouge,vert,bleu,/get
52;
53;  It completes the current palette on 256 colors.
54;
55   red = [rouge, replicate(255, 256-n_elements(rouge))]
56   green = [vert, replicate(255, 256-n_elements(rouge))]
57   blue = [bleu, replicate(255, 256-n_elements(rouge))]
58;
59; It rocks on the z device, allowing to create the picture without display it.
60   thisOS = !VERSION.OS_FAMILY
61   thisOS = STRMID(thisOS, 0, 3)
62   thisOS = STRUPCASE(thisOS)
63   set_plot, 'z'
64; size of the picture (in pixel):
65   xsize = 30*(min(page_size, max = ma)*key_portrait + ma*(1-key_portrait))
66   ysize = 30*(min(page_size, max = ma)*(1-key_portrait) + ma*key_portrait)
67   device, set_resolution = [xsize, ysize]
68;
69; Beginning of the gif file. Writing of an empty picture.
70;
71   reinitplt
72   plot, [0], [0], /nodata
73   write_gif,iodir+nomfic,tvrd(),red, green, blue, /multiple
74;
75;
76;----------------------------------------------------------------
77; Beggining of the part we want to change.
78;----------------------------------------------------------------
79;
80; Loop of picture's creation.
81;
82   calen = TIMEGEN(366, START=JULDAY(1,1,2000))
83   debut = where(calen EQ 19810105)
84   debut = where(calen EQ 19790105)
85   debut = debut[0]
86   if debut EQ -1 then begin
87      device, /close
88      CASE thisOS of
89         'MAC': SET_PLOT, thisOS
90         'WIN': SET_PLOT, thisOS
91         ELSE: SET_PLOT, 'X'
92      ENDCASE
93      stop
94   endif
95
96   for i = 0, 73*15-1 do begin
97;   for i = 0, 3*2-1 do begin
98;   for i = 0, 73*2-1 do begin
99;     print, 'Image numero : '+strtrim(i, 2)
100      date = calen[debut+i]
101      erase, 255
102      plt, nlec('sst', date, 'ATF'), 19, 29, int = .5, /noerase
103;      plt, nlec('sss', date, 'ATF'), label = 2, /noerase
104;      plt, nlec('htoth', date, 'RE3')-nlec('hpycn', date, 'RE3'), 10, 60, int = 5, /inv, /noerase
105;      domdef, 290,340,-5,15
106;      plt, norme(nlec('unsurf', date, 'RE3'), nlec('vnsurf', date, 'RE3')), 0, 1.2, int = .1, /noerase
107;
108;     Writing of the picture in the file .gif.
109;
110      write_gif,iodir+nomfic,tvrd(),red, green, blue, /multiple
111   ENDFOR
112;----------------------------------------------------------------
113; End of the part we want to change.
114;----------------------------------------------------------------
115;
116; Closing of the file.
117   write_gif,iodir+nomfic,/close
118; Rerock on terminal X mode.
119;   device, /close
120   CASE thisOS of
121      'MAC': SET_PLOT, thisOS
122      'WIN': SET_PLOT, thisOS
123      ELSE: SET_PLOT, 'X'
124   ENDCASE
125
126
127   return
128end
Note: See TracBrowser for help on using the repository browser.