File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -240,6 +240,20 @@ codice_hi_spin_sector:
240240 VAR_TYPE : support_data
241241 dtype : int32
242242
243+ codice_hi_spin_angle :
244+ CATDESC : CoDICE-Hi spin angle for each spin sector and polar angle pair
245+ DEPEND_1 : codice_hi_spin_sector
246+ DEPEND_2 : codice_hi_polar
247+ FIELDNAM : CoDICE-Hi spin angle
248+ FILLVAL : -1.0e31
249+ FORMAT : F12.6
250+ SCALETYP : linear
251+ UNITS : degrees
252+ VALIDMAX : 360.0
253+ VALIDMIN : 0.0
254+ VAR_TYPE : support_data
255+ dtype : float32
256+
243257codice_hi_spin_sector_labels :
244258 CATDESC : CoDICE-Hi spin sector labels
245259 FIELDNAM : CoDICE-Hi spin sector labels
Original file line number Diff line number Diff line change 1212 HI_IALIRT_ELEVATION_ANGLE ,
1313)
1414from imap_processing .ialirt .utils .constants import (
15+ HI_IALIRT_SPIN_ANGLE ,
1516 IALIRT_DIMS ,
1617 IALIRT_DTYPES ,
1718 codice_hi_energy_center ,
@@ -232,6 +233,15 @@ def create_xarray_from_records(records: list[dict]) -> xr.Dataset: # noqa: PLR0
232233 ),
233234 )
234235
236+ spin_angle = xr .DataArray (
237+ data = HI_IALIRT_SPIN_ANGLE .T .astype (np .float32 ),
238+ name = "codice_hi_spin_angle" ,
239+ dims = ["codice_hi_spin_sector" , "codice_hi_polar" ],
240+ attrs = cdf_manager .get_variable_attributes (
241+ "codice_hi_spin_angle" , check_schema = False
242+ ),
243+ )
244+
235245 spin_sector_labels = xr .DataArray (
236246 [
237247 "0" ,
@@ -267,6 +277,7 @@ def create_xarray_from_records(records: list[dict]) -> xr.Dataset: # noqa: PLR0
267277 "codice_hi_polar" : polar ,
268278 "codice_hi_polar_labels" : polar_labels ,
269279 "codice_hi_spin_sector" : spin_sector ,
280+ "codice_hi_spin_angle" : spin_angle ,
270281 "codice_hi_spin_sector_labels" : spin_sector_labels ,
271282 "swe_electron_energy" : swe_electron_energy ,
272283 }
Original file line number Diff line number Diff line change 66import numpy .testing as npt
77
88from imap_processing .cdf .utils import write_cdf
9- from imap_processing .ialirt .utils .constants import swe_energy
9+ from imap_processing .ialirt .utils .constants import HI_IALIRT_SPIN_ANGLE , swe_energy
1010from imap_processing .ialirt .utils .create_xarray import create_xarray_from_records
1111
1212
@@ -166,3 +166,12 @@ def test_create_dataset():
166166 )
167167
168168 assert test_data_path .exists ()
169+
170+ # codice_hi_spin_angle should be a 2D array of actual spin angles (degrees).
171+ # Shape: (spin_sector=4, polar=4).
172+ spin_angle = dataset ["codice_hi_spin_angle" ]
173+ assert spin_angle .dims == ("codice_hi_spin_sector" , "codice_hi_polar" )
174+ assert spin_angle .shape == (4 , 4 )
175+ npt .assert_allclose (
176+ spin_angle .values , HI_IALIRT_SPIN_ANGLE .T .astype (np .float32 ), rtol = 1e-6
177+ )
You can’t perform that action at this time.
0 commit comments