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

1147 hi l1c add calibration product coordinate to pset #1172

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

subagonsouth
Copy link
Contributor

Change Summary

Overview

This adds the missing calibration_prod dimension to the pset data product.

Updated Files

  • imap_processing/cdf/config/imap_hi_variable_attrs.yaml
    • Add calibration_prod coordinate
    • Add calibration_prod_label metadata
    • Update relevant variables to include added dimension
  • imap_processing/hi/l1c/hi_l1c.py
    • Add populated calibration_prod coordinate to xr.Dataset
    • Add populated calibration_prod_label data_var to xr.Dataset
  • imap_processing/tests/hi/test_hi_l1c.py
    • Add test coverage for new coordinate and variable shapes
    • Add check for ISTP compliance by writing CDF from dataset

closes: #1147

@subagonsouth subagonsouth added the Ins: Hi Related to the IMAP-Hi instrument label Nov 20, 2024
@subagonsouth subagonsouth requested a review from a team November 20, 2024 21:58
@subagonsouth subagonsouth self-assigned this Nov 20, 2024
@subagonsouth subagonsouth requested review from vmartinez-cu, laspsandoval and maxinelasp and removed request for a team November 20, 2024 21:58
Copy link
Contributor

@laspsandoval laspsandoval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just a few suggestions.

SCALE_TYP: linear
MONOTON: INCREASE
VALIDMIN: 0
VALIDMAX: 4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the max possibly change and if so does it make sense to have this be a larger value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generally think of the valid max as a way to specify the range of expected values. Expanding this range just for a possible future change doesn't adhere to that definition IMO. I see that SPDF says VALIDMIN and VALIDMAX are the range of values expected for the lifetime of the mission. I see how that could be interpreted to allow for a future increase in the range.
I'm going to add a comment to the ticket that I have for defining the coincidence type to calibration product mapping to revisit this value. I will ask Paul about these details next time we meet and make appropriate changes in that ticket: #1170

# TODO: define calibration product number to coincidence type mapping and
# use the number of calibration products here. I believe it will be 5
# 0 for any, 1-4, for the number of detector hits.
n_calibration_prod = 5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of hardcoding 5, consider making n_calibration_prod a named constant
N_CALIBRATION_PRODUCTS = 5

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value will be pulled from the mapping that is defined in #1170 so this hard coding here is just temporary.

# use the number of calibration products here. I believe it will be 5
# 0 for any, 1-4, for the number of detector hits.
n_calibration_prod = 5
attrs = attr_mgr.get_variable_attributes(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is check_schema=False? I can't remember.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SAMMI will strip off all of the dtype entries if I don't pass check_schema=False.

Comment on lines +316 to +317
CATDESC: Calibration product number
FIELDNAM: Coincidence types are combined into various calibration products
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the CATDESC and FIELDNAM values be switched? I've been seeing longer descriptions being placed in the CATDESC field. FIELDNAM can be used to label a plot, so if that's the information that needs to be displayed, then switching these descriptions may not be necessary.

Copy link
Contributor

@vmartinez-cu vmartinez-cu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ins: Hi Related to the IMAP-Hi instrument
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Hi L1C - Add calibration product coordinate to pset
3 participants