Skip to content

Commit

Permalink
Use parse_cm load_dir_from_load_name and test
Browse files Browse the repository at this point in the history
  • Loading branch information
taldcroft committed Jan 10, 2024
1 parent d578fd0 commit 8a8995e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 6 additions & 0 deletions mica/starcheck/tests/test_catalog_fetches.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from Ska.quatutil import radec2yagzag, yagzag2radec

from .. import starcheck
from mica.utils import load_name_to_mp_dir

HAS_SC_ARCHIVE = os.path.exists(starcheck.FILES["data_root"])

Expand Down Expand Up @@ -340,3 +341,8 @@ def test_get_starcheck_for_no_starcheck_entry():
date = "2023:050:00:30:00"
cat = starcheck.get_starcheck_catalog_at_date(date)
assert cat is None


def test_load_name_to_mp_dir():
mp_dir = load_name_to_mp_dir("DEC2506C")
assert mp_dir == "/2006/DEC2506/oflsc/"
6 changes: 2 additions & 4 deletions mica/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import os

from kadi.commands.core import ska_load_dir
from parse_cm.paths import load_dir_from_load_name

DEFAULT_CONFIG = {}

Expand All @@ -13,6 +11,6 @@ def load_name_to_mp_dir(load_name):
:returns: str mica-format mission planning dir
"""
# Get the last 3 parts of the full load directory path YEAR/LOAD/ofls{REV}
dir_parts = ska_load_dir(load_name).parts
dir_parts = load_dir_from_load_name(load_name).parts
out = "/" + "/".join(dir_parts[-3:]) + "/"
return out

0 comments on commit 8a8995e

Please sign in to comment.