;+ ; NAME: ; usno_test ; PURPOSE: ; Test program for USNO asteroid ephemerides ; CATEGORY: ; smei/gen/idl/ephem; USNO Asteroid Ephemeris; Test program ; CALLING SEQUENCE: PRO usno_test, asteroid ; INPUTS: ; asteroid scalar; type: string ; one of the following: ; ['Ceres','Pallas','Juno','Vesta','Hebe','Iris','Flora', $ ; 'Metis','Hygiea','Eunomia','Psyche','Europa','Cybele','Davida','Interamn'] ; OUTPUTS: ; (none) ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; usno_eph, usno_close, who_am_i, InitVar ; COMMON BLOCKS: common USNO_INFO, USNO_PNTR ; PROCEDURE: ; Compares ephemeris calculation with test numbers for the asteroid used ; (stored in subdirectory 'usno'). ; MODIFICATION HISTORY: ; FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- teststr = '-21199.500000 1.4388835766787766 2.2314537280110813 0.7279121194675992 -0.0090598783887297 0.0036582158435536 0.0035365188051248' bytstr = bytarr(strlen(teststr)+1) InitVar, asteroid, 'ceres' file = filepath(root=who_am_i(/dir),subdir='usno',asteroid+'.tst') file = (file_search(file))[0] IF file EQ '' THEN message, 'no test file available for '+asteroid openr, iU, /get_lun, file jd = 0.0D0 testpos = 0.0D0 REPEAT BEGIN readu, iU, bytstr jd = [jd,double( strmid( bytstr,0,13) )] FOR i=0,5 DO testpos = [testpos, double(strmid(bytstr,13+i*20,20))] ENDREP UNTIL eof(iU) free_lun, iU jd = jd[1:*] njd = n_elements(jd) jd = 2400000L+jd testpos = testpos[1:*] testpos = reform(testpos,6,njd) jd = [jd, reverse(jd)] testpos = [ [testpos], [reverse(testpos,2)] ] njd = 2*njd FOR ii=0,njd-1 DO BEGIN posvel = usno_eph(jd[ii], asteroid=asteroid) dif = posvel-testpos[*,ii] dist = sqrt( total(dif[0:2]*dif[0:2]) ) speed = sqrt( total(dif[3:5]*dif[3:5]) ) IF n_elements(maxdist ) EQ 0 THEN maxdist = dist ELSE maxdist = dist > maxdist IF n_elements(maxspeed) EQ 0 THEN maxspeed = speed ELSE maxspeed = speed > maxspeed ; Compare the test and ephemeris positions. */ print, format='(A,F9.1,2(A,F15.12))','JD = ',jd[ii],', Delta Distance = ',dist,' Delta Speed = ',speed ENDFOR usno_close ; Print the maximum differences between the test and the ephemeris files print print print, format='(2(A,F15.12))','Maximum Delta Distance =', maxdist,' Maximum Delta Speed =', maxspeed RETURN & END