[2] | 1 | ;+ |
---|
| 2 | ; |
---|
[238] | 3 | ; @file_comments |
---|
[133] | 4 | ; Build a gif animation |
---|
[2] | 5 | ; |
---|
[238] | 6 | ; @categories |
---|
[325] | 7 | ; Animated drawings |
---|
[2] | 8 | ; |
---|
[325] | 9 | ; @param nomfic {in}{required} |
---|
[142] | 10 | ; It is the name of the gif file containing the animation. |
---|
[325] | 11 | ; Comment: this file is placed in the directory defined by iodir. |
---|
[2] | 12 | ; |
---|
[238] | 13 | ; @uses |
---|
[142] | 14 | ; common.pro |
---|
[2] | 15 | ; |
---|
[238] | 16 | ; @restrictions |
---|
[142] | 17 | ; We use the Z buffer to go faster!. |
---|
[133] | 18 | ; So, if it failed in animgif, you have to do: |
---|
[2] | 19 | ; IDL> device, /close |
---|
| 20 | ; IDL> set_plot, 'x' |
---|
| 21 | ; IDL> retall |
---|
| 22 | ; |
---|
[150] | 23 | ; If we want to delete the \@common, |
---|
[238] | 24 | ; we have to define manually the picture's size |
---|
[133] | 25 | ; (variables xsize and ysize) just as iodir. |
---|
[2] | 26 | ; |
---|
[238] | 27 | ; @history |
---|
[157] | 28 | ; Guillaume Roullet (grlod\@ipsl.jussieu.fr) |
---|
| 29 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
[133] | 30 | ; 30/4/1999 |
---|
[2] | 31 | ; |
---|
[238] | 32 | ; @version |
---|
[142] | 33 | ; $Id$ |
---|
[133] | 34 | ; |
---|
[2] | 35 | ;- |
---|
| 36 | PRO animgif, nomfic |
---|
[114] | 37 | ; |
---|
| 38 | compile_opt idl2, strictarrsubs |
---|
| 39 | ; |
---|
[2] | 40 | @common |
---|
| 41 | ; |
---|
[133] | 42 | ; It recuperates the color palette and put it in red, green, blue. |
---|
[2] | 43 | ; |
---|
| 44 | tvlct, rouge,vert,bleu,/get |
---|
| 45 | ; |
---|
[133] | 46 | ; It completes the current palette on 256 colors. |
---|
[2] | 47 | ; |
---|
[238] | 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))] |
---|
[2] | 51 | ; |
---|
[133] | 52 | ; It rocks on the z device, allowing to create the picture without display it. |
---|
[2] | 53 | thisOS = !VERSION.OS_FAMILY |
---|
| 54 | thisOS = STRMID(thisOS, 0, 3) |
---|
| 55 | thisOS = STRUPCASE(thisOS) |
---|
| 56 | set_plot, 'z' |
---|
[133] | 57 | ; size of the picture (in pixel): |
---|
[23] | 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) |
---|
[2] | 60 | device, set_resolution = [xsize, ysize] |
---|
| 61 | ; |
---|
[238] | 62 | ; Beginning of the gif file. Writing of an empty picture. |
---|
[2] | 63 | ; |
---|
| 64 | reinitplt |
---|
| 65 | plot, [0], [0], /nodata |
---|
| 66 | write_gif,iodir+nomfic,tvrd(),red, green, blue, /multiple |
---|
| 67 | ; |
---|
| 68 | ; |
---|
| 69 | ;---------------------------------------------------------------- |
---|
[133] | 70 | ; Beggining of the part we want to change. |
---|
[2] | 71 | ;---------------------------------------------------------------- |
---|
| 72 | ; |
---|
[133] | 73 | ; Loop of picture's creation. |
---|
[2] | 74 | ; |
---|
[238] | 75 | calen = TIMEGEN(366, START=JULDAY(1,1,2000)) |
---|
[2] | 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 |
---|
[23] | 92 | ; print, 'Image numero : '+strtrim(i, 2) |
---|
[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 |
---|
[238] | 98 | ; domdef, 290,340,-5,15 |
---|
[2] | 99 | ; plt, norme(nlec('unsurf', date, 'RE3'), nlec('vnsurf', date, 'RE3')), 0, 1.2, int = .1, /noerase |
---|
| 100 | ; |
---|
[133] | 101 | ; Writing of the picture in the file .gif. |
---|
[2] | 102 | ; |
---|
| 103 | write_gif,iodir+nomfic,tvrd(),red, green, blue, /multiple |
---|
[238] | 104 | ENDFOR |
---|
[2] | 105 | ;---------------------------------------------------------------- |
---|
[133] | 106 | ; End of the part we want to change. |
---|
[2] | 107 | ;---------------------------------------------------------------- |
---|
| 108 | ; |
---|
[133] | 109 | ; Closing of the file. |
---|
[238] | 110 | write_gif,iodir+nomfic,/close |
---|
[133] | 111 | ; Rerock on terminal X mode. |
---|
| 112 | ; device, /close |
---|
[2] | 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 |
---|