-
Notifications
You must be signed in to change notification settings - Fork 16
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
MNT: Cdflib update #991
MNT: Cdflib update #991
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why doesn't LABLAXIS work here? Is that an error out of cdflib? Overall it looks good to me, I'm just wondering why LABLAXIS doesn't work...
@maxinelasp There is two parts to this. If schema defines a required field, it will add that and fill it with empty string even if we don't include it our own YAML file. This happens from this line. Since ISTP doesn't allow to set both LABLAXIS and LABL_PTR_i, cdflib will complain that we had set LABLAXIS and LABL_PTR_i even though user didn't but schema did. |
@@ -89,6 +89,7 @@ def test_l1a_data(request) -> xr.Dataset: | |||
return dataset | |||
|
|||
|
|||
@pytest.mark.xfail(reason="Epoch variable data needs to monotonically increase") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created new issue to capture this #992
@@ -167,6 +169,7 @@ def test_l1a_data_array_values(test_l1a_data: xr.Dataset, validation_data: Path) | |||
) | |||
|
|||
|
|||
@pytest.mark.xfail(reason="Epoch variable data needs to monotonically increase") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
captured this work in #993
But, if we mark both as |
Copy of Slack conversation in case someone is wondering same thing.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this on! I have a couple of nit picks for Hi changes. One thing that we should make consistent across all instruments is that label variables should be variables, not coordinates. It would make sense to put that in it's own PR.
For my Hi nits, I am happy to make a commit with the changes since they are purely stylistic things.
imap_processing/hi/l1a/histogram.py
Outdated
@@ -108,6 +108,13 @@ def allocate_histogram_dataset(num_packets: int) -> xr.Dataset: | |||
dims=["angle"], | |||
attrs=attr_mgr.get_variable_attributes("hi_hist_angle"), | |||
) | |||
coords["angle_label"] = xr.DataArray( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Label variables should not be added to the coordinates list. They are just variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LABL_PTR_i confused me a lot. Changes in this file and XML file is related to that. This is something SPDF and ISTP caused. When your data has great than 1D array, it requires to have label for each DEPEND_1
and onward. And we need to create xr.DataArray for those labels and need to add those to coordinate, otherwise cdflib
will throw error.
FAILED imap_processing/tests/hi/test_l1a.py::test_app_hist_decom - cdflib.xarray.xarray_to_cdf.ISTPError: ISTP Compliance Warning: variable qual_ab listed angle_label as its LABL_PTR_1. However, it was not found in the dataset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coords["angle_label"] = xr.DataArray( | |
data_vars["angle_label"] = xr.DataArray( |
I think that is what @subagonsouth is suggesting. cdflib fails with that as well? Coordinates should be optional, so this might be an issue to raise with cdflib.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moving this to data variable. I will refactor other instrument's label in new PR. I do want to point out that other past mission did store their coordinate label in coordinate as well. I wonder if they did that to be able to select and filter data easier later on. That's something we should think about. I will check with Andriy first before I refactor other instrument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this!
@@ -62,6 +63,9 @@ def test_app_nhk_decom(hi_l0_test_data_path): | |||
assert cem_raw_cdf_filepath.name == "imap_hi_l1a_45sensor-hk_20100313_v001.cdf" | |||
|
|||
|
|||
@pytest.mark.skip( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
captured this work in #1009
01d3464
into
IMAP-Science-Operations-Center:dev
Change Summary
closes #606
Overview
Updated cdflib to it's latest version. Made changes where I can but some was outside of what I can do. For those, I marked pytest to skip and need to address in future PR.
Updated Files
Instruments updated
required
tofalse
because some those are only required forepoch
variable and not other data type. Also,LABLAXIS
is not required if 'LABL_PTR_iis set. These will be taken care of in
sammi`. Changes I made is temporary fixes.Testing
I had to skip few tests due to data not increasing monotonically. I will create issue for those that needs update.