Skip to content

Commit c42ecb3

Browse files
author
Menlo Innovations - CAVA Project
committed
Merge branch 'main' into 3029-codice-lo-de-normalization
2 parents 23a683d + b477b70 commit c42ecb3

4 files changed

Lines changed: 97 additions & 6 deletions

File tree

imap_l3_processing/cdf/config/imap_glows_l3e_survival-probability-ul-hf_variable_attrs.yaml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,37 @@ elongation_excluded:
198198
FILLVAL: 65535
199199
VALIDMAX: 0
200200
VALIDMIN: 180
201-
RECORD_VARYING: RV
201+
RECORD_VARYING: RV
202+
203+
pixel_longitude:
204+
NAME: pixel_longitude
205+
DEPEND_0: epoch
206+
DEPEND_1: healpix_index
207+
DATA_TYPE: CDF_FLOAT
208+
CATDESC: Pixel center longitude in HAE (ECLIPJ2000)
209+
VAR_NOTES: Reference frames are defined according to IMAP mission SPICE kernels.
210+
VAR_TYPE: metadata
211+
FIELDNAM: HAE longitude
212+
LABLAXIS: Longitude
213+
RECORD_VARYING: RV
214+
FORMAT: F9.3
215+
FILLVAL: -1.0000E+31
216+
UNITS: degrees
217+
VALIDMIN: 0
218+
VALIDMAX: 360
219+
pixel_latitude:
220+
NAME: pixel_latitude
221+
DEPEND_0: epoch
222+
DEPEND_1: healpix_index
223+
DATA_TYPE: CDF_FLOAT
224+
CATDESC: Pixel center latitude in HAE (ECLIPJ2000)
225+
VAR_NOTES: Reference frames are defined according to IMAP mission SPICE kernels.
226+
VAR_TYPE: metadata
227+
FIELDNAM: HAE latitude
228+
LABLAXIS: Latitude
229+
RECORD_VARYING: RV
230+
FORMAT: F9.3
231+
FILLVAL: -1.0000E+31
232+
UNITS: degrees
233+
VALIDMIN: -90
234+
VALIDMAX: 90

imap_l3_processing/cdf/config/imap_glows_l3e_survival-probability-ul-sf_variable_attrs.yaml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,36 @@ elongation_excluded:
198198
FILLVAL: 65535
199199
VALIDMAX: 0
200200
VALIDMIN: 180
201-
RECORD_VARYING: RV
201+
RECORD_VARYING: RV
202+
pixel_longitude:
203+
NAME: pixel_longitude
204+
DEPEND_0: epoch
205+
DEPEND_1: healpix_index
206+
DATA_TYPE: CDF_FLOAT
207+
CATDESC: Pixel center longitude in HAE (ECLIPJ2000)
208+
VAR_NOTES: Reference frames are defined according to IMAP mission SPICE kernels.
209+
VAR_TYPE: metadata
210+
FIELDNAM: HAE longitude
211+
LABLAXIS: Longitude
212+
RECORD_VARYING: RV
213+
FORMAT: F9.3
214+
FILLVAL: -1.0000E+31
215+
UNITS: degrees
216+
VALIDMIN: 0
217+
VALIDMAX: 360
218+
pixel_latitude:
219+
NAME: pixel_latitude
220+
DEPEND_0: epoch
221+
DEPEND_1: healpix_index
222+
DATA_TYPE: CDF_FLOAT
223+
CATDESC: Pixel center latitude in HAE (ECLIPJ2000)
224+
VAR_NOTES: Reference frames are defined according to IMAP mission SPICE kernels.
225+
VAR_TYPE: metadata
226+
FIELDNAM: HAE latitude
227+
LABLAXIS: Latitude
228+
RECORD_VARYING: RV
229+
FORMAT: F9.3
230+
FILLVAL: -1.0000E+31
231+
UNITS: degrees
232+
VALIDMIN: -90
233+
VALIDMAX: 90

imap_l3_processing/glows/l3e/glows_l3e_ultra_model.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
SPACECRAFT_VELOCITY_Y_VAR_NAME = "spacecraft_velocity_y"
2525
SPACECRAFT_VELOCITY_Z_VAR_NAME = "spacecraft_velocity_z"
2626
ELONGATION_EXCLUDED_VAR_NAME = "elongation_excluded"
27+
PIXEL_LATITUDE_VAR_NAME = "pixel_latitude"
28+
PIXEL_LONGITUDE_VAR_NAME = "pixel_longitude"
2729

2830

2931
@dataclass
@@ -42,6 +44,8 @@ class GlowsL3EUltraData(DataProduct):
4244
spacecraft_velocity_y: np.ndarray
4345
spacecraft_velocity_z: np.ndarray
4446
elongation_excluded: np.ndarray
47+
pixel_latitude: np.ndarray
48+
pixel_longitude: np.ndarray
4549

