1 | ;------------------------------------------------------------ |
---|
2 | ;------------------------------------------------------------ |
---|
3 | ;------------------------------------------------------------ |
---|
4 | ;+ |
---|
5 | ; |
---|
6 | ; @file_comments |
---|
7 | ; Allows to reattribuate global variables associated with a field |
---|
8 | ; when we give a structure created by saveatt.pro by example. |
---|
9 | ; |
---|
10 | ; @categories |
---|
11 | ; Utilities |
---|
12 | ; |
---|
13 | ; @param STRUCT {in}{required} |
---|
14 | ; a structure like the one who read litchamp. |
---|
15 | ; See IDL> xhelp,'litchamp' |
---|
16 | ; |
---|
17 | ; @uses |
---|
18 | ; common.pro |
---|
19 | ; |
---|
20 | ; @restrictions |
---|
21 | ; Change the value if global variables attribute of a field: vargrid, |
---|
22 | ; varname, varunit, vardate, varexp , valmask and time. |
---|
23 | ; |
---|
24 | ; @history |
---|
25 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
26 | ; 15/6/1999 |
---|
27 | ; |
---|
28 | ; @version |
---|
29 | ; $Id$ |
---|
30 | ; |
---|
31 | ;- |
---|
32 | ;------------------------------------------------------------ |
---|
33 | ;------------------------------------------------------------ |
---|
34 | ;------------------------------------------------------------ |
---|
35 | PRO restoreatt, struct |
---|
36 | ; |
---|
37 | compile_opt idl2, strictarrsubs |
---|
38 | ; |
---|
39 | @common |
---|
40 | ;------------------------------------------------------------ |
---|
41 | nomelements = tag_names(struct) |
---|
42 | for i = 0, n_tags(struct)-1 do begin |
---|
43 | case strlowcase(strmid(nomelements[i], 0, 1)) of |
---|
44 | 'g':vargrid = strupcase(struct.(i)) |
---|
45 | 'n':varname = struct.(i) |
---|
46 | 'u':varunit = struct.(i) |
---|
47 | 'e':varexp = struct.(i) |
---|
48 | 'm':valmask = struct.(i) |
---|
49 | 'd':BEGIN |
---|
50 | if size(struct.(i),/type) EQ 7 THEN BEGIN |
---|
51 | vardate = struct.(i) |
---|
52 | ENDIF ELSE BEGIN |
---|
53 | vardate = 'time series' |
---|
54 | time = struct.(i) |
---|
55 | ENDELSE |
---|
56 | end |
---|
57 | ELSE:BEGIN |
---|
58 | ras = report('Le nom '+nomelements[i]+' ne correspont a aucun element reconnu de la structure. !C cf. IDL> xhelp, ''litchamp''') |
---|
59 | end |
---|
60 | endcase |
---|
61 | endfor |
---|
62 | ;------------------------------------------------------------ |
---|
63 | return |
---|
64 | end |
---|