Skip to content

Commit

Permalink
Various CoDICE L1 Updates (#711)
Browse files Browse the repository at this point in the history
* Moved create_hskp_dataset to within l1a module to be consistent with how science datasets are created
* Now using epoch attrs defined in yaml files instead of dataclasses
* Fixed warnings given off from CdfAttributeManager
* Improvements to some CDF attribute definitions
* Added initial support for lo and hi event data processing
* Improved formatting for readability
* Changes to support actual simulated data
* Moved hard-coded test file paths to conftest
---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
bourque and pre-commit-ci[bot] committed Aug 15, 2024
1 parent f9cce2c commit b3d0377
Show file tree
Hide file tree
Showing 23 changed files with 490 additions and 462 deletions.
14 changes: 14 additions & 0 deletions imap_processing/cdf/config/imap_codice_global_cdf_attrs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ imap_codice_l1a_hi_sectored:
Logical_source: imap_codice_l1a_hi-sectored
Logical_source_description: IMAP Mission CoDICE Hi Level-1A Sectored Data.

imap_codice_l1a_hi_pha:
<<: *instrument_base
Data_level: 1A
Data_type: L1A_hi-pha->Level-1A Hi Event Data
Logical_source: imap_codice_l1a_hi-pha
Logical_source_description: IMAP Mission CoDICE Hi Level-1A Event Data.

imap_codice_l1a_lo_counters_aggregated:
<<: *instrument_base
Data_level: 1A
Expand Down Expand Up @@ -105,6 +112,13 @@ imap_codice_l1a_lo_nsw_species:
Logical_source: imap_codice_l1a_lo-nsw-species
Logical_source_description: IMAP Mission CoDICE Lo Level-1A Non-Sunward Species Counts Data.

imap_codice_l1a_lo_pha:
<<: *instrument_base
Data_level: 1A
Data_type: L1A_lo-pha->Level-1A Lo Event Data
Logical_source: imap_codice_l1a_lo-pha
Logical_source_description: IMAP Mission CoDICE Lo Level-1A Event Data.

# L1b
imap_codice_l1b_hskp:
<<: *instrument_base
Expand Down
46 changes: 33 additions & 13 deletions imap_processing/cdf/config/imap_codice_l1a_variable_attrs.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
# TODO: Some currently blank attributes may be removed once
# cdf_attribute_manager.py is updated to only check required attributes.
# See comment here:
# https://github.com/IMAP-Science-Operations-Center/imap_processing/pull/711#discussion_r1690212527
# <=== Defaults ===>
default_attrs: &default
# Assumed values for all variable attrs unless overwritten
DISPLAY_TYPE: no_plot
FILLVAL: -9223372036854775808
FORMAT: I12
UNITS: dN
VALIDMIN: -9223372036854775808
VALIDMAX: 9223372036854775807
VAR_TYPE: data
SCALETYP: linear
CATDESC: ""
DISPLAY_TYPE: no_plot
FIELDNAM: ""
FILLVAL: -9223372036854775808
FORMAT: I12
LABLAXIS: ""
REFERENCE_POSITION: ""
RESOLUTION: ""
SCALETYP: linear
TIME_BASE: ""
TIME_SCALE: ""
UNITS: dN
VALIDMIN: -9223372036854775808
VALIDMAX: 9223372036854775807
VAR_TYPE: data

codice_support_attrs: &support_default
<<: *default
Expand All @@ -29,23 +39,32 @@ energy_attrs:
# <=== Labels ===>
energy_label:
CATDESC: Energy per charge (E/q) sweeping step
DISPLAY_TYPE: ""
FIELDNAM: Energy step
FILLVAL: ""
FORMAT: A3
LABLAXIS: ""
REFERENCE_POSITION: ""
RESOLUTION: ""
TIME_BASE: ""
TIME_SCALE: ""
UNITS: ""
VALIDMAX: ""
VALIDMIN: ""
VAR_TYPE: metadata

# <=== Dataset Attributes ===>
# TODO: resolve ISTP warning: Width of F10 FORMAT may be insufficient for
# values. Adjust FORMAT or VALIDMIN/VALIDMAX value to resolve.
acquisition_times_attrs:
<<: *default
CATDESC: Time of acquisition for the energy step
DEPEND_1: energy
FIELDNAM: Acquisition Time
FILLVAL: 1.7976931348623157e+308
FILLVAL: .NAN
FORMAT: F10.3
LABLAXIS: Acq Time
UNITS: ms
VALIDMIN: 0
VALIDMAX: 1.7976931348623157e+308
VALIDMAX: 1000
VAR_TYPE: support_data

counters_attrs: &counters
Expand All @@ -63,6 +82,7 @@ counters_attrs: &counters
esa_sweep_attrs:
<<: *default
CATDESC: ElectroStatic Analyzer Energy Values
DEPEND_1: energy
FIELDNAM: ESA Voltage
FORMAT: I19
LABLAXIS: ESA V
Expand Down
48 changes: 31 additions & 17 deletions imap_processing/cdf/config/imap_codice_l1b_variable_attrs.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# <=== Defaults ===>
default_attrs: &default
# Assumed values for all variable attrs unless overwritten
DISPLAY_TYPE: no_plot
FILLVAL: -9223372036854775808
FORMAT: I12
UNITS: dN
VALIDMIN: -9223372036854775808
VALIDMAX: 9223372036854775807
VAR_TYPE: data
SCALETYP: linear
CATDESC: ""
DISPLAY_TYPE: no_plot
FIELDNAM: ""
FILLVAL: -9223372036854775808
FORMAT: I12
LABLAXIS: ""
REFERENCE_POSITION: ""
RESOLUTION: ""
SCALETYP: linear
TIME_BASE: ""
TIME_SCALE: ""
UNITS: dN
VALIDMIN: -9223372036854775808
VALIDMAX: 9223372036854775807
VAR_TYPE: data

codice_support_attrs: &support_default
<<: *default
Expand All @@ -29,23 +35,32 @@ energy_attrs:
# <=== Labels ===>
energy_label:
CATDESC: Energy per charge (E/q) sweeping step
DISPLAY_TYPE: ""
FIELDNAM: Energy step
FILLVAL: ""
FORMAT: A3
LABLAXIS: ""
REFERENCE_POSITION: ""
RESOLUTION: ""
TIME_BASE: ""
TIME_SCALE: ""
UNITS: ""
VALIDMAX: ""
VALIDMIN: ""
VAR_TYPE: metadata

# <=== Dataset Attributes ===>
# TODO: resolve ISTP warning: Width of F10 FORMAT may be insufficient for
# values. Adjust FORMAT or VALIDMIN/VALIDMAX value to resolve.
acquisition_times_attrs:
<<: *default
CATDESC: Time of acquisition for the energy step
DEPEND_1: energy
FIELDNAM: Acquisition Time
FILLVAL: 1.7976931348623157e+308
FILLVAL: .NAN
FORMAT: F10.3
LABLAXIS: Acq Time
UNITS: ms
VALIDMIN: 0
VALIDMAX: 1.7976931348623157e+308
VALIDMAX: 1000
VAR_TYPE: support_data

counters_attrs: &counters
Expand All @@ -55,16 +70,15 @@ counters_attrs: &counters
DEPEND_1: energy
DISPLAY_TYPE: time_series
FIELDNAM: Fill in at creation
FILLVAL: 1.7976931348623157e+308
FORMAT: F10.3
LABL_PTR_1: energy_label
UNITS: rates
UNITS: counts
VALIDMIN: 0
VALIDMAX: 1.7976931348623157e+308
VALIDMAX: 8388607 # max value for a signed 24-bit integer

esa_sweep_attrs:
<<: *default
CATDESC: ElectroStatic Analyzer Energy Values
DEPEND_1: energy
FIELDNAM: ESA Voltage
FORMAT: I19
LABLAXIS: ESA V
Expand Down
2 changes: 2 additions & 0 deletions imap_processing/codice/codice_l0.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def decom_packets(packet_file: Path) -> list:
"imap_codice_l0_hi-counters-singles_20240429_v001.pkts": "P_COD_HI_INST_COUNTS_SINGLES.xml", # noqa
"imap_codice_l0_hi-omni_20240429_v001.pkts": "P_COD_HI_OMNI_SPECIES_COUNTS.xml",
"imap_codice_l0_hi-sectored_20240429_v001.pkts": "P_COD_HI_SECT_SPECIES_COUNTS.xml", # noqa
"imap_codice_l0_hi-pha_20240429_v001.pkts": "P_COD_HI_PHA.xml",
"imap_codice_l0_hskp_20100101_v001.pkts": "P_COD_NHK.xml",
"imap_codice_l0_lo-counters-aggregated_20240429_v001.pkts": "P_COD_LO_INST_COUNTS_AGGREGATED.xml", # noqa
"imap_codice_l0_lo-counters-singles_20240429_v001.pkts": "P_COD_LO_INST_COUNTS_SINGLES.xml", # noqa
Expand All @@ -47,6 +48,7 @@ def decom_packets(packet_file: Path) -> list:
"imap_codice_l0_lo-nsw-priority_20240429_v001.pkts": "P_COD_LO_NSW_PRIORITY_COUNTS.xml", # noqa
"imap_codice_l0_lo-sw-species_20240429_v001.pkts": "P_COD_LO_SW_SPECIES_COUNTS.xml", # noqa
"imap_codice_l0_lo-nsw-species_20240429_v001.pkts": "P_COD_LO_NSW_SPECIES_COUNTS.xml", # noqa
"imap_codice_l0_lo-pha_20240429_v001.pkts": "P_COD_LO_PHA.xml",
}

xtce_document = Path(
Expand Down
Loading

0 comments on commit b3d0377

Please sign in to comment.