;+ ; NAME: ; big_eph_clean ; PURPOSE: ; (For internal use by big_eph only) ; CATEGORY: ; gen/idl/ephem ; CALLING SEQUENCE: PRO big_eph_clean, tt, rr, names, nodist ; INPUTS: ; tt array[m]; type: time structure ; times ; rr array[3,n,m]; type: double ; position for n bodies at m times ; names array[n]; type: string ; names of m bodies ; nodist array[n]; type: byte ; distance flags for m bodies ; OUTPUTS: ; tt array; type: time structure ; input tt with all times removed for which no ; positions are available ; rr array; type: double ; input rr with all times and all bodies ; removed for which no positions are available ; names array; type: string ; input names with bodies removed for which no ; positions are available ; nodist array; type; byte ; input nodist with bodies removed for which no ; positions are available ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; destroyvar ; MODIFICATION HISTORY: ; JUL-2005, Paul Hick (UCSD/CASS) ; NOV-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ; Fixed serious bug. ;- IF IsType(rr,/defined) THEN BEGIN nt = n_elements(tt) ; Number of times (3rd dim in rr) nb = n_elements(rr)/(3*nt) ; Number of bodies (2nd dim in rr) pp = finite(rr[0,*,*]) pp = reform(pp,nb,nt,/overwrite) ; Array[nb,nt] valid = total(pp) NE 0 CASE valid OF 0: destroyvar, rr, names, nodist ; No valid positions at all 1: BEGIN ; At least one valid position valid = total(pp,2) NE 0 ; Sum over time dimension IF round(total(valid)) LT nb THEN BEGIN ; At least one body with no positions ii = where(valid) ; List of bodies with valid positions rr = rr[*,ii,*] ; Does not remove dummy dimension names = names [ii] ; Only keep bodies with valid positions nodist = nodist[ii] ENDIF valid = total(pp,1) NE 0 ; Sum over body dimension IF round(total(valid)) LT nt THEN BEGIN ; At least one time with no positions ii = where(valid) ; List of times with valid positions rr = rr[*,*,ii] ; Only keep times with valid positions tt = tt[ii] ENDIF ENDCASE END ENDIF RETURN & END