imap-processing 1.0.2__py3-none-any.whl → 1.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. imap_processing/_version.py +2 -2
  2. imap_processing/cdf/config/imap_codice_global_cdf_attrs.yaml +18 -0
  3. imap_processing/cdf/config/imap_codice_l1a_variable_attrs.yaml +4 -4
  4. imap_processing/cdf/config/imap_hi_variable_attrs.yaml +12 -2
  5. imap_processing/cdf/config/imap_idex_global_cdf_attrs.yaml +1 -8
  6. imap_processing/cdf/config/imap_idex_l1b_variable_attrs.yaml +16 -5
  7. imap_processing/cdf/config/imap_idex_l2a_variable_attrs.yaml +27 -25
  8. imap_processing/cdf/config/imap_idex_l2b_variable_attrs.yaml +16 -16
  9. imap_processing/cdf/config/imap_idex_l2c_variable_attrs.yaml +2 -2
  10. imap_processing/cdf/config/imap_ultra_l1c_variable_attrs.yaml +12 -0
  11. imap_processing/codice/codice_l1b.py +19 -1
  12. imap_processing/codice/codice_l2.py +61 -8
  13. imap_processing/ena_maps/ena_maps.py +2 -1
  14. imap_processing/hi/hi_l1c.py +24 -8
  15. imap_processing/hi/hi_l2.py +10 -0
  16. imap_processing/ialirt/calculate_ingest.py +19 -1
  17. imap_processing/ialirt/constants.py +12 -6
  18. imap_processing/ialirt/generate_coverage.py +3 -0
  19. imap_processing/lo/l1b/lo_l1b.py +12 -2
  20. imap_processing/lo/l1c/lo_l1c.py +3 -3
  21. imap_processing/lo/l2/lo_l2.py +95 -4
  22. imap_processing/ultra/l1c/helio_pset.py +10 -7
  23. imap_processing/ultra/l1c/spacecraft_pset.py +9 -7
  24. imap_processing/ultra/l1c/ultra_l1c_pset_bins.py +5 -8
  25. imap_processing/ultra/utils/ultra_l1_utils.py +6 -0
  26. {imap_processing-1.0.2.dist-info → imap_processing-1.0.3.dist-info}/METADATA +1 -1
  27. {imap_processing-1.0.2.dist-info → imap_processing-1.0.3.dist-info}/RECORD +30 -30
  28. {imap_processing-1.0.2.dist-info → imap_processing-1.0.3.dist-info}/LICENSE +0 -0
  29. {imap_processing-1.0.2.dist-info → imap_processing-1.0.3.dist-info}/WHEEL +0 -0
  30. {imap_processing-1.0.2.dist-info → imap_processing-1.0.3.dist-info}/entry_points.txt +0 -0
@@ -1,3 +1,3 @@
1
1
  # These version placeholders will be replaced later during substitution.
2
- __version__ = "1.0.2"
3
- __version_tuple__ = (1, 0, 2)
2
+ __version__ = "1.0.3"
3
+ __version_tuple__ = (1, 0, 3)
@@ -241,6 +241,24 @@ imap_codice_l2_lo-sw-species:
241
241
  Logical_source: imap_codice_l2_lo-sw-species
242
242
  Logical_source_description: IMAP Mission CoDICE Lo Level-2 Sunward Species Intensity Data.
243
243
 
244
+ imap_codice_l2_lo-nsw-species:
245
+ <<: *instrument_base
246
+ Data_type: L2_lo-nsw-species>Level-2 Lo Non-Sunward Species Intensities Data
247
+ Logical_source: imap_codice_l2_lo-nsw-species
248
+ Logical_source_description: IMAP Mission CoDICE Lo Level-2 Non-Sunward Species Intensity Data.
249
+
250
+ imap_codice_l2_lo-sw-angular:
251
+ <<: *instrument_base
252
+ Data_type: L2_lo-sw-species>Level-2 Lo Sunward Angular Intensities Data
253
+ Logical_source: imap_codice_l2_lo-sw-angular
254
+ Logical_source_description: IMAP Mission CoDICE Lo Level-2 Sunward Angular Intensity Data.
255
+
256
+ imap_codice_l2_lo-nsw-angular:
257
+ <<: *instrument_base
258
+ Data_type: L2_lo-nsw-species>Level-2 Lo Non-Sunward Angular Intensities Data
259
+ Logical_source: imap_codice_l2_lo-nsw-angular
260
+ Logical_source_description: IMAP Mission CoDICE Lo Level-2 Non-Sunward Angular Intensity Data.
261
+
244
262
  imap_codice_l2_hi-omni:
245
263
  <<: *instrument_base
246
264
  Data_type: L2_hi-omni>Level-2 Hi Omnidirectional Species Intensities Data
