Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaning up some L1A hist CDF issues found when reviewing output file #547

Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 2 additions & 12 deletions imap_processing/hi/hi_cdf_attrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,28 +161,18 @@
units="deg",
label_axis="ANGLE",
display_type="time_series",
catdesc="Angle bin centers for Histogram data.",
catdesc="Angle bin centers for histogram data.",
fieldname="ANGLE",
fill_val=GlobalConstants.INT_FILLVAL,
var_type="support_data",
)

hi_hist_l1a_esa_step_attrs = ScienceAttrs(
validmin=0,
validmax=2**4 - 1,
depend_0="epoch",
format="I2",
catdesc="4-bit ESA Step Number",
var_type="support_data",
variable_purpose="PRIMARY",
)

hi_hist_l1a_counter_attrs = ScienceAttrs(
validmin=0,
validmax=2**12 - 1,
depend_0="epoch",
depend_1="angle",
format="I4",
var_type="support_data",
var_type="data",
variable_purpose="PRIMARY",
)
12 changes: 4 additions & 8 deletions imap_processing/hi/l1a/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,17 @@ def allocate_histogram_dataset(num_packets: int) -> xr.Dataset:
data_vars["esa_step"] = xr.DataArray(
np.empty(num_packets, dtype=np.uint8),
dims=["epoch"],
attrs=dataclasses.replace(
hi_cdf_attrs.hi_hist_l1a_esa_step_attrs,
fieldname="ESA_STEP",
label_axis="ESA_STEP",
).output(),
attrs=hi_cdf_attrs.esa_step_attrs.output(),
)

for counter in (*QUALIFIED_COUNTERS, *LONG_COUNTERS, *TOTAL_COUNTERS):
data_vars[counter] = xr.DataArray(
data=np.empty((num_packets, len(coords["angle"])), np.dtype("uint16")),
data=np.empty((num_packets, len(coords["angle"])), np.uint16),
dims=["epoch", "angle"],
attrs=dataclasses.replace(
hi_cdf_attrs.hi_hist_l1a_counter_attrs,
catdesc=f"Counts for {counter} counter",
fieldname=counter,
catdesc=f"Angular histogram of {counter} type events",
fieldname=f"{counter} histogram",
label_axis=counter,
).output(),
)
Expand Down
Loading