4650
@classmethod
4751
def convert_dat_to_glows_l3e_ul_product(cls, input_metadata: InputMetadata, file_path: Path,
@@ -62,11 +66,18 @@ def convert_dat_to_glows_l3e_ul_product(cls, input_metadata: InputMetadata, file
6266

6367
existing_healpix = data_table[:, 0]
6468
probability_of_survival = data_table[:, 3:]
69+
pixel_latitude = data_table[:, 1]
70+
pixel_longitude = data_table[:, 2]
71+
6572

6673
probability_of_survival_to_return = np.full((len(energies), len(healpix_indexes)), np.nan, dtype=float)
74+
pixel_latitude_to_return = np.full(len(healpix_indexes), np.nan, dtype=float)
75+
pixel_longitude_to_return = np.full(len(healpix_indexes), np.nan, dtype=float)
6776

68-
for healpix, prob_sur in zip(existing_healpix, probability_of_survival):
77+
for healpix, prob_sur, pixel_lat, pixel_lon in zip(existing_healpix, probability_of_survival, pixel_latitude, pixel_longitude):
6978
probability_of_survival_to_return[:, int(healpix)] = prob_sur
79+
pixel_latitude_to_return[int(healpix)] = pixel_lat
80+
pixel_longitude_to_return[int(healpix)] = pixel_lon
7081

7182
transposed_prob_sur = np.array([probability_of_survival_to_return])
7283

@@ -86,6 +97,8 @@ def convert_dat_to_glows_l3e_ul_product(cls, input_metadata: InputMetadata, file
8697
spacecraft_velocity_y=np.array([args.spacecraft_velocity_y]),
8798
spacecraft_velocity_z=np.array([args.spacecraft_velocity_z]),
8899
elongation_excluded=np.array([args.elongation]),
100+
pixel_latitude=pixel_latitude_to_return,
101+
pixel_longitude=pixel_longitude_to_return,
89102
)
90103

91104
def to_data_product_variables(self) -> list[DataProductVariable]:
@@ -108,4 +121,6 @@ def to_data_product_variables(self) -> list[DataProductVariable]:
108121
DataProductVariable(SPACECRAFT_VELOCITY_Y_VAR_NAME, self.spacecraft_velocity_y),
109122
DataProductVariable(SPACECRAFT_VELOCITY_Z_VAR_NAME, self.spacecraft_velocity_z),
110123
DataProductVariable(ELONGATION_EXCLUDED_VAR_NAME, self.elongation_excluded),
124+
DataProductVariable(PIXEL_LATITUDE_VAR_NAME, self.pixel_latitude),
125+
DataProductVariable(PIXEL_LONGITUDE_VAR_NAME, self.pixel_longitude),
111126
]

tests/glows/l3e/test_glows_l3e_ultra_model.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ def test_l3e_ultra_model_to_data_product_variables(self):
2727
sentinel.spacecraft_velocity_x,
2828
sentinel.spacecraft_velocity_y,
2929
sentinel.spacecraft_velocity_z,
30-
sentinel.elongation_excluded
30+
sentinel.elongation_excluded,
31+
sentinel.pixel_latitude,
32+
sentinel.pixel_longitude,
3133
)
3234

3335
expected_energy_labels = ['Energy Label 1', 'Energy Label 2', 'Energy Label 3', 'Energy Label 4',
@@ -57,6 +59,8 @@ def test_l3e_ultra_model_to_data_product_variables(self):
5759
DataProductVariable("spacecraft_velocity_y", sentinel.spacecraft_velocity_y),
5860
DataProductVariable("spacecraft_velocity_z", sentinel.spacecraft_velocity_z),
5961
DataProductVariable("elongation_excluded", sentinel.elongation_excluded),
62+
DataProductVariable("pixel_latitude", sentinel.pixel_latitude),
63+
DataProductVariable("pixel_longitude", sentinel.pixel_longitude),
6064
]
6165

6266
self.assertEqual(expected_data_products, data_products)
@@ -70,7 +74,7 @@ def test_convert_dat_to_glows_l3e_ul_product(self):
7074
25.4914514, 33.1831812, 43.1957952, 56.2295915, 73.1961745, 95.2822137, 124.0324417, 161.4576950,
7175
210.1755551, 273.5934261, 356.1468544])
7276

73-
row_1_probability_of_survival = np.array(
77+
row_0_probability_of_survival = np.array(
7478
[0.84827693E+00, 0.86517360E+00, 0.88086645E+00, 0.89551288E+00, 0.90925039E+00, 0.92211605E+00,
7579
0.93428862E+00, 0.94576000E+00, 0.95660359E+00, 0.96660933E+00, 0.97533752E+00, 0.98226689E+00,
7680
0.98714107E+00, 0.99025210E+00, 0.99218849E+00, 0.99346478E+00, 0.99439230E+00, 0.99512632E+00,
@@ -123,7 +127,7 @@ def test_convert_dat_to_glows_l3e_ul_product(self):
123127
np.testing.assert_equal(expected_heal_pix, l3e_ul_product.healpix_index, strict=True)
124128
np.testing.assert_equal(expected_survival_probability_shape, l3e_ul_product.probability_of_survival.shape,
125129
strict=True)
126-
np.testing.assert_equal(l3e_ul_product.probability_of_survival[0].T[0, :], row_1_probability_of_survival,
130+
np.testing.assert_equal(l3e_ul_product.probability_of_survival[0].T[0, :], row_0_probability_of_survival,
127131
strict=True)
128132
np.testing.assert_equal(l3e_ul_product.probability_of_survival[0].T[804, :],
129133
row_804_probability_of_survival, strict=True)
@@ -144,3 +148,10 @@ def test_convert_dat_to_glows_l3e_ul_product(self):
144148
np.testing.assert_equal(np.array([2.3]), l3e_ul_product.spacecraft_velocity_z, strict=True)
145149

146150
np.testing.assert_equal(np.array([30.0]), l3e_ul_product.elongation_excluded, strict=True)
151+
152+
np.testing.assert_equal(87.07582, l3e_ul_product.pixel_latitude[0])
153+
np.testing.assert_equal(45.00000, l3e_ul_product.pixel_longitude[0])
154+
155+
np.testing.assert_equal(np.nan, l3e_ul_product.pixel_latitude[804])
156+
np.testing.assert_equal(np.nan, l3e_ul_product.pixel_longitude[804])
157+

0 commit comments

Comments
 (0)