imap-processing 1.0.1__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 (58) 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 +101 -258
  4. imap_processing/cdf/config/imap_enamaps_l2-common_variable_attrs.yaml +1 -1
  5. imap_processing/cdf/config/imap_hi_variable_attrs.yaml +12 -2
  6. imap_processing/cdf/config/imap_idex_global_cdf_attrs.yaml +1 -8
  7. imap_processing/cdf/config/imap_idex_l1b_variable_attrs.yaml +16 -5
  8. imap_processing/cdf/config/imap_idex_l2a_variable_attrs.yaml +27 -25
  9. imap_processing/cdf/config/imap_idex_l2b_variable_attrs.yaml +16 -16
  10. imap_processing/cdf/config/imap_idex_l2c_variable_attrs.yaml +2 -2
  11. imap_processing/cdf/config/imap_swapi_variable_attrs.yaml +2 -13
  12. imap_processing/cdf/config/imap_ultra_l1c_variable_attrs.yaml +12 -0
  13. imap_processing/cdf/utils.py +2 -2
  14. imap_processing/cli.py +4 -16
  15. imap_processing/codice/codice_l1a_lo_angular.py +362 -0
  16. imap_processing/codice/codice_l1a_lo_species.py +282 -0
  17. imap_processing/codice/codice_l1b.py +80 -97
  18. imap_processing/codice/codice_l2.py +270 -103
  19. imap_processing/codice/codice_new_l1a.py +64 -0
  20. imap_processing/codice/constants.py +37 -2
  21. imap_processing/codice/utils.py +270 -0
  22. imap_processing/ena_maps/ena_maps.py +51 -39
  23. imap_processing/ena_maps/utils/corrections.py +196 -14
  24. imap_processing/ena_maps/utils/naming.py +3 -1
  25. imap_processing/hi/hi_l1c.py +57 -19
  26. imap_processing/hi/hi_l2.py +89 -36
  27. imap_processing/ialirt/calculate_ingest.py +19 -1
  28. imap_processing/ialirt/constants.py +12 -6
  29. imap_processing/ialirt/generate_coverage.py +6 -1
  30. imap_processing/ialirt/l0/parse_mag.py +1 -0
  31. imap_processing/ialirt/l0/process_hit.py +1 -0
  32. imap_processing/ialirt/l0/process_swapi.py +1 -0
  33. imap_processing/ialirt/l0/process_swe.py +2 -0
  34. imap_processing/ialirt/process_ephemeris.py +6 -2
  35. imap_processing/ialirt/utils/create_xarray.py +3 -2
  36. imap_processing/lo/l1b/lo_l1b.py +12 -2
  37. imap_processing/lo/l1c/lo_l1c.py +4 -4
  38. imap_processing/lo/l2/lo_l2.py +101 -8
  39. imap_processing/quality_flags.py +1 -0
  40. imap_processing/swapi/constants.py +4 -0
  41. imap_processing/swapi/l1/swapi_l1.py +47 -20
  42. imap_processing/swapi/l2/swapi_l2.py +17 -3
  43. imap_processing/ultra/l1a/ultra_l1a.py +121 -72
  44. imap_processing/ultra/l1b/de.py +57 -1
  45. imap_processing/ultra/l1b/ultra_l1b_annotated.py +0 -1
  46. imap_processing/ultra/l1b/ultra_l1b_extended.py +24 -11
  47. imap_processing/ultra/l1c/helio_pset.py +34 -8
  48. imap_processing/ultra/l1c/l1c_lookup_utils.py +4 -2
  49. imap_processing/ultra/l1c/spacecraft_pset.py +13 -7
  50. imap_processing/ultra/l1c/ultra_l1c.py +6 -6
  51. imap_processing/ultra/l1c/ultra_l1c_pset_bins.py +79 -20
  52. imap_processing/ultra/l2/ultra_l2.py +2 -2
  53. imap_processing/ultra/utils/ultra_l1_utils.py +6 -0
  54. {imap_processing-1.0.1.dist-info → imap_processing-1.0.3.dist-info}/METADATA +1 -1
  55. {imap_processing-1.0.1.dist-info → imap_processing-1.0.3.dist-info}/RECORD +58 -54
  56. {imap_processing-1.0.1.dist-info → imap_processing-1.0.3.dist-info}/LICENSE +0 -0
  57. {imap_processing-1.0.1.dist-info → imap_processing-1.0.3.dist-info}/WHEEL +0 -0
  58. {imap_processing-1.0.1.dist-info → imap_processing-1.0.3.dist-info}/entry_points.txt +0 -0
@@ -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
@@ -129,22 +129,11 @@ metadata_default: &metadata_default
129
129
  DICT_KEY: SPASE>Support>SupportQuantity:Other
