Last change
on this file since 53 was
53,
checked in by pinsard, 18 years ago
|
upgrade of ToBeReviewed?/HOPE according to cerbere.lodyc.jussieu.fr: /usr/home/smasson/SAXO_RD/
|
-
Property svn:executable set to
*
|
File size:
760 bytes
|
Rev | Line | |
---|
[53] | 1 | |
---|
| 2 | |
---|
| 3 | function sortdim, dims, inverse=inverse |
---|
| 4 | ; |
---|
| 5 | ; IDL> a=['x','y','t','z'] |
---|
| 6 | ; IDL> b=a[sortdim(a)] |
---|
| 7 | ; IDL> print, a |
---|
| 8 | ; x y t z |
---|
| 9 | ; IDL> print, b |
---|
| 10 | ; x y z t |
---|
| 11 | ; IDL> print, b[sortdim(a,/inv)] |
---|
| 12 | ; x y t z |
---|
| 13 | ; IDL> a='xytz' |
---|
| 14 | ; IDL> print, sortdim(a) |
---|
| 15 | ; 0 1 3 2 |
---|
| 16 | ; |
---|
| 17 | ; |
---|
| 18 | ; |
---|
| 19 | tosort = dims |
---|
| 20 | if n_elements(tosort) eq 1 then $ |
---|
| 21 | tosort = string(reform(byte(tosort),1,(strlen(tosort))[0])) |
---|
| 22 | tosort = strrepl(tosort,strwhere(tosort,'x'),'a') |
---|
| 23 | tosort = strrepl(tosort,strwhere(tosort,'y'),'b') |
---|
| 24 | tosort = strrepl(tosort,strwhere(tosort,'z'),'c') |
---|
| 25 | tosort = strrepl(tosort,strwhere(tosort,'t'),'d') |
---|
| 26 | tosort = uniq(tosort,sort(tosort)) |
---|
| 27 | if keyword_set(inverse) then tosort=sort(tosort) |
---|
| 28 | return, tosort |
---|
| 29 | |
---|
| 30 | end |
---|
| 31 | ; |
---|
| 32 | |
---|
Note: See
TracBrowser
for help on using the repository browser.