Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use parse_cm load_dir_from_load_name and test #288

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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