diff --git a/imap_processing/hit/l0/constants.py b/imap_processing/hit/l0/constants.py index 961ff4b84c..2ac855242a 100644 --- a/imap_processing/hit/l0/constants.py +++ b/imap_processing/hit/l0/constants.py @@ -100,7 +100,9 @@ "penfgrates": HITPacking(16, 528, (33,)), # range 4 foreground rates "penbgrates": HITPacking(16, 240, (15,)), # range 4 background rates "ialirtrates": HITPacking(16, 320, (20,)), # ialirt rates - "sectorates": HITPacking(16, 1920, (15, 8)), # sectored rates + "sectorates": HITPacking( + 16, 1920, (8, 15) + ), # sectored rates (8 zenith angles, 15 azimuth angles) "l4fgrates": HITPacking(16, 768, (48,)), # all range foreground rates "l4bgrates": HITPacking(16, 384, (24,)), # all range foreground rates } diff --git a/imap_processing/hit/l0/decom_hit.py b/imap_processing/hit/l0/decom_hit.py index bfea20e51a..571702a12d 100644 --- a/imap_processing/hit/l0/decom_hit.py +++ b/imap_processing/hit/l0/decom_hit.py @@ -92,8 +92,11 @@ def parse_count_rates(sci_dataset: xr.Dataset) -> None: # Get dims for data variables (yaml file not created yet) if len(field_meta.shape) > 1: if "sectorates" in field: - # Reshape data to 15x8 for azimuth and zenith look directions + # Reshape data into (num_frames, 8, 15) for zenith and azimuth + # look directions parsed_data = np.array(parsed_data).reshape((-1, *field_meta.shape)) + # Transpose data to (num_frames, 15, 8) for flipped look directions + parsed_data = np.transpose(parsed_data, axes=(0, 2, 1)) dims = ["epoch", "azimuth", "zenith"] # Add angle values to coordinates sci_dataset.coords["zenith"] = xr.DataArray( diff --git a/imap_processing/hit/l1a/hit_l1a.py b/imap_processing/hit/l1a/hit_l1a.py index 9d1d074a64..ed165fd22d 100644 --- a/imap_processing/hit/l1a/hit_l1a.py +++ b/imap_processing/hit/l1a/hit_l1a.py @@ -13,7 +13,11 @@ get_datasets_by_apid, process_housekeeping_data, ) -from imap_processing.hit.l0.constants import MOD_10_MAPPING +from imap_processing.hit.l0.constants import ( + AZIMUTH_ANGLES, + MOD_10_MAPPING, + ZENITH_ANGLES, +) from imap_processing.hit.l0.decom_hit import decom_hit logger = logging.getLogger(__name__) @@ -104,12 +108,16 @@ def subcom_sectorates(sci_dataset: xr.Dataset) -> xr.Dataset: hdr_min_count_mod_10 = updated_dataset.hdr_minute_cnt.values % 10 # Reference mod 10 mapping to initialize data structure for species and - # energy ranges and add 15x8 arrays with fill values for each science frame. + # energy ranges and add arrays with fill values for each science frame. num_frames = len(hdr_min_count_mod_10) data_by_species_and_energy_range = { key: { **value, - "counts": np.full((num_frames, 15, 8), fill_value=fillval, dtype=np.int64), + "counts": np.full( + (num_frames, len(AZIMUTH_ANGLES), len(ZENITH_ANGLES)), + fill_value=fillval, + dtype=np.int64, + ), } for key, value in MOD_10_MAPPING.items() }