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

Last change on this file was 495, checked in by pinsard, 10 years ago

fix thanks to coding rules; typo; dupe empty lines; trailing blanks

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