Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion imap_processing/hit/l0/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"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
"l4fgrates": HITPacking(16, 768, (48,)), # all range foreground rates
"l4bgrates": HITPacking(16, 384, (24,)), # all range foreground rates
}
Expand Down
3 changes: 2 additions & 1 deletion imap_processing/hit/l0/decom_hit.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ 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
# Transpose data to 15x8 for azimuth and zenith look directions
parsed_data = np.array(parsed_data).reshape((-1, *field_meta.shape))
parsed_data = np.transpose(parsed_data, axes=(0, 2, 1))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would happen if you left L0 as (15, 8) and didn't transpose it here? Would that cause any issues?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The values end up in a different arrangement in the data array which then fails HIT's validation tests. I guess transposing data is different from reshaping data and I didn't realize that before

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized you added the transpose here as part as part of this change, so that was a dumb question

dims = ["epoch", "azimuth", "zenith"]
# Add angle values to coordinates
sci_dataset.coords["zenith"] = xr.DataArray(
Expand Down
14 changes: 11 additions & 3 deletions imap_processing/hit/l1a/hit_l1a.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down Expand Up @@ -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()
}
Expand Down