@@ -297,13 +297,13 @@ direct_events_attrs: &direct_events
297
297
  VALIDMAX: 10000
298
298
 
299
299
  voltage_table:
300
- CATDESC: ElectroStatic Analyzer Energy Values
300
+ CATDESC: ElectroStatic Analyzer Voltage Values
301
301
  DEPEND_1: esa_step
302
- FIELDNAM: Energy Table
302
+ FIELDNAM: Voltage Table
303
303
  FORMAT: F12.6
304
- LABLAXIS: eV
304
+ LABLAXIS: V
305
305
  SCALETYP: log
306
- UNITS: eV
306
+ UNITS: V
307
307
  VALIDMIN: 1.0
308
308
  VALIDMAX: 14100.0
309
309
  VAR_TYPE: support_data
@@ -432,8 +432,18 @@ hi_de_nominal_bin:
432
432
 
433
433
  # Define override values for epoch as defined in imap_constant_attrs.yaml
434
434
  hi_pset_epoch:
435
- CATDESC: Midpoint time of pointing, number of nanoseconds since J2000 with leap seconds included
436
- BIN_LOCATION: 0.5
435
+ CATDESC: Start time of pointing, number of nanoseconds since J2000 with leap seconds included
436
+ DELTA_PLUS_VAR: epoch_delta
437
+ BIN_LOCATION: 0
438
+
439
+ epoch_delta:
440
+ <<: *default_int64
441
+ CATDESC: Number of nanoseconds in spacecraft pointing covered by this pointing set product
442
+ FIELDNAM: epoch delta
443
+ UNITS: ns
444
+ VAR_TYPE: support_data
445
+ DISPLAY_TYPE: no_plot
446
+ TIME_SCALE: Terrestrial Time
437
447
 
438
448
  hi_pset_esa_energy_step:
439
449
  <<: *default_esa_energy_step
@@ -58,16 +58,9 @@ imap_idex_l2b_sci:
58
58
  Logical_source: imap_idex_l2b_sci-1mo
59
59
  Logical_source_description: IMAP Mission IDEX Instrument Level-2B Monthly Data
60
60
 
61
- imap_idex_l2c_sci-healpix:
62
- <<: *instrument_base
63
- Data_level: 2C
64
- Data_type: L2C_HEALPIX-MAP-1MO>Level-2C HEALPIX Map Monthly Data
65
- Logical_source: imap_idex_l2c_healpix-map-1mo
66
- Logical_source_description: IMAP Mission IDEX Instrument Level-2C Monthly Data Healpix
67
-
68
61
  imap_idex_l2c_sci-rectangular:
69
62
  <<: *instrument_base
70
63
  Data_level: 2C
71
64
  Data_type: L2C_RECTANGULAR-MAP-1MO>Level-2C Rectangular Map Monthly Data
72
65
  Logical_source: imap_idex_l2c_rectangular-map-1mo
73
- Logical_source_description: IMAP Mission IDEX Instrument Level-2C Monthly Data Rectangular
66
+ Logical_source_description: IMAP Mission IDEX Instrument Level-2C Rectangular Map Monthly Data
@@ -3,6 +3,8 @@ double_fillval: &double_fillval -1.0E31
3
3
 
4
4
  data_min: &data_min 0
5
5
  data_max: &data_max 4095
6
+ spice_data_min: &spice_data_min -2.0e7
7
+ spice_data_max: &spice_data_max 2.0e7
6
8
 
7
9
  # <=== Base Attributes ===>
8
10
  string_base_attrs: &string_base
@@ -47,7 +49,8 @@ spice_base: &spice_base
47
49
  <<: *l1b_data_base
48
50
  VAR_TYPE: data
49
51
  DISPLAY_TYPE: time_series
50
- UNITS: Degrees
52
+ VALIDMIN: *spice_data_min
53
+ VALIDMAX: *spice_data_max
51
54
 
52
55
  # <=== Instrument Setting Attributes ===>
53
56
  trigger_mode:
@@ -342,7 +345,6 @@ current_neg2p5v_bus:
342
345
  UNITS: A
343
346
 
344
347
  # <=== Spice Data Attributes ===>
345
- # TODO: Get actual validmin and vaildmax for ephemeris attrs
346
348
  ephemeris_position_x:
347
349
  <<: *spice_base
348
350
  FIELDNAM: Position X
@@ -362,7 +364,7 @@ ephemeris_position_y:
362
364
  ephemeris_position_z:
363
365
  <<: *spice_base
364
366
  FIELDNAM: Position Z
365
- CATDESC: Cartesian coordinate Z positions for the IMAP spacecraft in the ECLIPJ2000 frame.
367
+ CATDESC: Cartesian coord Z positions for the IMAP spacecraft in the ECLIPJ2000 frame.
366
368
  LABLAXIS: Position Z
