Skip to content

Commit

Permalink
Separate IDEX L1 into L1a and L1b (#831)
Browse files Browse the repository at this point in the history
* Now using one directory instead of splitting L0 and L1 code into subpackages
* Updated various docs and variable names to distinguish L1a from L1b
* Updated valid data levels for IDEX
  • Loading branch information
bourque authored Sep 16, 2024
1 parent 69911cc commit 0a9820d
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 23 deletions.
4 changes: 2 additions & 2 deletions docs/source/code-documentation/idex.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ Level 1 Processing Code:
:template: autosummary.rst
:recursive:

l0.idex_l0
l1.idex_l1
idex_l0
idex_l1a
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
(r"py:.*", r".*numpy.int.*"),
(r"py:.*", r".*np.ndarray.*"),
(r"py:.*", r".*numpy._typing._array_like._ScalarType_co.*"),
(r"py:.*", r".*idex.l1.TRIGGER_DESCRIPTION.*"),
(r"py:.*", r".*idex.l1a.TRIGGER_DESCRIPTION.*"),
]

# Ignore the inherited members from the <instrument>APID IntEnum class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The general filename convention is as follows::
* CoDICE: ``l0``, ``l1a``, ``l1b``, ``l2``, ``l3``
* GLOWS: ``l0``, ``l1a``, ``l1b``, ``l2``, ``l3a``, ``l3b``, ``l3c``, ``l3d``
* HIT: ``l0``, ``l1a``, ``l1b``, ``l2``, ``l3``
* IDEX: ``l0``, ``l1``, ``l2``, ``l3``
* IDEX: ``l0``, ``l1a``, ``l1b``, ``l2``, ``l3``
* IMAP-Hi: ``l0``, ``l1a``, ``l1b``, ``l1c``, ``l2``, ``l3``
* IMAP-Lo: ``l0``, ``l1a``, ``l1b``, ``l1c``, ``l2``
* IMAP-Ultra: ``l0``, ``l1a``, ``l1b``, ``l1c``, ``l2``, ``l3``
Expand Down Expand Up @@ -58,7 +58,7 @@ The general filename convention is as follows::

Here are a few examples of acceptable filenames:

* ``imap_idex_l0_20261206_v001.pkts``
* ``imap_idex_l0_raw_20261206_v001.pkts``

An IDEX L0 packet file containing data from the single day of ``2026-12-06``

Expand Down
2 changes: 1 addition & 1 deletion imap_processing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"glows": ["l0", "l1a", "l1b", "l2"],
"hi": ["l0", "l1a", "l1b", "l1c", "l2"],
"hit": ["l0", "l1a", "l1b", "l2"],
"idex": ["l0", "l1", "l2"],
"idex": ["l0", "l1a", "l1b", "l2"],
"lo": ["l0", "l1a", "l1b", "l1c", "l2"],
"mag": ["l0", "l1a", "l1b", "l1c", "l2pre", "l2"],
"swapi": ["l0", "l1", "l2"],
Expand Down
2 changes: 1 addition & 1 deletion imap_processing/cdf/config/imap_idex_global_cdf_attrs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ instrument_base: &instrument_base
https://imap.princeton.edu/instruments/idex for more details.
Instrument_type:

imap_idex_l1_sci:
imap_idex_l1a_sci:
<<: *instrument_base
Data_level: L1
Data_type: L1_SCI>Level-1 Science Data
Expand Down
2 changes: 1 addition & 1 deletion imap_processing/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from imap_processing.hi.l1c import hi_l1c
from imap_processing.hit.l1a.hit_l1a import hit_l1a
from imap_processing.hit.l1b.hit_l1b import hit_l1b
from imap_processing.idex.l1.idex_l1 import PacketParser
from imap_processing.idex.idex_l1a import PacketParser
from imap_processing.lo.l1a import lo_l1a
from imap_processing.lo.l1b import lo_l1b
from imap_processing.lo.l1c import lo_l1c
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Perform IDEX L1 Processing.
Perform IDEX L1a Processing.
This module processes decommutated IDEX packets and creates L1 data products.
This module processes decommutated IDEX packets and creates L1a data products.
"""

import logging
Expand All @@ -16,14 +16,12 @@
import xarray as xr

from imap_processing.cdf.imap_cdf_manager import ImapCdfAttributes
from imap_processing.idex.l0.idex_l0 import decom_packets
from imap_processing.idex.idex_l0 import decom_packets
from imap_processing.spice.time import met_to_j2000ns

logger = logging.getLogger(__name__)

# TODO: Generate quicklook plots
# TODO: Currently the code assumes that one L0 file will produce one L1 file.
# Is this a valid assumption?

# Create a large dictionary of values from the FPGA header that need to be
# captured into the CDF file. They are lumped together because they share
Expand Down Expand Up @@ -91,9 +89,9 @@ class Scitype(IntEnum):

class PacketParser:
"""
IDEX packet parsing class.
IDEX L1a packet parsing class.
Encapsulates the decom work needed to decom a daily file of IDEX data
Encapsulates the decom work needed to decom a daily file of IDEX L0 data
received from the POC. The class is instantiated with a reference to a L0
file as it exists on the local file system.
Expand All @@ -108,10 +106,10 @@ class PacketParser:
--------
.. code-block:: python
from imap_processing.idex.idex_l1 import PacketParser
from imap_processing.idex.idex_l1a import PacketParser
l0_file = "imap_processing/tests/idex/imap_idex_l0_sci_20230725_v001.pkts"
l1_data = PacketParser(l0_file, data_version)
l1_data.write_l1_cdf()
l1a_data = PacketParser(l0_file, data_version)
l1a_data.write_l1a_cdf()
"""

def __init__(self, packet_file: Union[str, Path], data_version: str) -> None:
Expand All @@ -127,7 +125,7 @@ def __init__(self, packet_file: Union[str, Path], data_version: str) -> None:
Notes
-----
Currently assumes one L0 file will generate exactly one L1 file.
Currently assumes one L0 file will generate exactly one L1a file.
"""
decom_packet_list = decom_packets(packet_file)

Expand Down Expand Up @@ -157,7 +155,7 @@ def __init__(self, packet_file: Union[str, Path], data_version: str) -> None:

self.data = xr.concat(processed_dust_impact_list, dim="epoch")
idex_attrs = get_idex_attrs(data_version)
self.data.attrs = idex_attrs.get_global_attributes("imap_idex_l1_sci")
self.data.attrs = idex_attrs.get_global_attributes("imap_idex_l1a_sci")


class RawDustEvent:
Expand Down Expand Up @@ -624,10 +622,10 @@ def get_idex_attrs(data_version: str) -> ImapCdfAttributes:
Returns
-------
idex_attrs : ImapCdfAttributes
Imap object with l1a attribute files loaded in.
The IDEX L1a CDF attributes.
"""
idex_attrs = ImapCdfAttributes()
idex_attrs.add_instrument_global_attrs("idex")
idex_attrs.add_instrument_variable_attrs("idex", "l1")
idex_attrs.add_instrument_variable_attrs("idex", "l1a")
idex_attrs.add_global_attribute("Data_version", data_version)
return idex_attrs
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion imap_processing/tests/idex/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import xarray as xr

from imap_processing import imap_module_directory
from imap_processing.idex.l1.idex_l1 import PacketParser
from imap_processing.idex.idex_l1a import PacketParser


@pytest.fixture()
Expand Down
File renamed without changes.

0 comments on commit 0a9820d

Please sign in to comment.