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 | ; 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 | ;- |
---|
36 | PRO 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 | ;---------------------------------------------------------------- |
---|
70 | ; Beggining of the part we want to change. |
---|
71 | ;---------------------------------------------------------------- |
---|
72 | ; |
---|
73 | ; Loop of picture's creation. |
---|
74 | ; |
---|
75 | calen = TIMEGEN(366, START=JULDAY(1,1,2000)) |
---|
76 | debut = where(calen EQ 19810105) |
---|
77 | debut = where(calen EQ 19790105) |
---|
78 | debut = debut[0] |
---|
79 | if debut EQ -1 then begin |
---|
80 | device, /close |
---|
81 | CASE thisOS of |
---|
82 | 'MAC': SET_PLOT, thisOS |
---|
83 | 'WIN': SET_PLOT, thisOS |
---|
84 | ELSE: SET_PLOT, 'X' |
---|
85 | ENDCASE |
---|
86 | stop |
---|
87 | endif |
---|
88 | |
---|
89 | for i = 0, 73*15-1 do begin |
---|
90 | ; for i = 0, 3*2-1 do begin |
---|
91 | ; for i = 0, 73*2-1 do begin |
---|
92 | ; print, 'Image numero : '+strtrim(i, 2) |
---|
93 | date = calen[debut+i] |
---|
94 | erase, 255 |
---|
95 | plt, nlec('sst', date, 'ATF'), 19, 29, int = .5, /noerase |
---|
96 | ; plt, nlec('sss', date, 'ATF'), label = 2, /noerase |
---|
97 | ; plt, nlec('htoth', date, 'RE3')-nlec('hpycn', date, 'RE3'), 10, 60, int = 5, /inv, /noerase |
---|
98 | ; domdef, 290,340,-5,15 |
---|
99 | ; plt, norme(nlec('unsurf', date, 'RE3'), nlec('vnsurf', date, 'RE3')), 0, 1.2, int = .1, /noerase |
---|
100 | ; |
---|
101 | ; Writing of the picture in the file .gif. |
---|
102 | ; |
---|
103 | write_gif,iodir+nomfic,tvrd(),red, green, blue, /multiple |
---|
104 | ENDFOR |
---|
105 | ;---------------------------------------------------------------- |
---|
106 | ; End of the part we want to change. |
---|
107 | ;---------------------------------------------------------------- |
---|
108 | ; |
---|
109 | ; Closing of the file. |
---|
110 | write_gif,iodir+nomfic,/close |
---|
111 | ; Rerock on terminal X mode. |
---|
112 | ; device, /close |
---|
113 | CASE thisOS of |
---|
114 | 'MAC': SET_PLOT, thisOS |
---|
115 | 'WIN': SET_PLOT, thisOS |
---|
116 | ELSE: SET_PLOT, 'X' |
---|
117 | ENDCASE |
---|
118 | |
---|
119 | |
---|
120 | return |
---|
121 | end |
---|