[85] | 1 | pro findxy, $ |
---|
| 2 | x=x, $ ;;IN |
---|
| 3 | y=y, $ ;;IN |
---|
| 4 | point=point, $ ;;IN |
---|
| 5 | ind=ind, $ ;;OUT |
---|
| 6 | flag=flag ;;IN OPT |
---|
| 7 | |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | pointint=[0,0] |
---|
| 11 | |
---|
| 12 | ;;;if (point eq 'VL1') then pointint=[-48.22,22.70] |
---|
| 13 | ;;;if (point eq 'VL2') then pointint=[133.74,47.93] |
---|
| 14 | ;;;if (point eq 'PAT') then pointint=[-33.5,19.1] |
---|
| 15 | |
---|
| 16 | if (n_elements(point) eq 2) then begin |
---|
| 17 | pointint=point |
---|
| 18 | endif else begin |
---|
| 19 | ;;Si lon=312.050381 et lat=22.269628, alt=-3637.1396 |
---|
| 20 | ;;Si lon=134.282101 et lat=47.668093, alt=-4497.0474 |
---|
| 21 | ;;Si lon=326.747364 et lat=19.099641, alt=-3681.9993 |
---|
| 22 | if (point eq 'VL1') then pointint=[312.050381-360.,22.269628] |
---|
| 23 | if (point eq 'VL2') then pointint=[134.282101,47.668093] |
---|
| 24 | if (point eq 'PAT') then pointint=[326.747364-360.,19.099641] |
---|
| 25 | endelse |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | if (n_elements(x) eq 0) then print, 'set x=' |
---|
| 30 | if (n_elements(y) eq 0) then print, 'set y=' |
---|
| 31 | if (n_elements(flag) eq 0) then flag=1 |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | x=reform(x) |
---|
| 35 | y=reform(y) |
---|
| 36 | |
---|
| 37 | ind=intarr(2) |
---|
| 38 | |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | CASE (flag) OF |
---|
| 42 | 1: begin |
---|
| 43 | |
---|
| 44 | minim=abs(x-pointint(0)) |
---|
| 45 | w=where(minim eq min(minim)) |
---|
| 46 | print, 'distance is ', minim(w(0)) |
---|
| 47 | ind[0]=w(0) |
---|
| 48 | |
---|
| 49 | minim=abs(y-pointint(1)) |
---|
| 50 | w=where(minim eq min(minim)) |
---|
| 51 | print, 'distance is ', minim(w(0)) |
---|
| 52 | ind[1]=w(0) |
---|
| 53 | |
---|
| 54 | end |
---|
| 55 | 2: begin |
---|
| 56 | |
---|
| 57 | distance = sqrt((x - pointint(0))^2 + (y - pointint(1))^2) |
---|
| 58 | mx = min(distance, location) |
---|
| 59 | print, 'distance 2D is ',mx |
---|
| 60 | ind = array_indices(distance, location) |
---|
| 61 | print, 'on ... ', pointint(0), pointint(1) |
---|
| 62 | print, 'found ... ', x[ind(0),ind(1)], y[ind(0),ind(1)] |
---|
| 63 | |
---|
| 64 | end |
---|
| 65 | endcase |
---|
| 66 | |
---|
| 67 | end |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | |
---|