1 | ;------------------------------------------------------------ |
---|
2 | ;------------------------------------------------------------ |
---|
3 | ;------------------------------------------------------------ |
---|
4 | ;+ |
---|
5 | ; NAME:restoreatt |
---|
6 | ; |
---|
7 | ; PURPOSE:permet de reattribuer les variables globales associees a un |
---|
8 | ; champ qd on donne une stucture cree par ex par saveatt.pro. |
---|
9 | ; |
---|
10 | ; CATEGORY:allegement d''ecriture |
---|
11 | ; |
---|
12 | ; CALLING SEQUENCE:restoreatt, structure |
---|
13 | ; |
---|
14 | ; INPUTS:une structure comme celle que lit litchamp. |
---|
15 | ; cf. IDL> xhelp,'litchamp' |
---|
16 | ; |
---|
17 | ; COMMON BLOCKS: |
---|
18 | ; common.pro |
---|
19 | ; |
---|
20 | ; SIDE EFFECTS: change la valeur des variables globales attributs |
---|
21 | ; d''un champ: vargrid, varname, varunit, vardate, varexp , valmask, |
---|
22 | ; niveau et time |
---|
23 | ; |
---|
24 | ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) |
---|
25 | ; 15/6/1999 |
---|
26 | ;- |
---|
27 | ;------------------------------------------------------------ |
---|
28 | ;------------------------------------------------------------ |
---|
29 | ;------------------------------------------------------------ |
---|
30 | PRO restoreatt, struct |
---|
31 | @common |
---|
32 | ;------------------------------------------------------------ |
---|
33 | nomelements = tag_names(struct) |
---|
34 | for i = 0, n_tags(struct)-1 do begin |
---|
35 | case strlowcase(strmid(nomelements[i], 0, 1)) of |
---|
36 | 'g':vargrid = strupcase(struct.(i)) |
---|
37 | 'n':varname = struct.(i) |
---|
38 | 'u':varunit = struct.(i) |
---|
39 | 'e':varexp = struct.(i) |
---|
40 | 'l':niveau = struct.(i) |
---|
41 | 'm':valmask = struct.(i) |
---|
42 | 'd':BEGIN |
---|
43 | if size(struct.(i),/type) EQ 7 THEN BEGIN |
---|
44 | vardate = struct.(i) |
---|
45 | ENDIF ELSE BEGIN |
---|
46 | vardate = 'time series' |
---|
47 | time = struct.(i) |
---|
48 | ENDELSE |
---|
49 | end |
---|
50 | ELSE:BEGIN |
---|
51 | ras = report('Le nom '+nomelements[i]+' ne correspont a aucun element reconnu de la structure. !C cf. IDL> xhelp, ''litchamp''') |
---|
52 | end |
---|
53 | endcase |
---|
54 | endfor |
---|
55 | ;------------------------------------------------------------ |
---|
56 | return |
---|
57 | end |
---|