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

Last change on this file since 261 was 238, checked in by pinsard, 17 years ago

improvements/corrections of some *.pro headers

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