Skip to content
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
2 changes: 1 addition & 1 deletion src/pyfaradaycup/decommutator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Calling the conversion as a function is better suited to Dagster than starting a
### Test the `--spacecraft` option

- **Add a test that converts a spacecraft L0 file with `--spacecraft`.**
The only test converts an instrument L0 file, so `read_file_sc`, `_get_layout_sc`, and the code that writes the spacecraft housekeeping CDFs are never run.
The only test converts an instrument L0 file, so `_read_file_sc`, `_get_layout_sc`, and the code that writes the spacecraft housekeeping CDFs are never run.
Add a spacecraft L0 file to `tests/data`, along with the expected L1 CDF files, and compare them as the existing test does.
Include a file for which the flight software version cannot be found from the packet header, so that the fallback to the file path, and then to the newest definition file, is also tested.

Expand Down
6 changes: 2 additions & 4 deletions src/pyfaradaycup/decommutator/ccsds_reader_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

__all__ = [
"apid_obj",
"read_file",
"read_file_sc",
]

import datetime
Expand Down Expand Up @@ -198,7 +196,7 @@ def _wrapper_status(
return data


def read_file( # ruff:ignore[C901]
def _read_file( # ruff:ignore[C901]
path: str | os.PathLike[str],
*,
verbose: bool = False,
Expand Down Expand Up @@ -327,7 +325,7 @@ def read_file( # ruff:ignore[C901]
return data


def read_file_sc( # ruff:ignore[C901, PLR0912, PLR0915]
def _read_file_sc( # ruff:ignore[C901, PLR0912, PLR0915]
path: str | os.PathLike[str],
*,
verbose: bool = False,
Expand Down
10 changes: 5 additions & 5 deletions src/pyfaradaycup/decommutator/swp_spc_l0_to_l05.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
import spiceypy
from spacepy import pycdf

import pyfaradaycup.decommutator.ccsds_reader_pipeline as cc
from pyfaradaycup._paths import data_dir
from pyfaradaycup.decommutator.ccsds_reader_pipeline import _read_file, _read_file_sc

if TYPE_CHECKING:
import os
Expand Down Expand Up @@ -91,9 +91,9 @@ def main( # ruff:ignore[C901, PLR0912, PLR0913, PLR0915]

spacecraft : bool, optional
If `True`, read spacecraft housekeeping packets with
`~pyfaradaycup.decommutator.ccsds_reader_pipeline.read_file_sc`.
``_read_file_sc``.
If `False`, read SWEAP instrument packets with
`~pyfaradaycup.decommutator.ccsds_reader_pipeline.read_file`.
``_read_file``.

ptp : bool, optional
If `True`, the L0 file is a PTP file. Only used when
Expand Down Expand Up @@ -218,10 +218,10 @@ def main( # ruff:ignore[C901, PLR0912, PLR0913, PLR0915]
# Read in the L0 file into a python SPC data structure
if spacecraft:
_statusmsg("Event = Starting reading file: spacecraft")
l0data = cc.read_file_sc(path=l0file, ptp=ptp, verbose=verbose, gzip=gzip)
l0data = _read_file_sc(path=l0file, ptp=ptp, verbose=verbose, gzip=gzip)
else:
_statusmsg("Event = Starting reading file: non-spacecraft (instrument)")
l0data = cc.read_file(path=l0file, verbose=verbose, gzip=gzip)
l0data = _read_file(path=l0file, verbose=verbose, gzip=gzip)
_statusmsg("Event = Finished reading file")

# Loop through the APIDs that we got
Expand Down
2 changes: 1 addition & 1 deletion tests/decommutator/test_ccsds_reader_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def test_parse_ccsds_head_too_short(length: int) -> None:
Test that a header shorter than 10 bytes raises a ValueError.

A packet can be cut off at the end of an L0 file. ``_read_bytestr``
and ``read_file_sc`` catch `ValueError` to skip such a packet, so a
and ``_read_file_sc`` catch `ValueError` to skip such a packet, so a
short header must raise `ValueError` rather than another exception
or a header with missing fields.
"""
Expand Down
Loading