367
369
  UNITS: km
368
370
  DICT_KEY: SPASE>Support>SupportQuantity:Positional
@@ -395,33 +397,42 @@ ephemeris_velocity_z:
395
397
  longitude:
396
398
  <<: *spice_base
397
399
  VALIDMIN: 0
400
+ VALIDMAX: 360
398
401
  FIELDNAM: Longitude
399
402
  CATDESC: Longitude of the dust event as observed from Earth in the ECLIPJ2000 frame.
400
403
  LABLAXIS: Longitude
404
+ UNITS: Degrees
401
405
  DICT_KEY: SPASE>Support>SupportQuantity:Longitude
402
406
 
403
407
  latitude:
404
408
  <<: *spice_base
409
+ VALIDMIN: -90
410
+ VALIDMAX: 90
405
411
  FIELDNAM: Latitude
406
412
  CATDESC: Latitude of the dust event as observed from Earth in the ECLIPJ2000 frame.
407
413
  LABLAXIS: Latitude
414
+ UNITS: Degrees
408
415
  DICT_KEY: SPASE>Support>SupportQuantity:Latitude
409
416
 
410
417
  spin_phase:
411
418
  <<: *spice_base
412
419
  VALIDMIN: 0
420
+ VALIDMAX: 360
413
421
  FIELDNAM: Spin Phase
414
422
  CATDESC: IMAP Spin Phase
415
423
  LABLAXIS: Spin Phase
416
- FORMAT: F12.6
417
- FILLVAL: *double_fillval
424
+ FORMAT: I3
425
+ FILLVAL: *int_fillval
426
+ UNITS: Degrees
418
427
  DICT_KEY: SPASE>Support>SupportQuantity:SpinPhase
419
428
 
420
429
  solar_longitude:
421
430
  <<: *spice_base
431
+ VALIDMIN: -180
422
432
  VALIDMAX: 180
423
433
  FIELDNAM: Solar Longitude
424
434
  CATDESC: Solar Longitude of the IMAP spacecraft
425
435
  LABLAXIS: Solar Longitude
436
+ UNITS: Degrees
426
437
  DICT_KEY: SPASE>Support>SupportQuantity:Longitude
427
438
 
@@ -180,7 +180,7 @@ tof_peak_fit_parameters:
180
180
  LABL_PTR_2: peak_fit_parameter_labels
181
181
  VALIDMIN: 0
182
182
  VALIDMAX: *int_maxval
183
- LABLAXIS: TOF Peak Fit Parameters
183
+ LABLAXIS: TOF Fit Parameters
184
184
  FORMAT: F20.6
185
185
  FILLVAL: *double_fillval
186
186
  DISPLAY_TYPE: no_plot
@@ -205,14 +205,16 @@ tof_peak_area_under_fit:
205
205
  tof_peak_chi_squared:
206
206
  <<: *chi_square_base
207
207
  DEPEND_1: mass_index
208
- LABL_PTR_1: mass_labels
208
+ DISPLAY_TYPE: spectrogram
209
+ LABLAXIS: Chi Square (TOF)
209
210
  CATDESC: Chi squared value for the TOF peak emg fits.
210
- FIELDNAM: Chi Square (TOF peak fits))
211
+ FIELDNAM: Chi Square (TOF peak fits)
211
212
 
212
213
  tof_peak_reduced_chi_squared:
213
214
  <<: *chi_square_base
214
215
  DEPEND_1: mass_index
215
- LABL_PTR_1: mass_labels
216
+ DISPLAY_TYPE: spectrogram
217
+ LABLAXIS: Red Chi Square (TOF)
216
218
  CATDESC: Reduced chi squared value for the TOF peak emg fits.
217
219
  FIELDNAM: Reduced Chi Square (TOF peak fits)
218
220
 
@@ -240,37 +242,37 @@ target_low_fit_parameters:
240
242
 
241
243
  target_low_impact_charge:
242
244
  <<: *impact_charge_base
243
- LABLAXIS: Target Low Impact Charge
244
- CATDESC: Total charge from the dust impact on Target Low channel derived from the fitted curve.
245
+ LABLAXIS: TL Impact Charge
246
+ CATDESC: Total charge from the dust impact on Target Low (TL) channel derived from the fitted curve.
245
247
  FIELDNAM: Target Low Impact Charge
246
248
 
247
249
  target_low_dust_mass_estimate:
248
250
  <<: *mass_estimate_base
249
- LABLAXIS: Target Low Dust Mass Estimate
251
+ LABLAXIS: TL Dust Mass Est
250
252
  CATDESC: Estimated dust mass from Target Low signal based on impact charge.
251
253
  FIELDNAM: Estimated Dust Mass (Target Low)
252
254
 
253
255
  target_low_velocity_estimate:
254
256
  <<: *velocity_estimate_base
255
- LABLAXIS: Target Low Velocity Estimate
257
+ LABLAXIS: TL Velocity Est
256
258
  CATDESC: Estimated particle velocity from Target Low signal based on impact charge.
257
259
  FIELDNAM: Estimated Velocity (Target Low)
258
260
 
259
261
  target_low_chi_squared:
260
262
  <<: *chi_square_base
261
- LABLAXIS: Target Low Chi Square
263
+ LABLAXIS: TL Chi Square
262
264
  CATDESC: Chi squared value for the Target Low signal fit.
263
265
  FIELDNAM: Chi Square (Target Low)
264
266
 
265
267
  target_low_reduced_chi_squared:
266
268
  <<: *chi_square_base
267
- LABLAXIS: Target Low Reduced Chi Square
269
+ LABLAXIS: TL Red Chi Square
268
270
  CATDESC: Reduced chi squared value for the Target Low signal fit.
269
271
  FIELDNAM: Reduced Chi Square (Target Low)
270
272
 
271
273
  target_low_fit_results:
272
274
  <<: *fit_results_base
273
- LABLAXIS: Target Low Fit Results
275
+ LABLAXIS: TL Fit Results
274
276
  CATDESC: Values of Target Low signal fit evaluated at each time point.
275
277
  FIELDNAM: Target Low Fit results
276
278
 
@@ -282,37 +284,37 @@ target_high_fit_parameters:
282
284
 
283
285
  target_high_impact_charge:
284
286
  <<: *impact_charge_base
285
- LABLAXIS: Target High Impact Charge
286
- CATDESC: Charge from the dust impact on Target High derived from the fitted curve.
287
+ LABLAXIS: TH Impact Charge
288
+ CATDESC: Charge from the dust impact on Target High (TH) derived from the fitted curve.
287
289
  FIELDNAM: Target High Impact Charge
288
290
 
289
291
  target_high_dust_mass_estimate:
290
292
  <<: *mass_estimate_base
291
- LABLAXIS: Target High Dust Mass Estimate
293
+ LABLAXIS: TH Dust Mass Est
292
294
  CATDESC: Estimated dust mass from Target High signal based on impact charge.
293
295
  FIELDNAM: Estimated Dust Mass (Target High)
294
296
 
295
297
  target_high_velocity_estimate:
296
298
  <<: *velocity_estimate_base
297
- LABLAXIS: Target High Velocity Estimate
299
+ LABLAXIS: TH Velocity Est
298
300
  CATDESC: Estimated particle velocity from Target High signal based on impact charge.
299
301
  FIELDNAM: Estimated Velocity (Target High)
300
302
 
301
303
  target_high_chi_squared:
302
304
  <<: *chi_square_base
303
- LABLAXIS: Target High Chi Square
305
+ LABLAXIS: TH Chi Square
304
306
  CATDESC: Chi squared value for the Target High signal fit.
305
307
  FIELDNAM: Chi Square (Target High)
306
308
 
307
309
  target_high_reduced_chi_squared:
308
310
  <<: *chi_square_base
309
- LABLAXIS: Target High Reduced Chi Square
311
+ LABLAXIS: TH Red Chi Square
310
312
  CATDESC: Reduced chi squared value for the Target Low signal fit.
311
313
  FIELDNAM: Reduced Chi Square (Target High)
312
314
 
313
315
  target_high_fit_results:
314
316
  <<: *fit_results_base
315
- LABLAXIS: Target High Fit Results
317
+ LABLAXIS: TH Fit Results
316
318
  CATDESC: Values of Target High signal fit evaluated at each time point.
317
319
  FIELDNAM: Target High Fit Results
318
320
 
@@ -324,36 +326,36 @@ ion_grid_fit_parameters:
324
326
 
325
327
  ion_grid_impact_charge:
326
328
  <<: *impact_charge_base
327
- LABLAXIS: Ion Grid Impact Charge
328
- CATDESC: Charge from the dust impact on Ion Grid channel derived from the fitted curve.
329
+ LABLAXIS: IG Impact Charge
330
+ CATDESC: Charge from the dust impact on Ion Grid (IG) channel derived from the fitted curve.
329
331
  FIELDNAM: Ion Grid Impact Charge
330
332
 
331
333
  ion_grid_dust_mass_estimate:
332
334
  <<: *mass_estimate_base
333
- LABLAXIS: Ion Grid Dust Mass Estimate
335
+ LABLAXIS: IG Dust Mass Est
334
336
  CATDESC: Estimated dust mass from Ion Grid signal based on impact charge.
335
337
  FIELDNAM: Estimated Dust Mass (Ion Grid)
336
338
 
337
339
  ion_grid_velocity_estimate:
338
340
  <<: *velocity_estimate_base
339
- LABLAXIS: Ion Grid Velocity Estimate
341
+ LABLAXIS: IG Velocity Est
340
342
  CATDESC: Estimated particle velocity from Ion Grid signal based on impact charge.
341
343
  FIELDNAM: Estimated Velocity (Ion Grid)
342
344
 
343
345
  ion_grid_chi_squared:
344
346
  <<: *chi_square_base
345
- LABLAXIS: Ion Grid Chi Square
347
+ LABLAXIS: IG Chi Square
346
348
  CATDESC: Chi squared value for the Ion Grid signal fit.
347
349
  FIELDNAM: Chi Square (Ion Grid)
348
350
 
349
351
  ion_grid_reduced_chi_squared:
350
352
  <<: *chi_square_base
351
- LABLAXIS: Ion Grid Reduced Chi Square
353
+ LABLAXIS: IG Red Chi Square
352
354
  CATDESC: Reduced chi squared value for the Ion Grid signal fit.
353
355
  FIELDNAM: Reduced Chi Square (Ion Grid)
354
356
 
355
357
  ion_grid_fit_results:
356
358
  <<: *fit_results_base
357
- LABLAXIS: Ion Grid Fit Results
359
+ LABLAXIS: IG Fit Results
358
360
  CATDESC: Values of Ion Grid signal fit evaluated at each time point.
359
361
  FIELDNAM: Ion Grid Fit Results
@@ -4,8 +4,8 @@ double_fillval: &double_fillval -1.0E31
4
4
 
5
5
  # Label attributes
6
6
  mass_labels:
7
- CATDESC: Labels for Mass (kg)
8
- FIELDNAM: Mass (kg)
7
+ CATDESC: Labels for Mass
8
+ FIELDNAM: Mass
9
9
  VAR_TYPE: metadata
10
10
  FORMAT: A8
11
11
  DEPEND_1: mass
@@ -30,23 +30,23 @@ spin_phase_labels:
30
30
  # Index attributes
31
31
  mass:
32
32
  CATDESC: Log-spaced mass
33
- FIELDNAM: Mass (kg)
33
+ FIELDNAM: Mass
34
34
  UNITS: kg
35
35
  FORMAT: E10.4
36
36
  VAR_TYPE: support_data
37
37
  SCALETYP: log
38
- LABLAXIS: Mass (kg)
38
+ LABLAXIS: Mass
39
39
  VALIDMIN: 0.0
40
40
  VALIDMAX: 1.00e-14
41
41
  FILLVAL: *double_fillval
42
42
  LABL_PTR_1: mass_labels
43
- DICT_KEY: SPASE>Support>SupportQuantity:Other
43
+ DICT_KEY: SPASE>Particle>ParticleType:Dust,ParticleQuantity:Mass
44
44
 
45
45
  spin_phase:
46
46
  CATDESC: The spacecraft spin phase at the time of detection
47
47
  VAR_NOTES: This is given in 4 bins [315-45, 45-135, 135-225, 225-315] degrees.
48
- FIELDNAM: Spin Phase (deg)
49
- LABLAXIS: Spin Phase (deg)
48
+ FIELDNAM: Spin Phase
49
+ LABLAXIS: Spin Phase
50
50
  VAR_TYPE: support_data
51
51
  SCALETYP: linear
52
52
  FILLVAL: *int_fillval
@@ -55,12 +55,12 @@ spin_phase:
55
55
  VALIDMAX: 360
56
56
  LABL_PTR_1: spin_phase_labels
57
57
  UNITS: deg
58
- DICT_KEY: SPASE>SupportQuantity:SpinPhase,Qualifier:Array
58
+ DICT_KEY: SPASE>Support>SupportQuantity:SpinPhase,Qualifier:Array
59
59
 
60
60
  impact_charge:
61
61
  CATDESC: Log-spaced impact charge
62
- FIELDNAM: Impact Charge (fC)
63
- LABLAXIS: Impact Charge (fC)
62
+ FIELDNAM: Impact Charge
63
+ LABLAXIS: Impact Charge
64
64
  VAR_TYPE: support_data
65
65
  SCALETYP: log
66
66
  FILLVAL: *int_fillval
@@ -106,18 +106,18 @@ base_mass: &base_mass
106
106
  rate_by_charge:
107
107
  <<: *base_charge
108
108
  CATDESC: Count rate per day by impact charge and spin phase.
109
- FIELDNAM: Rate (day^-1) by Charge
109
+ FIELDNAM: Rate by Charge
110
110
  UNITS: day^-1
111
111
  FILLVAL: *double_fillval
112
- DICT_KEY: SPASE>SupportQuantity:CountRate,Qualifier:Array
112
+ DICT_KEY: SPASE>Particle>ParticleType:Dust,ParticleQuantity:CountRate,Qualifier:Array
113
113
 
