pro naifreinit, kernelFile=kernelFile ;+ ; NAME: ; naifreinit ; PURPOSE: (one line) ; unload existing kernels and reload new kernels for naif ; DESCRIPTION: ; see /usr/local/icy/doc/html/req/icy.html for ICY info ; ; CATEGORY: ; Astronomy ; CALLING SEQUENCE: ; naifreinit ; INPUTS: ; none ; OPTIONAL INPUT PARAMETERS: ; 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.tm" is used. This file is located ; in the same directory as naifinit.pro. ; ; 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 !naif using defsysv ; RESTRICTIONS: ; PROCEDURE: ; MODIFICATION HISTORY: ; 2005 Apr 26 Leslie Young. based on naifinit ; 2005 Nov 16 Leslie Young. Default file -> kernels.tm (Text Metakernel) ;- on_error, 2 ; just call naifinit if it hasn't been called yet and exit defsysv, '!naif', exists = i if i ne 1 then begin naifinit, kernelfile=kernelfile, rw=1 return end if !naif.readonly ne 0 then begin message, '!naif is readonly. Next time, call naifinit ReadWrite with'$ +string(10B)+$ 'naifinit, kernelfile=kernelfile, rw=1' end ; unload all the existing kernels cspice_ktotal, 'ALL', count for i = 0, (count-1) do begin cspice_kdata, i, 'ALL', file, type, source, handle, found if found then begin cspice_unload, file end end ; Find the kernelFile if not keyword_set(kernelFile) then begin findpro, 'naifinit', dirlist=dirlist, /noprint if dirlist[0] eq '' then begin kernelFile = 'kernels.tm' endif else begin kernelFile = filepath('kernels.tm',root=dirlist[0]) endelse endif if not isfile(kernelFile) then begin message, 'kernel file '+kernelFile + ' not found' end !naif.kernelFile = kernelFile ; load the new kernel cspice_furnsh, kernelFile end