diff --git a/imap_processing/mag/l0/decom_mag.py b/imap_processing/mag/l0/decom_mag.py index 5915091f4..35af6dec1 100644 --- a/imap_processing/mag/l0/decom_mag.py +++ b/imap_processing/mag/l0/decom_mag.py @@ -171,4 +171,4 @@ def generate_dataset( attrs=attribute_manager.get_variable_attributes(key), ) - return output.drop_duplicates("epoch") + return output diff --git a/imap_processing/mag/l1b/mag_l1b.py b/imap_processing/mag/l1b/mag_l1b.py index 1d0c47d0a..bd34fabbf 100644 --- a/imap_processing/mag/l1b/mag_l1b.py +++ b/imap_processing/mag/l1b/mag_l1b.py @@ -158,7 +158,7 @@ def rescale_vector( if not compression_flags[0]: return input_vector else: - factor = float(2 ** (16 - compression_flags[1])) + factor = np.float_power(2, (16 - compression_flags[1])) return input_vector * factor # type: ignore diff --git a/imap_processing/tests/mag/imap_mag_l1a_burst-magi_20231025_v001.cdf b/imap_processing/tests/mag/imap_mag_l1a_burst-magi_20231025_v001.cdf deleted file mode 100644 index a864120fe..000000000 Binary files a/imap_processing/tests/mag/imap_mag_l1a_burst-magi_20231025_v001.cdf and /dev/null differ diff --git a/imap_processing/tests/mag/imap_mag_l1a_norm-magi_20251017_v001.cdf b/imap_processing/tests/mag/imap_mag_l1a_norm-magi_20251017_v001.cdf new file mode 100644 index 000000000..d9ed9ef7e Binary files /dev/null and b/imap_processing/tests/mag/imap_mag_l1a_norm-magi_20251017_v001.cdf differ diff --git a/imap_processing/tests/mag/test_mag_l1b.py b/imap_processing/tests/mag/test_mag_l1b.py index f8cd155d3..795055ed5 100644 --- a/imap_processing/tests/mag/test_mag_l1b.py +++ b/imap_processing/tests/mag/test_mag_l1b.py @@ -18,7 +18,9 @@ def mag_l1a_dataset(): dims=["epoch", "direction"], coords={"epoch": epoch, "direction": direction}, ) - compression_flags = xr.DataArray(np.zeros((20, 2)), dims=["epoch", "compression"]) + compression_flags = xr.DataArray( + np.zeros((20, 2), dtype=np.int8), dims=["epoch", "compression"] + ) vectors[0, :] = np.array([1, 1, 1, 0]) @@ -69,10 +71,9 @@ def test_mag_attributes(mag_l1a_dataset): assert output.attrs["Data_level"] == "L1B" -@pytest.mark.skip(reason="Epoch variable data need to be monotonically increasing") def test_cdf_output(): l1a_cdf = load_cdf( - Path(__file__).parent / "imap_mag_l1a_burst-magi_20231025_v001.cdf" + Path(__file__).parent / "imap_mag_l1a_norm-magi_20251017_v001.cdf" ) l1b_dataset = mag_l1b(l1a_cdf, "v001") @@ -94,10 +95,10 @@ def test_mag_compression_scale(mag_l1a_dataset): mag_l1a_dataset["vectors"][2, :] = np.array([1, 1, 1, 0]) mag_l1a_dataset["vectors"][3, :] = np.array([1, 1, 1, 0]) - mag_l1a_dataset["compression_flags"][0, :] = np.array([1, 16]) - mag_l1a_dataset["compression_flags"][1, :] = np.array([0, 0]) - mag_l1a_dataset["compression_flags"][2, :] = np.array([1, 18]) - mag_l1a_dataset["compression_flags"][3, :] = np.array([1, 14]) + mag_l1a_dataset["compression_flags"][0, :] = np.array([1, 16], dtype=np.int8) + mag_l1a_dataset["compression_flags"][1, :] = np.array([0, 0], dtype=np.int8) + mag_l1a_dataset["compression_flags"][2, :] = np.array([1, 18], dtype=np.int8) + mag_l1a_dataset["compression_flags"][3, :] = np.array([1, 14], dtype=np.int8) mag_l1a_dataset.attrs["Logical_source"] = ["imap_mag_l1a_norm-mago"] output = mag_l1b(mag_l1a_dataset, "v001")