114
114
  rate_by_mass:
115
115
  <<: *base_mass
116
116
  CATDESC: Count rate per day by mass and spin phase.
117
- FIELDNAM: Rate (day^-1) by Mass
117
+ FIELDNAM: Rate by Mass
118
118
  UNITS: day^-1
119
119
  FILLVAL: *double_fillval
120
- DICT_KEY: SPASE>SupportQuantity:CountRate,Qualifier:Array
120
+ DICT_KEY: SPASE>Particle>ParticleType:Dust,ParticleQuantity:CountRate,Qualifier:Array
121
121
 
122
122
  counts_by_charge:
123
123
  <<: *base_charge
@@ -147,7 +147,7 @@ impact_day_of_year:
147
147
  VALIDMAX: 366
148
148
  VAR_TYPE: data
149
149
  UNITS: days
150
- DICT_KEY: SPASE>SupportQuantity:Temporal,Qualifier:Array
150
+ DICT_KEY: SPASE>Support>SupportQuantity:Temporal
151
151
 
152
152
  rate_calculation_quality_flags:
153
153
  CATDESC: Quality flag for rate calculation (1 = good, 0 = insufficient IDEX uptime data)
@@ -161,4 +161,4 @@ rate_calculation_quality_flags:
161
161
  VALIDMAX: 1
162
162
  VAR_TYPE: data
163
163
  UNITS: " "
164
- DICT_KEY: SPASE>SupportQuantity:QualityFlag,Qualifier:Array
164
+ DICT_KEY: SPASE>Support>SupportQuantity:QualityFlag
@@ -90,7 +90,7 @@ rectangular_lat_pixel:
90
90
  rate_by_charge_map:
91
91
  <<: *base_charge_map
92
92
  CATDESC: Count rate per day by impact charge, longitude, and latitude.
93
- FIELDNAM: Rate (day^-1) by Charge Map
93
+ FIELDNAM: Rate by Charge Map
94
94
  UNITS: day^-1
95
95
  FILLVAL: *double_fillval
96
96
  DICT_KEY: SPASE>SupportQuantity:CountRate,Qualifier:Array
@@ -114,7 +114,7 @@ counts_by_mass_map:
114
114
  rate_by_mass_map:
115
115
  <<: *base_mass_map
116
116
  CATDESC: Count rate per day by mass, longitude, and latitude.
117
- FIELDNAM: Rate (day^-1) by Mass Map
117
+ FIELDNAM: Rate by Mass Map
118
118
  UNITS: day^-1
119
119
  FILLVAL: *double_fillval
120
120
  DICT_KEY: SPASE>SupportQuantity:CountRate,Qualifier:Array
@@ -172,6 +172,18 @@ shcoarse:
172
172
  # TODO: come back to format
173
173
  UNITS: seconds
174
174
 
175
+ epoch_delta:
176
+ <<: *default
177
+ CATDESC: Number of nanoseconds in spacecraft pointing covered by this pointing set product
178
+ FIELDNAM: epoch delta
179
+ UNITS: ns
180
+ VAR_TYPE: support_data
181
+ DISPLAY_TYPE: no_plot
182
+ TIME_SCALE: Terrestrial Time
183
+ SCALE_TYPE: linear
184
+ FORMAT: I20
185
+ dtype: int64
186
+
175
187
  energy_bin_delta:
176
188
  <<: *default_float32
177
189
  CATDESC: Difference between the energy bin edges.
@@ -47,6 +47,23 @@ def convert_to_rates(dataset: xr.Dataset, descriptor: str) -> np.ndarray:
47
47
  constants, f"{descriptor.upper().replace('-', '_')}_VARIABLE_NAMES"
48
48
  )
49
49
 
50
+ if descriptor.startswith("lo-"):
51
+ # Calculate energy_table using voltage_table and k_factor
52
+ energy_attrs = dataset["voltage_table"].attrs | {
53
+ "UNITS": "keV/e",
54
+ "LABLAXIS": "E/q",
55
+ "CATDESC": "Energy per charge",
56
+ "FIELDNAM": "Energy per charge",
57
+ }
58
+ # 1e3 is to convert eV to keV
59
+ dataset["energy_table"] = xr.DataArray(
60
+ dataset["voltage_table"].values * dataset["k_factor"].values * 1e-3,
61
+ dims=[
62
+ "esa_step",
63
+ ],
64
+ attrs=energy_attrs,
65
+ )
66
+
50
67
  if descriptor in [
51
68
  "lo-counters-aggregated",
52
69
  "lo-counters-singles",
@@ -69,6 +86,8 @@ def convert_to_rates(dataset: xr.Dataset, descriptor: str) -> np.ndarray:
69
86
  "sw_bias_gain_mode",
70
87
  "st_bias_gain_mode",
71
88
  "spin_period",
89
+ "voltage_table",
90
+ "acquisition_time_per_step",
72
91
  ]
