-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MNT: Change IMAP-Hi over to use new dataset accessor
This updates the Hi utilities to use the dataset creator. There is still some work that can be done to improve and numpy broadcast some of the routines, but this at least shows the basics.
- Loading branch information
Showing
6 changed files
with
41 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,26 @@ | ||
"""Unpack IMAP-Hi housekeeping data.""" | ||
|
||
import xarray as xr | ||
from space_packet_parser.parser import Packet | ||
|
||
from imap_processing.hi.hi_cdf_attrs import ( | ||
hi_hk_l1a_attrs, | ||
) | ||
from imap_processing.utils import create_dataset, update_epoch_to_datetime | ||
|
||
|
||
def process_housekeeping(packets: list[Packet]) -> xr.Dataset: | ||
def process_housekeeping(dataset: xr.Dataset) -> xr.Dataset: | ||
""" | ||
Create dataset for each metadata field. | ||
Parameters | ||
---------- | ||
packets : list[space_packet_parser.ParsedPacket] | ||
Packet list. | ||
dataset : xarray.Dataset | ||
Packet input dataset. | ||
Returns | ||
------- | ||
dataset : xarray.Dataset | ||
Dataset with all metadata field data in xr.DataArray. | ||
""" | ||
dataset = create_dataset( | ||
packets=packets, spacecraft_time_key="ccsds_met", skip_keys=["INSTR_SPECIFIC"] | ||
) | ||
# Update epoch to datetime | ||
dataset = update_epoch_to_datetime(dataset) | ||
|
||
# Add datalevel attrs | ||
dataset.attrs.update(hi_hk_l1a_attrs.output()) | ||
return dataset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters