Skip to content

Commit

Permalink
fixed yaml issue causing cdf write failure
Browse files Browse the repository at this point in the history
  • Loading branch information
sdhoyt committed Sep 13, 2024
1 parent cfaee01 commit de9853d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
27 changes: 13 additions & 14 deletions imap_processing/cdf/config/imap_lo_l1a_variable_attrs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,20 @@ de_default_attrs: &de_default

# Re-used Coordinate
esa_step_label:
FILLVAL: 255
CATDESC: ESA Steps
FIELDNAM: ESA Steps
FORMAT: A1
VAR_TYPE: metadata
CATDESC: ESA Steps
FIELDNAM: ESA Steps
FORMAT: A1
VAR_TYPE: metadata

esa_step:
VALIDMIN: 1
VALIDMAX: 7
FILLVAL: -9223372036854775808
FILLVAL: 255
CATDESC: Energy Step
DEPEND_1: esa_step
FIELDNAM: Energy Step
UNITS: ' '
FORMAT: I1
FORMAT: I3
VAR_TYPE: support_data
LABLAXIS: ESA
LABL_PTR_1: esa_step_label
Expand Down Expand Up @@ -170,36 +169,36 @@ de_count:
azimuth_6_label:
CATDESC: azimuth spin bins (<num packets>, 6 degrees)
FIELDNAM: Azimuth bins
FORMAT: A2
FORMAT: A3
VAR_TYPE: metadata

azimuth_6:
VALIDMIN: 0
VALIDMAX: 59
FILLVAL: -9223372036854775808
FILLVAL: 255
CATDESC: azimuth spin bins (<num packets>, 6 degrees)
FIELDNAM: Azimuth bins
DEPEND_1: azimuth_6
UNITS: ' '
FORMAT: I2
FORMAT: I3
VAR_TYPE: support_data
LABLAXIS: Az bins
LABL_PTR_1: azimuth_6_label

azimuth_60_label:
CATDESC: azimuth spin bins (<num packets>, 60 degrees)
FIELDNAM: Azimuth bins
FORMAT: A1
FORMAT: A3
VAR_TYPE: metadata

azimuth_60:
VALIDMIN: 0
VALIDMAX: 5
FILLVAL: -9223372036854775808
FILLVAL: 255
CATDESC: azimuth spin bins (<num packets>, 60 degrees)
FIELDNAM: Azimuth bins
DEPEND_1: azimuth_60
FORMAT: I1
FORMAT: I3
UNITS: ' '
VAR_TYPE: support_data
LABLAXIS: Az bins
Expand Down Expand Up @@ -384,7 +383,7 @@ pos1:
DEPEND_2: esa_step
FIELDNAM: Position 1 count
FORMAT: I12
LABLAXIS: position 1 coun
LABLAXIS: position 1 count

pos2:
<<: *default
Expand Down
11 changes: 11 additions & 0 deletions imap_processing/lo/l1a/lo_l1a.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""IMAP-Lo L1A Data Processing."""

import logging
from pathlib import Path

import numpy as np
Expand All @@ -11,6 +12,9 @@
from imap_processing.lo.l0.lo_science import parse_histogram
from imap_processing.utils import packet_file_to_datasets

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)


def lo_l1a(dependency: Path, data_version: str) -> list[xr.Dataset]:
"""
Expand All @@ -30,6 +34,8 @@ def lo_l1a(dependency: Path, data_version: str) -> list[xr.Dataset]:
Location of created CDF files.
"""
xtce_file = imap_module_directory / "lo/packet_definitions/lo_xtce.xml"

logger.info("\nDecommutating packets and converting to dataset")
datasets_by_apid = packet_file_to_datasets(
packet_file=dependency.resolve(),
xtce_packet_definition=xtce_file.resolve(),
Expand All @@ -42,6 +48,10 @@ def lo_l1a(dependency: Path, data_version: str) -> list[xr.Dataset]:
attr_mgr.add_instrument_variable_attrs(instrument="lo", level="l1a")
attr_mgr.add_global_attribute("Data_version", data_version)

logger.info(
f"\nProcessing {LoAPID(LoAPID.ILO_SCI_CNT).name} "
f"packet (APID: {LoAPID.ILO_SCI_CNT.value})"
)
if LoAPID.ILO_SCI_CNT in datasets_by_apid:
logical_source = "imap_lo_l1a_histogram"
datasets_by_apid[LoAPID.ILO_SCI_CNT] = parse_histogram(
Expand All @@ -52,6 +62,7 @@ def lo_l1a(dependency: Path, data_version: str) -> list[xr.Dataset]:
)

good_apids = [LoAPID.ILO_SCI_CNT]
logger.info(f"\nReturning datasets: {[LoAPID(apid) for apid in good_apids]}")
return [datasets_by_apid[good_apid] for good_apid in good_apids]


Expand Down

0 comments on commit de9853d

Please sign in to comment.