73
92
  dataset = dataset.drop_vars(drop_variables)
74
93
  elif descriptor in [
@@ -86,7 +105,6 @@ def convert_to_rates(dataset: xr.Dataset, descriptor: str) -> np.ndarray:
86
105
 
87
106
  # Denominator to convert counts to rates
88
107
  denominator = dataset.acquisition_time_per_step * n_sector
89
-
90
108
  # Do not carry these variable attributes from L1a to L1b for above products
91
109
  drop_variables = [
92
110
  "k_factor",
@@ -31,8 +31,9 @@ from imap_processing.codice.constants import (
31
31
  LO_POSITION_TO_ELEVATION_ANGLE,
32
32
  LO_SW_ANGULAR_VARIABLE_NAMES,
33
33
  LO_SW_PICKUP_ION_SPECIES_VARIABLE_NAMES,
34
- LO_SW_SPECIES_VARIABLE_NAMES,
34
+ LO_SW_SOLAR_WIND_SPECIES_VARIABLE_NAMES,
35
35
  NSW_POSITIONS,
36
+ PIXEL_ORIENTATIONS,
36
37
  PUI_POSITIONS,
37
38
  SOLAR_WIND_POSITIONS,
38
39
  SW_POSITIONS,
@@ -354,11 +355,14 @@ def process_lo_angular_intensity(
354
355
  positions,
355
356
  average_across_positions=False,
356
357
  )
358
+
357
359
  # transform positions to elevation angles
358
360
  if positions == SW_POSITIONS:
359
361
  pos_to_el = LO_POSITION_TO_ELEVATION_ANGLE["sw"]
362
+ position_index_to_adjust = 0
360
363
  elif positions == NSW_POSITIONS:
361
364
  pos_to_el = LO_POSITION_TO_ELEVATION_ANGLE["nsw"]
365
+ position_index_to_adjust = 9
362
366
  else:
363
367
  raise ValueError("Unknown positions for elevation angle mapping.")
364
368
 
@@ -369,6 +373,8 @@ def process_lo_angular_intensity(
369
373
  [pos_to_el[pos] for pos in dataset["inst_az"].data],
370
374
  )
371
375
  )
376
+ # add uncertainties to species list
377
+ species_list = species_list + [f"unc_{var}" for var in species_list]
372
378
  # Take the mean across elevation angles and restore the original dimension order
373
379
  dataset_converted = (
374
380
  dataset[species_list]
@@ -383,8 +389,41 @@ def process_lo_angular_intensity(
383
389
  dataset = dataset.assign_coords(
384
390
  spin_angle=("spin_sector", dataset["spin_sector"].data * 15.0 + 7.5)
385
391
  )
386
-
387
392
  dataset = dataset.drop_vars(species_list).merge(dataset_converted)
393
+ # Positions 0 and 10 only observe half of the 24 spins for each esa step.
394
+ # To account for this, we replicate the counts observed in position 0 and 10 for
395
+ # each esa step to either spin angles 0-11 or 12-23, depending on the pixel
396
+ # orientation (A/B). See section 11.2.2 of the CoDICE algorithm document
397
+ a_inds = np.array(
398
+ [pos for pos, orientation in PIXEL_ORIENTATIONS.items() if orientation == "A"]
399
+ )
400
+ b_inds = np.array(
401
+ [pos for pos, orientation in PIXEL_ORIENTATIONS.items() if orientation == "B"]
402
+ )
403
+
404
+ position_index = position_index_to_adjust
405
+ for species in species_list:
406
+ # Determine the correct spin indices based on the position
407
+ spin_sectors = dataset["spin_sector"].data
408
+ spin_inds_1 = np.where(spin_sectors >= 12)[0]
409
+ spin_inds_2 = np.where(spin_sectors < 12)[0]
410
+ # if position_index is 9, swap the spin indices
411
+ if position_index == 9:
412
+ spin_inds_1, spin_inds_2 = spin_inds_2, spin_inds_1
413
+
414
+ # Assign the values to the correct positions and spin sectors
415
+ dataset[species].values[
416
+ :, a_inds[:, np.newaxis], spin_inds_1, position_index
417
+ ] = dataset[species].values[
418
+ :, a_inds[:, np.newaxis], spin_inds_2, position_index
419
+ ]
420
+
421
+ dataset[species].values[
422
+ :, b_inds[:, np.newaxis], spin_inds_2, position_index
423
+ ] = dataset[species].values[
424
+ :, b_inds[:, np.newaxis], spin_inds_1, position_index
425
+ ]
426
+
388
427
  return dataset
389
428
 
390
429
 
@@ -777,7 +816,6 @@ def process_codice_l2(
777
816
  # This should get science files since ancillary or spice doesn't have data_type
778
817
  # as data level.
779
818
  file_path = dependencies.get_file_paths(descriptor=descriptor)[0]
780
-
781
819
  # Now form product name from descriptor
782
820
  descriptor = ScienceFilePath(file_path).descriptor
783
821
  dataset_name = f"imap_codice_l2_{descriptor}"
@@ -790,6 +828,9 @@ def process_codice_l2(
790
828
  "imap_codice_l2_lo-nsw-angular",
791
829
  "imap_codice_l2_lo-sw-angular",
792
830
  ]:
831
+ cdf_attrs = ImapCdfAttributes()
832
+ cdf_attrs.add_instrument_global_attrs("codice")
833
+
793
834
  l2_dataset = load_cdf(file_path).copy()
794
835
 
795
836
  geometric_factor_lookup = get_geometric_factor_lut(dependencies)
@@ -797,12 +838,13 @@ def process_codice_l2(
797
838
  geometric_factors = compute_geometric_factors(
798
839
  l2_dataset, geometric_factor_lookup
799
840
  )
841
+
800
842
  if dataset_name == "imap_codice_l2_lo-sw-species":
801
843
  # Filter the efficiency lookup table for solar wind efficiencies
802
844
  efficiencies = efficiency_lookup[efficiency_lookup["product"] == "sw"]
803
845
  # Calculate the pickup ion sunward solar wind intensities using equation
804
846
  # described in section 11.2.3 of algorithm document.
805
- process_lo_species_intensity(
847
+ l2_dataset = process_lo_species_intensity(
806
848
  l2_dataset,
807
849
  LO_SW_PICKUP_ION_SPECIES_VARIABLE_NAMES,
808
850
  geometric_factors,
@@ -811,25 +853,31 @@ def process_codice_l2(
811
853
  )
812
854
  # Calculate the sunward solar wind species intensities using equation
813
855
  # described in section 11.2.3 of algorithm document.
814
- process_lo_species_intensity(
856
+ l2_dataset = process_lo_species_intensity(
815
857
  l2_dataset,
816
- LO_SW_SPECIES_VARIABLE_NAMES,
858
+ LO_SW_SOLAR_WIND_SPECIES_VARIABLE_NAMES,
817
859
  geometric_factors,
818
860
  efficiencies,
819
861
  SOLAR_WIND_POSITIONS,
820
862
  )
863
+ l2_dataset.attrs.update(
864
+ cdf_attrs.get_global_attributes("imap_codice_l2_lo-sw-species")
865
+ )
821
866
  elif dataset_name == "imap_codice_l2_lo-nsw-species":
822
867
  # Filter the efficiency lookup table for non-solar wind efficiencies
823
868
  efficiencies = efficiency_lookup[efficiency_lookup["product"] == "nsw"]
824
869
  # Calculate the non-sunward species intensities using equation
825
870
  # described in section 11.2.3 of algorithm document.
826
- process_lo_species_intensity(
871
+ l2_dataset = process_lo_species_intensity(
827
872
  l2_dataset,
828
873
  LO_NSW_SPECIES_VARIABLE_NAMES,
829
874
  geometric_factors,
830
875
  efficiencies,
831
876
  NSW_POSITIONS,
832
877
  )
878
+ l2_dataset.attrs.update(
879
+ cdf_attrs.get_global_attributes("imap_codice_l2_lo-nsw-species")
880
+ )
833
881
  elif dataset_name == "imap_codice_l2_lo-sw-angular":
834
882
  efficiencies = efficiency_lookup[efficiency_lookup["product"] == "sw"]
835
883
  # Calculate the sunward solar wind angular intensities using equation
@@ -841,6 +889,9 @@ def process_codice_l2(
841
889
  efficiencies,
842
890
  SW_POSITIONS,
843
891
  )
892
+ l2_dataset.attrs.update(
893
+ cdf_attrs.get_global_attributes("imap_codice_l2_lo-sw-angular")
894
+ )
844
895
  if dataset_name == "imap_codice_l2_lo-nsw-angular":
845
896
  # Calculate the non sunward angular intensities
846
897
  efficiencies = efficiency_lookup[efficiency_lookup["product"] == "nsw"]
@@ -851,7 +902,9 @@ def process_codice_l2(
851
902
  efficiencies,
852
903
  NSW_POSITIONS,
853
904
  )
854
-
905
+ l2_dataset.attrs.update(
906
+ cdf_attrs.get_global_attributes("imap_codice_l2_lo-nsw-angular")
907
+ )
855
908
  if dataset_name in [
856
909
  "imap_codice_l2_hi-counters-singles",
857
910
  "imap_codice_l2_hi-counters-aggregated",