Skip to content

Commit 75e9083

Browse files
authored
Change CDF types of L2/L1D variables for MAG (#2519)
* force type for generate dataset to use more reasonable CDF types for variables * use attributes to alter CDF type instead - potentially neater solution
1 parent ee834d8 commit 75e9083

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

imap_processing/cdf/config/imap_mag_l2_variable_attrs.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ vector_attrs: &vectors_default
5050
LABL_PTR_1: direction_label
5151
FILLVAL: 9223372036854775807
5252
FORMAT: F12.5
53+
CDF_DATA_TYPE: CDF_FLOAT
5354
DICT_KEY: "SPASE>Field>FieldQuantity:Magnetic,Qualifier:Vector,CoordinateSystemName:DSRF,CoordinateRepresentation:Cartesian"
5455

5556
# Frame-specific vector attributes
@@ -99,6 +100,7 @@ magnitude:
99100
UNITS: nT
100101
VALIDMIN: 0
101102
VALIDMAX: 1.0e+5
103+
CDF_DATA_TYPE: CDF_FLOAT
102104
DICT_KEY: SPASE>Field>FieldQuantity:Magnetic,Qualifier:Scalar
103105

104106
range:
@@ -111,6 +113,7 @@ range:
111113
UNITS: ' '
112114
VALIDMAX: 3
113115
VALIDMIN: 0
116+
CDF_DATA_TYPE: CDF_UINT1
114117
DICT_KEY: SPASE>Support>SupportQuantity:InstrumentMode
115118

116119
pri_sens:

imap_processing/mag/l2/mag_l2_data.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ def generate_dataset(
150150
self.vectors,
151151
name="vectors",
152152
dims=["epoch", "direction"],
153-
attrs=attribute_manager.get_variable_attributes(vector_attrs_name),
153+
attrs=attribute_manager.get_variable_attributes(
154+
vector_attrs_name, check_schema=False
155+
),
154156
)
155157

156158
quality_flags = xr.DataArray(
@@ -171,14 +173,18 @@ def generate_dataset(
171173
self.range,
172174
name="range",
173175
dims=["epoch"],
174-
attrs=attribute_manager.get_variable_attributes("range"),
176+
attrs=attribute_manager.get_variable_attributes(
177+
"range", check_schema=False
178+
),
175179
)
176180

177181
magnitude = xr.DataArray(
178182
self.magnitude,
179183
name="magnitude",
180184
dims=["epoch"],
181-
attrs=attribute_manager.get_variable_attributes("magnitude"),
185+
attrs=attribute_manager.get_variable_attributes(
186+
"magnitude", check_schema=False
187+
),
182188
)
183189

184190
global_attributes = (

imap_processing/tests/mag/test_mag_l2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def test_mag_l2_attributes(norm_dataset, mag_test_l2_data, data_mode):
7575
assert dataset["range"].attrs["DICT_KEY"] == (
7676
"SPASE>Support>SupportQuantity:InstrumentMode"
7777
)
78+
assert dataset["vectors"].attrs["CDF_DATA_TYPE"] == "CDF_FLOAT"
7879

7980

8081
def test_mag_l2(norm_dataset, mag_test_l2_data):

0 commit comments

Comments
 (0)