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 @@ -3,7 +3,7 @@
This directory contains the code that converts Parker Solar Probe SPC L0 files into L1 CDF files.

- `main.py` defines the `pfc_decommutator` command line tool.
- `swp_spc_l02l1.py` defines `main`, which does the conversion for one L0 file.
- `swp_spc_l0_to_l05.py` defines `main`, which does the conversion for one L0 file.
- `ccsds_reader_pipeline.py` reads the CCSDS packets from an L0 file.

> [!NOTE]
Expand Down
2 changes: 1 addition & 1 deletion src/pyfaradaycup/decommutator/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from pyfaradaycup.decommutator import ccsds_reader_pipeline, main, swp_spc_l02l1
from pyfaradaycup.decommutator import ccsds_reader_pipeline, main, swp_spc_l0_to_l05
14 changes: 6 additions & 8 deletions src/pyfaradaycup/decommutator/ccsds_reader_pipeline.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""
"""Functionality for the CCSDS reader pipeline."""

# $URL: file:///psp/psp_swp_spc_code_repository/trunk/ccsds_reader_pipeline.py $
# $LastChangedRevision: 103 $
# $LastChangedDate: 2020-08-13 08:42:52 -0400 (Thu, 13 Aug 2020) $
# $LastChangedBy: acase $
""" # ruff:ignore[D400]

from __future__ import annotations

Expand Down Expand Up @@ -31,10 +31,6 @@
import os


def _read_stdin(ptp: bool = False, verbose: bool = False) -> None: # ruff:ignore[FBT001, FBT002]
"""Parse binary stream on stdin""" # ruff:ignore[D400]


Comment on lines -34 to -37

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function didn't do anything, and wasn't used anywhere else either.

def _file2bytestr(
path: str | os.PathLike[str],
gzip: bool = False, # ruff:ignore[FBT001, FBT002]
Expand Down Expand Up @@ -309,11 +305,13 @@ def read_file_sc( # ruff:ignore[C901, PLR0912, PLR0915]

# We'll need to find which apid dictionary to use,
# based on which version of FSW was running
# Those versions (and respective dates) are listed in the L1 APID257 file
# Those versions (and respective dates) are listed in the L0.5 APID257 file
# That file is created via psp_sc_hsk_257_l052l1.py
# Both it and the corresponding SC_HK files that we will read in
# (in sc_hk_def/) are in the package data directory
with (data_dir / "sc_hsk" / "L1" / "APID257_combined.txt").open() as f:
with (
data_dir / "sc_hsk" / "L1" / "APID257_combined.txt"
).open() as f: # Should L1 be changed to L05?
lines = f.readlines()
vers_dt = np.array([dateutil.parser.isoparse(line.split(",")[0]) for line in lines])
versions = np.array([line.split(",")[1].strip() for line in lines])
Expand Down
20 changes: 10 additions & 10 deletions src/pyfaradaycup/decommutator/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import click

from pyfaradaycup.decommutator import swp_spc_l02l1
from pyfaradaycup.decommutator import swp_spc_l0_to_l05


def _parse_apid(
Expand Down Expand Up @@ -135,10 +135,10 @@ def _warn_about_ineffective_options(
),
)
@click.option(
"-dl1",
"--l1dir",
"-dl05",
"--l05dir",
type=click.Path(file_okay=False, path_type=pathlib.Path),
help="Output L1 Directory. Defaults to the current directory. Created if it does not exist.",
help="Output L0.5 Directory. Defaults to the current directory. Created if it does not exist.",
)
@click.option(
"-dlog",
Expand All @@ -159,7 +159,7 @@ def pfc_decommutator( # ruff:ignore[PLR0913]
apid: int,
l0file: pathlib.Path | None,
l0dir: pathlib.Path | None,
l1dir: pathlib.Path | None,
l05dir: pathlib.Path | None,
logdir: pathlib.Path | None,
) -> None:
"""
Expand All @@ -171,14 +171,14 @@ def pfc_decommutator( # ruff:ignore[PLR0913]
\b
pfc_decommutator \\
--l0file=/path/to/0523462910_4_EA \\
--l1dir=/path/to/l1dir \\
--l05dir=/path/to/l05dir \\
--logdir=/path/to/logdir \\
-v

This writes one L1 CDF file for each APID found in the L0 file, such
as 0523462910_4_EA_APID351_L1.cdf, into the directory given by
--l1dir, and a log file into the directory given by --logdir. If
--l1dir or --logdir is not given, the current directory is used.
--l05dir, and a log file into the directory given by --logdir. If
--l05dir or --logdir is not given, the current directory is used.
""" # ruff:ignore[D301]
_warn_about_ineffective_options(
batch=batch,
Expand All @@ -202,9 +202,9 @@ def pfc_decommutator( # ruff:ignore[PLR0913]
if stcorrect:
raise RuntimeError("--stcorrect has not been implemented.") # ruff:ignore[EM101, TRY003]

swp_spc_l02l1.main(
swp_spc_l0_to_l05.main(
l0file=l0file,
l1dir=l1dir,
l05dir=l05dir,
logdir=logdir,
spacecraft=spacecraft,
ptp=ptp,
Expand Down
Loading
Loading