Skip to content

Commit 2c2c023

Browse files
HIT L2 - add algorithm for sectored intensity (IMAP-Science-Operations-Center#1619)
* Add some constants needed for the L2 sectored intensities dataset * Small updates to L2 and L1B global attributes * Add function to process sectored rates and create a dataset with sectored intensities. Update functions that calculate intensities to apply vectorization for optimized operations. Fix bug where a call to calculate intensities for the standard intensity dataset was not being returned to a variable to save the results * Update hit_l2 function to call sector intensity processing code * Add constants for valid data variables to process depending on the product * Add test for new function processing sectored rates into intensities dataset * Add to test docstring * Fix test to not pass in version number to hit_l2() since this was removed in another PR * Add ancillary file for sectored data * Add dtype to counts data to ensure dynamic threshold state is an integer all the way through L2 * Address PR comments to add a declination constant and rename seconds variable * Address PR comment and remove setting var to string since it's definied as a string already * Update some assertions to use np.testing assertions for better error messaging * Address PR comments - refactor handling of ancillary data and intensity calculation to improve readability and performance replacing the named tuple with a dataset for storing intensity factors * Add tests for new functions from refactoring the L2 processing code * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update comment for clarity --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 26953a3 commit 2c2c023

6 files changed

Lines changed: 682 additions & 233 deletions

File tree

imap_processing/cdf/config/imap_hit_global_cdf_attrs.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ imap_hit_l1b_hk:
3838

3939
imap_hit_l1b_standard-rates:
4040
<<: *instrument_base
41-
Data_type: L1B_rates>Level-1B Standard Rates
41+
Data_type: L1B_standard-rates>Level-1B Standard Rates
4242
Logical_source: imap_hit_l1b_standard-rates
4343
Logical_source_description: IMAP Mission HIT Instrument Level-1B Standard Rates Data.
4444

@@ -58,19 +58,19 @@ imap_hit_l1b_sectored-rates:
5858

5959
imap_hit_l2_standard-intensity:
6060
<<: *instrument_base
61-
Data_type: L2_rates>Level-2 Standard Intensity
61+
Data_type: L2_standard-intensity>Level-2 Standard Intensity
6262
Logical_source: imap_hit_l2_standard-intensity
6363
Logical_source_description: IMAP Mission HIT Instrument Level-2 Standard Intensity Data.
6464

6565
imap_hit_l2_summed-intensity:
6666
<<: *instrument_base
67-
Data_type: L2_summed-rates>Level-2 Summed Intensity
67+
Data_type: L2_summed-intensity>Level-2 Summed Intensity
6868
Logical_source: imap_hit_l2_summed-intensity
6969
Logical_source_description: IMAP Mission HIT Instrument Level-2 Summed Intensity Data.
7070

71-
imap_hit_l2_sectored-intensity:
71+
imap_hit_l2_macropixel-intensity:
7272
<<: *instrument_base
73-
Data_type: L2_sectored-rates>Level-2 Macro Pixel Intensity
73+
Data_type: L2_macro-pixel-intensity>Level-2 Macro Pixel Intensity
7474
Logical_source: imap_hit_l2_macropixel-intensity
7575
Logical_source_description: IMAP Mission HIT Instrument Level-2 Macro Pixel Intensity Data.
7676

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
Species, Sector, Lower Energy (MeV), Upper Energy (MeV), Delta E (MeV), Geometry Factor (cm2 sr), Efficiency, b
2+
H ,0,1.8,4,2.2,0.41686,1,0
3+
H ,1,1.8,4,2.2,0.49253,1,0
4+
H ,2,1.8,4,2.2,0.45156,1,0
5+
H ,3,1.8,4,2.2,0.35599,1,0
6+
H ,4,1.8,4,2.2,0.33312,1,0
7+
H ,5,1.8,4,2.2,0.47444,1,0
8+
H ,6,1.8,4,2.2,0.49253,1,0
9+
H ,7,1.8,4,2.2,0.41686,1,0
10+
H ,0,4,6,2,0.42008,1,0
11+
H ,1,4,6,2,0.49746,1,0
12+
H ,2,4,6,2,0.45515,1,0
13+
H ,3,4,6,2,0.35921,1,0
14+
H ,4,4,6,2,0.33619,1,0
15+
H ,5,4,6,2,0.47817,1,0
16+
H ,6,4,6,2,0.49746,1,0
17+
H ,7,4,6,2,0.42008,1,0
18+
H ,0,6,10,4,0.39177,1,0
19+
H ,1,6,10,4,0.47095,1,0
20+
H ,2,6,10,4,0.42764,1,0
21+
H ,3,6,10,4,0.33171,1,0
22+
H ,4,6,10,4,0.31091,1,0
23+
H ,5,6,10,4,0.44844,1,0
24+
H ,6,6,10,4,0.47095,1,0
25+
H ,7,6,10,4,0.39177,1,0
26+
He4 ,0,4,6,2,0.41995,1,0
27+
He4 ,1,4,6,2,0.49964,1,0
28+
He4 ,2,4,6,2,0.45649,1,0
29+
He4 ,3,4,6,2,0.3584,1,0
30+
He4 ,4,4,6,2,0.33563,1,0
31+
He4 ,5,4,6,2,0.47925,1,0
32+
He4 ,6,4,6,2,0.49964,1,0
33+
He4 ,7,4,6,2,0.41995,1,0
34+
He4 ,0,6,12,6,0.42404,1,0
35+
He4 ,1,6,12,6,0.5045,1,0
36+
He4 ,2,6,12,6,0.45897,1,0
37+
He4 ,3,6,12,6,0.36098,1,0
38+
He4 ,4,6,12,6,0.33793,1,0
39+
He4 ,5,6,12,6,0.48202,1,0
40+
He4 ,6,6,12,6,0.5045,1,0
41+
He4 ,7,6,12,6,0.42404,1,0
42+
CNO ,0,4,6,2,0.41976,1,0
43+
CNO ,1,4,6,2,0.49594,1,0
44+
CNO ,2,4,6,2,0.45356,1,0
45+
CNO ,3,4,6,2,0.35698,1,0
46+
CNO ,4,4,6,2,0.33409,1,0
47+
CNO ,5,4,6,2,0.47645,1,0
48+
CNO ,6,4,6,2,0.49594,1,0
49+
CNO ,7,4,6,2,0.41976,1,0
50+
CNO ,0,6,12,6,0.42026,1,0
51+
CNO ,1,6,12,6,0.49871,1,0
52+
CNO ,2,6,12,6,0.45567,1,0
53+
CNO ,3,6,12,6,0.35809,1,0
54+
CNO ,4,6,12,6,0.3351,1,0
55+
CNO ,5,6,12,6,0.47866,1,0
56+
CNO ,6,6,12,6,0.49871,1,0
57+
CNO ,7,6,12,6,0.42026,1,0
58+
NeMgSi ,0,4,6,2,0.37544,1,0
59+
NeMgSi ,1,4,6,2,0.43535,1,0
60+
NeMgSi ,2,4,6,2,0.40251,1,0
61+
NeMgSi ,3,4,6,2,0.32308,1,0
62+
NeMgSi ,4,4,6,2,0.30221,1,0
63+
NeMgSi ,5,4,6,2,0.42339,1,0
64+
NeMgSi ,6,4,6,2,0.43535,1,0
65+
NeMgSi ,7,4,6,2,0.37544,1,0
66+
NeMgSi ,0,6,12,6,0.42046,1,0
67+
NeMgSi ,1,6,12,6,0.49714,1,0
68+
NeMgSi ,2,6,12,6,0.45432,1,0
69+
NeMgSi ,3,6,12,6,0.35764,1,0
70+
NeMgSi ,4,6,12,6,0.33475,1,0
71+
NeMgSi ,5,6,12,6,0.47721,1,0
72+
NeMgSi ,6,6,12,6,0.49714,1,0
73+
NeMgSi ,7,6,12,6,0.42046,1,0
74+
Fe ,0,4,12,8,0.2752,1,0
75+
Fe ,1,4,12,8,0.31996,1,0
76+
Fe ,2,4,12,8,0.29577,1,0
77+
Fe ,3,4,12,8,0.23669,1,0
78+
Fe ,4,4,12,8,0.2213,1,0
79+
Fe ,5,4,12,8,0.31118,1,0
80+
Fe ,6,4,12,8,0.31996,1,0
81+
Fe ,7,4,12,8,0.2752,1,0

imap_processing/hit/l0/decom_hit.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ def parse_count_rates(sci_dataset: xr.Dataset) -> None:
113113
else:
114114
dims = ["epoch"]
115115

116-
sci_dataset[field] = xr.DataArray(parsed_data, dims=dims, name=field)
116+
sci_dataset[field] = xr.DataArray(
117+
np.array(parsed_data, dtype=np.int64), dims=dims, name=field
118+
)
117119
# Add dimensions to coordinates
118120
for dim in dims:
119121
if dim not in sci_dataset.coords:

imap_processing/hit/l2/constants.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,43 @@
88
L2_SUMMED_ANCILLARY_PATH_PREFIX = (
99
imap_module_directory / "hit/ancillary/imap_hit_l1b-to-l2-summed-dt"
1010
)
11+
L2_SECTORED_ANCILLARY_PATH_PREFIX = (
12+
imap_module_directory / "hit/ancillary/imap_hit_l1b-to-l2-sector-dt"
13+
)
14+
15+
# Constants for HIT L2 intensity calculation
16+
SECONDS_PER_MIN = 60 # seconds per minute
17+
SECONDS_PER_10_MIN = 600 # seconds per 10 minutes
18+
19+
# Fill values for missing data
20+
FILLVAL_FLOAT32 = -1.00e31
21+
22+
# Number of azimuth angles
23+
N_AZIMUTH = 15
24+
25+
# Valid species for HIT L2 standard and summed intensity products
26+
VALID_SPECIES = [
27+
"h",
28+
"he3",
29+
"he4",
30+
"he",
31+
"c",
32+
"n",
33+
"o",
34+
"ne",
35+
"na",
36+
"mg",
37+
"al",
38+
"si",
39+
"s",
40+
"ar",
41+
"ca",
42+
"fe",
43+
"ni",
44+
]
45+
46+
# Valid species for HIT L2 sectored intensity product
47+
VALID_SECTORED_SPECIES = ["h", "he4", "cno", "nemgsi", "fe"]
1148

1249
# Particle energy range mapping for HIT L2 standard intensity product.
1350
# The standard intensity calculation requires the L1B foreground rates to

0 commit comments

Comments
 (0)