pro naif, forcedef = forcedef, rw = rw, kernelFile=kernelFile ;+ ; NAME: ; naif ; PURPOSE: (one line) ; prepare tnaif library and collect some constants into a system variable ; DESCRIPTION: ; see /usr/local/icy/doc/html/req/icy.html for ICY info ; ; CATEGORY: ; Astronomy ; CALLING SEQUENCE: ; naif ; INPUTS: ; none ; OPTIONAL INPUT PARAMETERS: ; forcedef - define !naif even if it is defined ; rw - allow !naif to be read-write ; kernelFile - the kernels to load. This can take two different ; forms, either a single string which is the ; full path name of one kernel file (tls or bsp for ; example), or a metakernel file with the ; names of the kernels to load. If this optional ; argument is not defined, the file ; ; "kernels.txt" is used. ; This file is located in /User/naif/kernels.txt. ; Note: under OSX, the cpsice_furnsh function expects the master ; kernel file to have lines delimited ; by line feeds instead of carriage returns. ; ; KEYWORD INPUT PARAMETERS: ; none ; KEYWORD OUTPUT PARAMETERS: ; none ; OUTPUTS: ; None. ; COMMON BLOCKS: ; None. ; SIDE EFFECTS: ; Defines the system variable !eph using defsysv ; RESTRICTIONS: ; PROCEDURE: ; MODIFICATION HISTORY: ; Written 2004 May, by Leslie Young, SwRI ; Modified 2004 Dec 7, by Cathy Olkin, SwRI ; 1. Moved "help, 'icy',/dlm" to be after package is loaded to remove error message. ; 2. Added a kernel file ; 3. Call cspice_furnsh on the kernel file ; 4. Made a standard kernels.txt file and added an optional argument to override the ; standard kernel file. ; To do: 1. Add to !naif, either the string passed to cspice_furnsh or the contents of the file ; loaded by cspice_furnsh. I should be able to use the output from cspice_kdata to do this, ; but I am not sure how to do this right now. ;- on_error, 2 ; Don't add it if it already exists. DEFSYSV, '!naif', EXISTS = i IF i EQ 1 and not keyword_set(forcedef) THEN return print, cspice_tkvrsn( 'TOOLKIT' ) help, 'icy',/dlm IF keyword_set(kernelFile) THEN cspice_furnsh, kernelFile IF not keyword_set(kernelFile) THEN cspice_furnsh, '/usr/local/rsi/idl/lib/layoung/naif/kernels.txt' ; Count the number of loaded kernel files. cspice_ktotal, 'ALL', count print, 'The number of loaded kernel files = ', count ; Loop over the count, outputting file information as we loop. ; The loop tells us all files loaded via cspice_furnsh, their ; type, and how they were loaded. ; for i = 0, (count-1) do begin cspice_kdata, i, 'ALL', file, type, source, handle, found if ( found ) then begin print, 'Index : ' + string(i) print, 'File : ' + file print, 'Type : ' + type print, 'Source: ' + source print endif else begin print, 'No kernel found with index: ' + string(i) endelse endfor ro = 1 ; read-only if keyword_set(rw) then ro=0 ;defsysv, '!naif', $ ; { $ ; tls : tls, $ ; spk : spk $ ; }, ro ;message, $ ; 'NAIF variable (!naif) has been added', /inf print, "target # -98 is New Horizons" end