Skip to content
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
18 changes: 18 additions & 0 deletions imap_processing/tests/cdf/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from unittest import mock

import cdflib
import imap_data_access
import numpy as np
import pandas as pd
Expand Down Expand Up @@ -141,6 +142,23 @@ def test_write_cdf_extra_cdf_kwargs(test_dataset):
assert xarray_to_cdf.call_args.kwargs["compression"] == 9


def test_write_cdf_l2_epoch_attribute_types(test_dataset):
"""Test epoch attribute is TT2000, while epoch_delta attributes stay INT8."""
test_dataset.attrs["Logical_source"] = "imap_swe_l2_sci"
swe_attrs = ImapCdfAttributes()
test_dataset["epoch_delta"] = (
"epoch",
np.ones(3, dtype=np.int64),
swe_attrs.get_variable_attributes("epoch_delta", check_schema=False),
)
file_path = write_cdf(test_dataset, terminate_on_warning=False)

with cdflib.CDF(file_path) as cdf:
for att in ("FILLVAL", "VALIDMIN", "VALIDMAX"):
assert cdf.attget(att, "epoch").Data_Type == "CDF_TIME_TT2000"
assert cdf.attget(att, "epoch_delta").Data_Type == "CDF_INT8"


def test_write_cdf_converts_extension_array(test_dataset):
"""Pass NumPy string data to cdflib without changing the input dataset."""
test_dataset["labels"] = (
Expand Down
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ classifiers = [
]
dependencies = [
"astropy-healpix>=1.0",
"cdflib>=1.3.11",
"cdflib>=1.3.15",
"imap-data-access>=1.3.0",
"space_packet_parser>=6.0.0",
"spiceypy>=6.0.0",
Expand Down
Loading