curryer.spicetime.leapsecond¶
Leapsecond kernel methods.
Importing this module will load the default leapsecond kernel that is included with this library. If the kernel pool is cleared, load() should be called to reload the leapsecond kernel. The included kernel can be updated using update_file(); if a new kernel is available, it will be downloaded to the package’s “data” directory.
The last leapsecond kernel that is loaded takes the highest precedence.
@author: Brandon Stone
Attributes¶
Classes¶
Simply class for storing leapsecond data in-memory. |
Functions¶
Find the library's default leapsecond kernel file. |
|
List the loaded leapsecond kernels (LSK), if any. |
|
|
Load a leapsecond kernel. |
Check for updated leapsecond kernels from NAIF. |
|
Update the leapsecond kernel from NAIF. |
|
|
Determine the current leapseconds. |
Module Contents¶
- curryer.spicetime.leapsecond.logger¶
- curryer.spicetime.leapsecond._LEAPSECOND_FILE_PATH = '../../data/generic'¶
- curryer.spicetime.leapsecond._LEAPSECOND_FILE_GLOB = 'naif*.tls'¶
- curryer.spicetime.leapsecond.LEAPSECOND_BASE_URL = 'https://naif.jpl.nasa.gov/pub/naif/generic_kernels/lsk/'¶
- curryer.spicetime.leapsecond.LEAPSECOND_USER_FILE_PATH = None¶
- curryer.spicetime.leapsecond.find_default_file()¶
Find the library’s default leapsecond kernel file.
- Returns:
Path object for the default leapsecond kernel.
- Return type:
pathlib.Path
- curryer.spicetime.leapsecond.are_loaded()¶
List the loaded leapsecond kernels (LSK), if any.
- Returns:
List of the loaded leapsecond kernels. The last file has precedence.
- Return type:
list of str
- curryer.spicetime.leapsecond.load(filename=None)¶
Load a leapsecond kernel.
- Parameters:
filename (str or pathlib.Path, optional) – Leapsecond kernel to load. If omitted, attempt to load the included kernel. Do not reload it if it has already been loaded.
- Return type:
None
- curryer.spicetime.leapsecond.check_for_update()¶
Check for updated leapsecond kernels from NAIF.
This should be run at least twice a year.
- Returns:
If an update is available, returns the file name of the latest leapsecond kernel (e.g., “naif0012.tls”), otherwise None.
- Return type:
str or None
- curryer.spicetime.leapsecond.update_file()¶
Update the leapsecond kernel from NAIF.
- Returns:
Path to the updated leapsecond file, or None if the current leapsecond file was already up-to-date. Note: If an update was found, then the module constant LEAPSECOND_FILE will be updated and the kernel will be loaded into memory (overriding any existing leapsecond kernels).
- Return type:
pathlib.Path or None
- curryer.spicetime.leapsecond.read_leapseconds(filename=None)¶
Determine the current leapseconds.
- Parameters:
filename (str, optional) – Leapsecond file to read. Default=library leapsecond file.
- Returns:
- Leapsecond data. Index is the time a leapsecond was added. Columns:
nsec : int, cumulative number of leapseconds linux_offset : int, microsecond offset between unix time and uGPS. ugps : int, GPS microsecond time a leapsecond was added.
- Return type:
pd.DataFrame
- class curryer.spicetime.leapsecond.LeapsecondCache¶
Simply class for storing leapsecond data in-memory.
- _data = None¶
- get()¶
Get the leapsecond information.
The first call will trigger a read, otherwise a cached copy is used.
- Returns:
Leapsecond data. See method: read_leapseconds
- Return type:
pandas.DataFrame
- curryer.spicetime.leapsecond.cache¶