diff --git a/imap_processing/cdf/config/imap_glows_l1a_variable_attrs.yaml b/imap_processing/cdf/config/imap_glows_l1a_variable_attrs.yaml index c1655033a..e368bac15 100644 --- a/imap_processing/cdf/config/imap_glows_l1a_variable_attrs.yaml +++ b/imap_processing/cdf/config/imap_glows_l1a_variable_attrs.yaml @@ -16,6 +16,16 @@ default_attrs: &default_attrs FILLVAL: *int_fillval VALIDMIN: *min_epoch +support_data_defaults: &support_data_defaults + <<: *default_attrs + DEPEND_0: epoch + VALIDMIN: 0 + VALIDMAX: 1 + DISPLAY_TYPE: time_series + VAR_TYPE: support_data + FORMAT: I10 + RESOLUTION: ISO8601 + bins_attrs: <<: *default_attrs VALIDMIN: 0 @@ -31,7 +41,7 @@ bins_attrs: within_the_second: # Used to be per_second_attrs <<: *default_attrs - VALIDMMIN: 0 + VALIDMIN: 0 VALIDMAX: 50000 CATDESC: Direct events recorded in individual seconds # TBD any ideas how to define it FIELDNAM: Direct events within a second @@ -42,7 +52,7 @@ within_the_second: # Used to be per_second_attrs direct_event_components_attrs: <<: *default_attrs - VALIDMMIN: 0 + VALIDMIN: 0 VALIDMAX: 3 CATDESC: Components of a direct event (seconds, subseconds, impulse_length, multi_event) FIELDNAM: Direct event components @@ -80,18 +90,8 @@ histogram: UNITS: counts VAR_TYPE: data -metadata_attrs: &metadata_attrs - <<: *default_attrs - DEPEND_0: epoch - VALIDMIN: 0 - VALIDMAX: 1 - DISPLAY_TYPE: time_series - VAR_TYPE: support_data - FORMAT: I10 - RESOLUTION: ISO8601 - pkts_file_name: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Name of input file with CCSDS packets data DISPLAY_TYPE: no_plot FIELDNAM: Packets-data input filename @@ -103,7 +103,7 @@ pkts_file_name: VAR_TYPE: metadata last_spin_id: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: The ordinal number of the last spin during histogram accumulation FIELDNAM: Number of the last spin in histogram FILLVAL: *max_uint32 @@ -112,9 +112,10 @@ last_spin_id: VALIDMAX: *max_uint32_min_one imap_start_time: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Histogram start time, IMAP-clock seconds FIELDNAM: Histogram start time, IMAP-clock seconds + # TODO: Presumably float64 max or min should be here? FILLVAL: *int_fillval FORMAT: F16.6 UNITS: seconds @@ -123,9 +124,10 @@ imap_start_time: VALIDMIN: 0.0 imap_time_offset: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Accumulation time in seconds for GLOWS histogram FIELDNAM: Histogram accumulation time + # TODO: Presumably float64 max or min should be here? FILLVAL: *int_fillval FORMAT: F12.6 UNITS: seconds @@ -134,7 +136,7 @@ imap_time_offset: VALIDMIN: 0.0 glows_start_time: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Histogram start time, GLOWS-clock seconds FIELDNAM: Histogram start time, GLOWS-clock seconds FILLVAL: *int_fillval @@ -145,7 +147,7 @@ glows_start_time: VALIDMIN: 0.0 glows_time_offset: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Accumulation time in seconds for GLOWS histogram FIELDNAM: Histogram accumulation time FILLVAL: *int_fillval @@ -156,7 +158,8 @@ glows_time_offset: VALIDMIN: 0.0 flags_set_onboard: - <<: *metadata_attrs + # TODO: Verify uint32 fillval and uint16 validmax + <<: *support_data_defaults CATDESC: Binary mask with histogram flags set onboard FIELDNAM: Mask with histogram flags set onboard FILLVAL: *max_uint32 @@ -165,7 +168,7 @@ flags_set_onboard: VALIDMAX: *max_uint16 is_generated_on_ground: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Flag indicating where histogram data was generated (1 - on the ground, 0 - onboard) FIELDNAM: Histogram-creation-site flag FILLVAL: -128 @@ -174,7 +177,7 @@ is_generated_on_ground: VALIDMAX: 1 number_of_spins_per_block: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Number of spins per block during accumulation of histogram FIELDNAM: Number of spins per block FILLVAL: 65535 @@ -183,17 +186,8 @@ number_of_spins_per_block: VALIDMAX: 256 VALIDMIN: 1 -number_of_spins_per_histogram: # Should this be removed? - <<: *metadata_attrs - CATDESC: Number of histogram bins - FIELDNAME: Number of histogram bins - FILLVAL: *int_fillval - LABLAXIS: Metadata - VALIDMAX: 1000000000 - VAR_TYPE: metadata - number_of_bins_per_histogram: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Number of histogram bins FIELDNAM: Number of histogram bins FILLVAL: *max_uint16 @@ -203,7 +197,7 @@ number_of_bins_per_histogram: VALIDMIN: 225 number_of_events: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Total number of events/counts in the histogram FIELDNAM: Total number of counts in histogram FILLVAL: *int_fillval @@ -212,7 +206,7 @@ number_of_events: VALIDMAX: *max_uint32 filter_temperature_average: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Uint-encoded spin-block-averaged filter temperature FIELDNAM: Average filter temperature FILLVAL: *max_uint16 @@ -221,7 +215,7 @@ filter_temperature_average: VALIDMAX: 255 filter_temperature_variance: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Uint-encoded spin-block-averaged variance of filter temperature FIELDNAM: Variance of filter temperature FILLVAL: *max_uint32 @@ -230,7 +224,7 @@ filter_temperature_variance: VALIDMAX: *max_uint16 hv_voltage_average: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Uint-encoded spin-block-averaged CEM voltage FIELDNAM: Uint-encoded averaged CEM voltage FILLVAL: *max_uint32 @@ -239,7 +233,7 @@ hv_voltage_average: VALIDMAX: *max_uint16 hv_voltage_variance: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: variance of HV voltage on the CEM, uint encoded FIELDNAM: Uint encoded HV voltage variance FILLVAL: *int_fillval @@ -247,7 +241,7 @@ hv_voltage_variance: VALIDMAX: *max_uint32 spin_period_average: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Uint-encoded spin-block-averaged spin period DEPEND_0: epoch DISPLAY_TYPE: time_series @@ -261,7 +255,7 @@ spin_period_average: VAR_TYPE: support_data spin_period_variance: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Uint-encoded spin-block-averaged variance of spin period FIELDNAM: Uint-encoded variance of spin period FILLVAL: *int_fillval @@ -270,7 +264,7 @@ spin_period_variance: VALIDMAX: *max_uint32 pulse_length_average: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Uint-encoded spin-block-averaged pulse length FIELDNAM: Averaged pulse length FILLVAL: *max_uint16 @@ -279,7 +273,7 @@ pulse_length_average: VALIDMAX: 255 pulse_length_variance: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Uint encoded spin-block-averaged variance of pulse length FIELDNAM: Variance of pulse length FILLVAL: *max_uint32 @@ -290,7 +284,7 @@ pulse_length_variance: # support_data seq_count_in_pkts_file: - <<: *metadata_attrs + <<: *support_data_defaults # TBD: problem with several values associated with one epoch value CATDESC: Ordinal number of a packet in a sequence of multiple CCSDS packets FIELDNAM: Packet sequence counter @@ -300,7 +294,7 @@ seq_count_in_pkts_file: VALIDMAX: 65534 # uint16_max - 1, because it must be less than VALIDMAX for number_of_de_packets number_of_de_packets: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Number of packets for a given portion (second) of direct-event data FIELDNAM: Number of DE packets FILLVAL: *max_uint32 @@ -311,7 +305,7 @@ number_of_de_packets: # data_every_second in glows_l1a.py imap_sclk_last_pps: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: IMAP-clock seconds for last PPS FIELDNAM: IMAP-clock seconds for last PPS FILLVAL: *max_uint32 @@ -321,7 +315,7 @@ imap_sclk_last_pps: VALIDMAX: *max_uint32_min_one glows_sclk_last_pps: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: GLOWS-clock seconds for last PPS FIELDNAM: GLOWS-clock seconds for last PPS DISPLAY_TYPE: no_plot @@ -332,7 +326,7 @@ glows_sclk_last_pps: VALIDMAX: *max_uint32_min_one glows_ssclk_last_pps: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: GLOWS-clock subseconds for last PPS FIELDNAM: GLOWS-clock subseconds for last PPS DISPLAY_TYPE: no_plot @@ -341,7 +335,7 @@ glows_ssclk_last_pps: VALIDMAX: 1999999 imap_sclk_next_pps: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: IMAP-clock seconds for next PPS FIELDNAM: IMAP-clock seconds for next PPS FILLVAL: *max_uint32 @@ -351,7 +345,7 @@ imap_sclk_next_pps: VALIDMAX: *max_uint32_min_one catbed_heater_active: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Catbed-heater activity flag (1 - active, 0 - not active) FIELDNAM: Catbed-heater activity flag FILLVAL: -128 @@ -359,7 +353,7 @@ catbed_heater_active: LABLAXIS: Flag spin_period_valid: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Spin-period-validity flag (1 - valid, 0 - invalid) FIELDNAM: Spin-period-validity flag FILLVAL: -128 @@ -367,7 +361,7 @@ spin_period_valid: LABLAXIS: Flag spin_phase_at_next_pps_valid: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Spin-phase-at-next-PPS validity flag (1 - valid, 0 - invalid) FIELDNAM: Spin-phase-at-next-PPS validity flag FILLVAL: -128 @@ -375,7 +369,7 @@ spin_phase_at_next_pps_valid: LABLAXIS: Flag spin_period_source: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Spin-period-source flag (0 - from ITF, 1 - estimated by GLOWS AppSW) FIELDNAM: Spin-period-source flag FILLVAL: -128 @@ -383,7 +377,7 @@ spin_period_source: LABLAXIS: Flag spin_period: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Uint encoded spin period value FIELDNAM: Uint encoded spin period value FILLVAL: *max_uint16 @@ -393,7 +387,7 @@ spin_period: VALIDMIN: 45000 # TBC 14.63 s where 20.9712 s = 65535, rounded down spin_phase_at_next_pps: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Uint encoded next spin phase value FIELDNAM: Uint encoded next spin phase value FILLVAL: *max_uint32 @@ -402,7 +396,7 @@ spin_phase_at_next_pps: VALIDMAX: *max_uint16 number_of_completed_spins: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Number of completed spins FIELDNAM: Number of completed spins FILLVAL: *max_uint32 @@ -411,7 +405,7 @@ number_of_completed_spins: VALIDMAX: *max_uint32_min_one filter_temperature: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Uint encoded filter temperature FIELDNAM: Filter temperature FILLVAL: *max_uint32 @@ -421,16 +415,16 @@ filter_temperature: DISPLAY_TYPE: time_series hv_voltage: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Uint encoded CEM voltage FIELDNAM: Uint encoded CEM voltage FILLVAL: *max_uint32 FORMAT: I6 LABLAXIS: Voltage - VALIDMAX: 65635 # Is this a typo? + VALIDMAX: *max_uint16 glows_time_on_pps_valid: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: GLOWS-time-on-PPS-arrival validity flag (1 - valid, 0 - not valid) FIELDNAM: GLOWS time validity flag FILLVAL: -128 @@ -438,7 +432,7 @@ glows_time_on_pps_valid: LABLAXIS: Flag time_status_valid: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Time-status-data-structure-validity flag (1 - valid, 0 - invalid) FIELDNAM: Time-status-structure-validity flag FILLVAL: -128 @@ -446,7 +440,7 @@ time_status_valid: LABLAXIS: Flag housekeeping_valid: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: GLOWS housekeeping validity flag (1 - valid, 0 - invalid) FIELDNAM: Housekeeping validity flag FILLVAL: -128 @@ -454,7 +448,7 @@ housekeeping_valid: LABLAXIS: Flag is_pps_autogenerated: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Flag indicating whether PPS is autogenerated (1 - autogenerated, 0 - external) FIELDNAM: Autogenerated-PPS flag FILLVAL: -128 @@ -462,7 +456,7 @@ is_pps_autogenerated: LABLAXIS: Flag hv_test_in_progress: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: HV-test-in-progress flag (1 - test is on, 0 - test is off) FIELDNAM: HV-test-in-progress flag FILLVAL: -128 @@ -470,7 +464,7 @@ hv_test_in_progress: LABLAXIS: Flag pulse_test_in_progress: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Pulse-test-in-progress flag (1 - test is on, 0 - test is off) FIELDNAM: Pulse-test-in-progress flag FILLVAL: -128 # int8_min @@ -478,7 +472,7 @@ pulse_test_in_progress: LABLAXIS: Flag memory_error_detected: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Memory-error flag (1 - error detected, 0 - no error) FIELDNAM: Memory-error flag FILLVAL: -128 @@ -487,7 +481,7 @@ memory_error_detected: # End of data_every_second missing_packets_sequence: # Used to be missing_packets_sequence - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: Missing packet sequence numbers # Make it a string FIELDNAM: Missing packet sequences FILLVAL: *int_fillval @@ -497,7 +491,7 @@ missing_packets_sequence: # Used to be missing_packets_sequence VAR_TYPE: metadata flight_software_version: - <<: *metadata_attrs + <<: *support_data_defaults CATDESC: GLOWS flight software version FIELDNAM: GLOWS flight software version FILLVAL: *max_uint32 diff --git a/imap_processing/glows/l1a/glows_l1a.py b/imap_processing/glows/l1a/glows_l1a.py index 6e84104d2..92c70aa52 100644 --- a/imap_processing/glows/l1a/glows_l1a.py +++ b/imap_processing/glows/l1a/glows_l1a.py @@ -244,20 +244,20 @@ def generate_de_dataset( ) # TODO come up with a better name - per_second = xr.DataArray( + within_the_second = xr.DataArray( np.arange(direct_events.shape[1]), - name="per_second", - dims=["per_second"], + name="within_the_second", + dims=["within_the_second"], attrs=glows_cdf_attributes.get_variable_attributes("within_the_second"), ) de = xr.DataArray( direct_events, name="direct_events", - dims=["epoch", "per_second", "direct_event"], + dims=["epoch", "within_the_second", "direct_event"], coords={ "epoch": epoch_time, - "per_second": per_second, + "within_the_second": within_the_second, "direct_event": direct_event, }, attrs=glows_cdf_attributes.get_variable_attributes("direct_events"),