130
130
 
131
131
  sci_start_time:
132
- CATDESC: Start time of sweep
132
+ CATDESC: Start time of sweep in UTC
133
133
  DEPEND_0: epoch
134
134
  FIELDNAM: Science Start time
135
- LABLAXIS: sci_start_time
136
- FILLVAL: -9223372036854775808
137
- FORMAT: " " # Supposedly not required, fails in xarray_to_cdf
138
- VALIDMIN: -9223372036854775808
139
- VALIDMAX: 9223372036854775807
140
- UNITS: ns
135
+ FORMAT: " "
141
136
  VAR_TYPE: support_data
142
- SCALETYP: linear
143
- MONOTON: INCREASE
144
- TIME_BASE: J2000
145
- TIME_SCALE: Terrestrial Time
146
- REFERENCE_POSITION: Rotating Earth Geoid
147
- RESOLUTION: ' '
148
137
  DICT_KEY: "SPASE>Support>SupportQantity:Temporal"
149
138
 
150
139
  # Minimum attrs setting for HK data
@@ -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.
@@ -29,7 +29,7 @@ def load_cdf(
29
29
 
30
30
  Parameters
31
31
  ----------
32
- file_path : Path or ImapFilePath or str
32
+ file_path : pathlib.Path or ImapFilePath or str
33
33
  The path to the CDF file or ImapFilePath object.
34
34
  remove_xarray_attrs : bool
35
35
  Whether to remove the xarray attributes that get injected by the
@@ -98,7 +98,7 @@ def write_cdf(
98
98
 
99
99
  Returns
100
100
  -------
101
- file_path : Path
101
+ file_path : pathlib.Path
102
102
  Path to the file created.
103
103
  """
104
104
  # Create the filename from the global attributes
imap_processing/cli.py CHANGED
@@ -49,7 +49,7 @@ from imap_processing.cdf.utils import load_cdf, write_cdf
49
49
  # from imap_processing import cdf
50
50
  # In code:
51
51
  # call cdf.utils.write_cdf
52
- from imap_processing.codice import codice_l1a, codice_l1b, codice_l2
52
+ from imap_processing.codice import codice_l1b, codice_l2, codice_new_l1a
53
53
  from imap_processing.glows.l1a.glows_l1a import glows_l1a
54
54
  from imap_processing.glows.l1b.glows_l1b import glows_l1b, glows_l1b_de
55
55
  from imap_processing.glows.l2.glows_l2 import glows_l2
@@ -612,14 +612,8 @@ class Codice(ProcessInstrument):
612
612
  datasets: list[xr.Dataset] = []
613
613
 
614
614
  if self.data_level == "l1a":
615
- science_files = dependencies.get_file_paths(source="codice")
616
- if len(science_files) != 1:
617
- raise ValueError(
618
- f"CoDICE L1A requires exactly one input science file, received: "
619
- f"{science_files}."
620
- )
621
615
  # process data
622
- datasets = codice_l1a.process_codice_l1a(science_files[0])
616
+ datasets = codice_new_l1a.process_l1a(dependencies)
623
617
 
624
618
  if self.data_level == "l1b":
625
619
  science_files = dependencies.get_file_paths(source="codice")
@@ -1435,7 +1429,7 @@ class Ultra(ProcessInstrument):
1435
1429
  f"Unexpected science_files found for ULTRA L1A:"
1436
1430
  f"{science_files}. Expected only one dependency."
1437
1431
  )
1438
- datasets = ultra_l1a.ultra_l1a(science_files[0])
1432
+ datasets = ultra_l1a.ultra_l1a(science_files[0], create_derived_l1b=True)
1439
1433
  elif self.data_level == "l1b":
1440
1434
  science_files = dependencies.get_file_paths(source="ultra", data_type="l1a")
1441
1435
  l1a_dict = {
@@ -1472,13 +1466,7 @@ class Ultra(ProcessInstrument):
1472
1466
  ancillary_files = {}
1473
1467
  for path in anc_paths:
1474
1468
  ancillary_files[path.stem.split("_")[2]] = path
1475
- spice_paths = dependencies.get_file_paths(data_type="spice")
1476
- # Only the helio pset needs IMAP frames
1477
- if any("imap_frames" in path.as_posix() for path in spice_paths):
1478
- imap_frames = True
1479
- else:
1480
- imap_frames = False
1481
- datasets = ultra_l1c.ultra_l1c(combined, ancillary_files, imap_frames)
1469
+ datasets = ultra_l1c.ultra_l1c(combined, ancillary_files, self.descriptor)
1482
1470
  elif self.data_level == "l2":
1483
1471
  all_pset_filepaths = dependencies.get_file_paths(
1484
1472
  source="ultra", descriptor="pset"