diff --git a/mica/archive/aca_dark/dark_cal.py b/mica/archive/aca_dark/dark_cal.py index 90c9f613..bcc3ed7d 100644 --- a/mica/archive/aca_dark/dark_cal.py +++ b/mica/archive/aca_dark/dark_cal.py @@ -104,7 +104,11 @@ def get_dark_cal_id(date, select='before'): :returns: dark cal id string (YYYYDOY) """ - return _get_dark_cal_id_vector(date, select=select) + dark_id = _get_dark_cal_id_vector(date, select=select) + if not dark_id.shape: + # returning an instance of the type, not a numpy array + return dark_id.tolist() + return dark_id def _get_dark_cal_id_scalar(date, select='before'): diff --git a/mica/archive/tests/test_aca_dark_cal.py b/mica/archive/tests/test_aca_dark_cal.py index 479d3e31..c2e70048 100644 --- a/mica/archive/tests/test_aca_dark_cal.py +++ b/mica/archive/tests/test_aca_dark_cal.py @@ -109,6 +109,12 @@ def test_get_dark_cal_props_table_mixed(): 'n_ccd_img', 'datestart', 'datestop', 'filename'] +@pytest.mark.skipif('not HAS_DARK_ARCHIVE', reason='Test requires dark archive') +def test_scalar(): + dark_cal_id = dark_cal.get_dark_cal_id('2022:100') + assert dark_cal_id[:4] == '2022' and dark_cal_id[4:] == '069' + + @pytest.mark.skipif('not HAS_DARK_ARCHIVE', reason='Test requires dark archive') def test_vectorized(): dark_id_ref = ['2022100', '2022105', '2022127']