When initialising the LayupObservatory class and the cache_dir is None, Layup will use the local user's Sorcha cache for aux files.
This is because the function layup_furnish_spicepy uses the Sorcha function sorcha.ephemeris.simulation_setup.furnish_spiceypy , which defaults to the Sorcha cache when cache_dir is none:
|
def layup_furnish_spiceypy(cache_dir): |
|
"""A simple wrapper to furnish spiceypy kernels.""" |
|
# A simple class to mimic the arguments processed by Sorcha's observatory class |
|
config = LayupConfigs() |
|
furnish_spiceypy(FakeSorchaArgs(cache_dir), config.auxiliary) |
|
|
|
class LayupObservatory(SorchaObservatory): |
|
""" |
|
A wrapper around Sorcha's Observatory class to provide additional functionality for Layup. |
|
""" |
|
|
|
def __init__(self, cache_dir=None): |
|
"""Create an instance of the LayupObservatory class. |
|
|
|
Parameters |
|
---------- |
|
cache_dir : str, optional |
|
The location of the cache directory containing the bootstrapped files. |
|
If the files or cache is not present, the files will be downloaded, by default None |
|
""" |
|
|
|
# Get Layup configs |
|
config = LayupConfigs() |
|
|
|
# Kept so space-observatory Horizons lookups land their persistent |
|
# (naif_id, jd) -> state cache under the same cache directory. |
|
self.cache_dir = cache_dir |
|
|
|
# Furnish the spiceypy kernels |
|
layup_furnish_spiceypy(cache_dir) |
|
|
This resulted in a failed unit test for me locally, as my Sorcha cache didn't have up-to-date Obs codes (unit tests worked after Sorcha bootstrap was used).
Both orbitfit and predict that use this class specify the cache_dir, so no issues in the main code, only unit tests that don't specify cache_dir can lead to this error.
Changing the default from None to the local layup cache dir: cache_dir = str(pooch.os_cache("layup")) should fix this.
When initialising the LayupObservatory class and the cache_dir is None, Layup will use the local user's Sorcha cache for aux files.
This is because the function layup_furnish_spicepy uses the Sorcha function
sorcha.ephemeris.simulation_setup.furnish_spiceypy, which defaults to the Sorcha cache when cache_dir is none:layup/src/layup/utilities/data_processing_utilities.py
Lines 347 to 352 in bec2747
layup/src/layup/utilities/data_processing_utilities.py
Lines 354 to 378 in bec2747
This resulted in a failed unit test for me locally, as my Sorcha cache didn't have up-to-date Obs codes (unit tests worked after Sorcha bootstrap was used).
Both orbitfit and predict that use this class specify the cache_dir, so no issues in the main code, only unit tests that don't specify cache_dir can lead to this error.
Changing the default from
Noneto the local layup cache dir:cache_dir = str(pooch.os_cache("layup"))should fix this.