imap-processing 0.9.0__py3-none-any.whl → 0.11.0__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.
Potentially problematic release.
This version of imap-processing might be problematic. Click here for more details.
- imap_processing/_version.py +2 -2
- imap_processing/cdf/config/imap_codice_l1a_variable_attrs.yaml +749 -442
- imap_processing/cdf/config/imap_glows_global_cdf_attrs.yaml +7 -0
- imap_processing/cdf/config/imap_glows_l1a_variable_attrs.yaml +8 -2
- imap_processing/cdf/config/imap_glows_l1b_variable_attrs.yaml +0 -1
- imap_processing/cdf/config/imap_glows_l2_variable_attrs.yaml +358 -0
- imap_processing/cdf/config/imap_hi_variable_attrs.yaml +59 -25
- imap_processing/cdf/config/imap_hit_global_cdf_attrs.yaml +22 -0
- imap_processing/cdf/config/imap_idex_l1a_variable_attrs.yaml +32 -8
- imap_processing/cdf/config/imap_idex_l1b_variable_attrs.yaml +94 -5
- imap_processing/cdf/config/imap_lo_l1a_variable_attrs.yaml +65 -37
- imap_processing/cdf/config/imap_swapi_variable_attrs.yaml +16 -1
- imap_processing/cdf/config/imap_swe_global_cdf_attrs.yaml +7 -0
- imap_processing/cdf/config/imap_swe_l1a_variable_attrs.yaml +14 -14
- imap_processing/cdf/config/imap_swe_l1b_variable_attrs.yaml +25 -24
- imap_processing/cdf/config/imap_swe_l2_variable_attrs.yaml +238 -0
- imap_processing/cdf/config/imap_ultra_l1b_variable_attrs.yaml +100 -92
- imap_processing/cdf/utils.py +2 -2
- imap_processing/cli.py +45 -9
- imap_processing/codice/codice_l1a.py +104 -58
- imap_processing/codice/constants.py +111 -155
- imap_processing/codice/data/esa_sweep_values.csv +256 -256
- imap_processing/codice/data/lo_stepping_values.csv +128 -128
- imap_processing/ena_maps/ena_maps.py +519 -0
- imap_processing/ena_maps/utils/map_utils.py +145 -0
- imap_processing/ena_maps/utils/spatial_utils.py +226 -0
- imap_processing/glows/__init__.py +3 -0
- imap_processing/glows/ancillary/imap_glows_pipeline_settings_v001.json +52 -0
- imap_processing/glows/l1a/glows_l1a.py +72 -14
- imap_processing/glows/l1b/glows_l1b.py +2 -1
- imap_processing/glows/l1b/glows_l1b_data.py +25 -1
- imap_processing/glows/l2/glows_l2.py +324 -0
- imap_processing/glows/l2/glows_l2_data.py +156 -51
- imap_processing/hi/l1a/science_direct_event.py +57 -51
- imap_processing/hi/l1b/hi_l1b.py +43 -28
- imap_processing/hi/l1c/hi_l1c.py +225 -42
- imap_processing/hi/utils.py +20 -3
- imap_processing/hit/l0/constants.py +2 -2
- imap_processing/hit/l0/decom_hit.py +1 -1
- imap_processing/hit/l1a/hit_l1a.py +94 -13
- imap_processing/hit/l1b/hit_l1b.py +158 -9
- imap_processing/ialirt/l0/process_codicehi.py +156 -0
- imap_processing/ialirt/l0/process_codicelo.py +5 -2
- imap_processing/ialirt/packet_definitions/ialirt.xml +28 -20
- imap_processing/ialirt/packet_definitions/ialirt_codicehi.xml +241 -0
- imap_processing/ialirt/packet_definitions/ialirt_swapi.xml +170 -0
- imap_processing/ialirt/packet_definitions/ialirt_swe.xml +258 -0
- imap_processing/ialirt/process_ephemeris.py +72 -40
- imap_processing/idex/decode.py +241 -0
- imap_processing/idex/idex_l1a.py +143 -81
- imap_processing/idex/idex_l1b.py +244 -10
- imap_processing/lo/l0/lo_science.py +61 -0
- imap_processing/lo/l1a/lo_l1a.py +98 -10
- imap_processing/lo/l1b/lo_l1b.py +2 -2
- imap_processing/lo/l1c/lo_l1c.py +2 -2
- imap_processing/lo/packet_definitions/lo_xtce.xml +1082 -9178
- imap_processing/mag/l0/decom_mag.py +2 -2
- imap_processing/mag/l1a/mag_l1a.py +7 -7
- imap_processing/mag/l1a/mag_l1a_data.py +62 -30
- imap_processing/mag/l1b/mag_l1b.py +11 -6
- imap_processing/quality_flags.py +18 -3
- imap_processing/spice/geometry.py +149 -177
- imap_processing/spice/kernels.py +26 -26
- imap_processing/spice/spin.py +233 -0
- imap_processing/spice/time.py +96 -31
- imap_processing/swapi/l1/swapi_l1.py +60 -31
- imap_processing/swapi/packet_definitions/swapi_packet_definition.xml +363 -384
- imap_processing/swe/l1a/swe_l1a.py +8 -3
- imap_processing/swe/l1a/swe_science.py +24 -24
- imap_processing/swe/l1b/swe_l1b.py +2 -1
- imap_processing/swe/l1b/swe_l1b_science.py +181 -122
- imap_processing/swe/l2/swe_l2.py +337 -70
- imap_processing/swe/utils/swe_utils.py +28 -0
- imap_processing/tests/cdf/test_utils.py +2 -2
- imap_processing/tests/codice/conftest.py +20 -17
- imap_processing/tests/codice/data/validation/imap_codice_l1a_hskp_20241110193622_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-counters-aggregated_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-counters-singles_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-nsw-angular_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-nsw-priority_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-nsw-species_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-sw-angular_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-sw-priority_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-sw-species_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/test_codice_l0.py +55 -121
- imap_processing/tests/codice/test_codice_l1a.py +147 -59
- imap_processing/tests/conftest.py +81 -22
- imap_processing/tests/ena_maps/test_ena_maps.py +309 -0
- imap_processing/tests/ena_maps/test_map_utils.py +286 -0
- imap_processing/tests/ena_maps/test_spatial_utils.py +161 -0
- imap_processing/tests/glows/conftest.py +7 -1
- imap_processing/tests/glows/test_glows_l1a_cdf.py +3 -7
- imap_processing/tests/glows/test_glows_l1a_data.py +34 -6
- imap_processing/tests/glows/test_glows_l1b_data.py +29 -17
- imap_processing/tests/glows/test_glows_l2.py +101 -0
- imap_processing/tests/hi/conftest.py +3 -3
- imap_processing/tests/hi/data/l1/imap_hi_l1b_45sensor-de_20250415_v999.cdf +0 -0
- imap_processing/tests/hi/data/l1/imap_his_pset-calibration-prod-config_20240101_v001.csv +31 -0
- imap_processing/tests/hi/test_hi_l1b.py +14 -9
- imap_processing/tests/hi/test_hi_l1c.py +136 -36
- imap_processing/tests/hi/test_l1a.py +0 -2
- imap_processing/tests/hi/test_science_direct_event.py +18 -14
- imap_processing/tests/hi/test_utils.py +16 -11
- imap_processing/tests/hit/helpers/__init__.py +0 -0
- imap_processing/tests/hit/helpers/l1_validation.py +405 -0
- imap_processing/tests/hit/test_data/sci_sample.ccsds +0 -0
- imap_processing/tests/hit/test_decom_hit.py +8 -10
- imap_processing/tests/hit/test_hit_l1a.py +117 -180
- imap_processing/tests/hit/test_hit_l1b.py +149 -55
- imap_processing/tests/hit/validation_data/hit_l1b_standard_sample2_nsrl_v4_3decimals.csv +62 -0
- imap_processing/tests/hit/validation_data/sci_sample_raw.csv +62 -0
- imap_processing/tests/ialirt/test_data/l0/20240827095047_SWE_IALIRT_packet.bin +0 -0
- imap_processing/tests/ialirt/test_data/l0/BinLog CCSDS_FRAG_TLM_20240826_152323Z_IALIRT_data_for_SDC.bin +0 -0
- imap_processing/tests/ialirt/test_data/l0/eu_SWP_IAL_20240826_152033.csv +644 -0
- imap_processing/tests/ialirt/test_data/l0/hi_fsw_view_1_ccsds.bin +0 -0
- imap_processing/tests/ialirt/test_data/l0/idle_export_eu.SWE_IALIRT_20240827_093852.csv +914 -0
- imap_processing/tests/ialirt/test_data/l0/imap_codice_l1a_hi-ialirt_20240523200000_v0.0.0.cdf +0 -0
- imap_processing/tests/ialirt/unit/test_process_codicehi.py +106 -0
- imap_processing/tests/ialirt/unit/test_process_ephemeris.py +33 -5
- imap_processing/tests/ialirt/unit/test_process_swapi.py +85 -0
- imap_processing/tests/ialirt/unit/test_process_swe.py +106 -0
- imap_processing/tests/idex/conftest.py +29 -1
- imap_processing/tests/idex/test_data/compressed_2023_102_14_24_55.pkts +0 -0
- imap_processing/tests/idex/test_data/non_compressed_2023_102_14_22_26.pkts +0 -0
- imap_processing/tests/idex/test_idex_l0.py +6 -3
- imap_processing/tests/idex/test_idex_l1a.py +151 -1
- imap_processing/tests/idex/test_idex_l1b.py +124 -2
- imap_processing/tests/lo/test_lo_l1a.py +62 -2
- imap_processing/tests/lo/test_lo_science.py +85 -0
- imap_processing/tests/lo/validation_data/Instrument_FM1_T104_R129_20240803_ILO_SPIN_EU.csv +2 -0
- imap_processing/tests/mag/conftest.py +16 -0
- imap_processing/tests/mag/test_mag_decom.py +6 -4
- imap_processing/tests/mag/test_mag_l1a.py +36 -7
- imap_processing/tests/mag/test_mag_l1b.py +55 -4
- imap_processing/tests/mag/test_mag_validation.py +148 -0
- imap_processing/tests/mag/validation/L1a/T001/all_p_ones.txt +19200 -0
- imap_processing/tests/mag/validation/L1a/T001/mag-l0-l1a-t001-in.bin +0 -0
- imap_processing/tests/mag/validation/L1a/T001/mag-l0-l1a-t001-out.csv +17 -0
- imap_processing/tests/mag/validation/L1a/T002/all_n_ones.txt +19200 -0
- imap_processing/tests/mag/validation/L1a/T002/mag-l0-l1a-t002-in.bin +0 -0
- imap_processing/tests/mag/validation/L1a/T002/mag-l0-l1a-t002-out.csv +17 -0
- imap_processing/tests/mag/validation/L1a/T003/field_like.txt +19200 -0
- imap_processing/tests/mag/validation/L1a/T003/mag-l0-l1a-t003-in.bin +0 -0
- imap_processing/tests/mag/validation/L1a/T003/mag-l0-l1a-t003-out.csv +17 -0
- imap_processing/tests/mag/validation/L1a/T004/field_like.txt +19200 -0
- imap_processing/tests/mag/validation/L1a/T004/mag-l0-l1a-t004-in.bin +0 -0
- imap_processing/tests/mag/validation/L1a/T004/mag-l0-l1a-t004-out.csv +17 -0
- imap_processing/tests/mag/validation/L1a/T005/field_like_range_change.txt +19200 -0
- imap_processing/tests/mag/validation/L1a/T005/mag-l0-l1a-t005-in.bin +0 -0
- imap_processing/tests/mag/validation/L1a/T005/mag-l0-l1a-t005-out.csv +17 -0
- imap_processing/tests/mag/validation/L1a/T006/hdr_field.txt +19200 -0
- imap_processing/tests/mag/validation/L1a/T006/mag-l0-l1a-t006-in.bin +0 -0
- imap_processing/tests/mag/validation/L1a/T006/mag-l0-l1a-t006-out.csv +17 -0
- imap_processing/tests/mag/validation/L1a/T007/hdr_field_and_range_change.txt +19200 -0
- imap_processing/tests/mag/validation/L1a/T007/mag-l0-l1a-t007-in.bin +0 -0
- imap_processing/tests/mag/validation/L1a/T007/mag-l0-l1a-t007-out.csv +17 -0
- imap_processing/tests/mag/validation/L1a/T008/field_like_range_change.txt +19200 -0
- imap_processing/tests/mag/validation/L1a/T008/mag-l0-l1a-t008-in.bin +0 -0
- imap_processing/tests/mag/validation/L1a/T008/mag-l0-l1a-t008-out.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T009/data.bin +0 -0
- imap_processing/tests/mag/validation/L1b/T009/field_like_all_ranges.txt +19200 -0
- imap_processing/tests/mag/validation/L1b/T009/mag-l1a-l1b-t009-in.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T009/mag-l1a-l1b-t009-magi-out.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T009/mag-l1a-l1b-t009-mago-out.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T010/data.bin +0 -0
- imap_processing/tests/mag/validation/L1b/T010/field_like_all_ranges.txt +19200 -0
- imap_processing/tests/mag/validation/L1b/T010/mag-l1a-l1b-t010-in.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T010/mag-l1a-l1b-t010-magi-out.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T010/mag-l1a-l1b-t010-mago-out.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T011/data.bin +0 -0
- imap_processing/tests/mag/validation/L1b/T011/field_like_all_ranges.txt +19200 -0
- imap_processing/tests/mag/validation/L1b/T011/mag-l1a-l1b-t011-in.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T011/mag-l1a-l1b-t011-magi-out.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T011/mag-l1a-l1b-t011-mago-out.csv +17 -0
- imap_processing/tests/spice/test_geometry.py +128 -133
- imap_processing/tests/spice/test_kernels.py +37 -37
- imap_processing/tests/spice/test_spin.py +184 -0
- imap_processing/tests/spice/test_time.py +43 -20
- imap_processing/tests/swapi/test_swapi_l1.py +11 -10
- imap_processing/tests/swapi/test_swapi_l2.py +13 -3
- imap_processing/tests/swe/test_swe_l1a.py +1 -1
- imap_processing/tests/swe/test_swe_l1b.py +20 -3
- imap_processing/tests/swe/test_swe_l1b_science.py +54 -35
- imap_processing/tests/swe/test_swe_l2.py +148 -5
- imap_processing/tests/test_cli.py +39 -7
- imap_processing/tests/test_quality_flags.py +19 -19
- imap_processing/tests/test_utils.py +3 -2
- imap_processing/tests/ultra/test_data/l0/ultra45_raw_sc_ultrarawimg_withFSWcalcs_FM45_40P_Phi28p5_BeamCal_LinearScan_phi2850_theta-000_20240207T102740.csv +3314 -3314
- imap_processing/tests/ultra/test_data/mock_data.py +161 -0
- imap_processing/tests/ultra/unit/conftest.py +73 -0
- imap_processing/tests/ultra/unit/test_badtimes.py +58 -0
- imap_processing/tests/ultra/unit/test_cullingmask.py +87 -0
- imap_processing/tests/ultra/unit/test_de.py +61 -60
- imap_processing/tests/ultra/unit/test_ultra_l1a.py +3 -3
- imap_processing/tests/ultra/unit/test_ultra_l1b.py +51 -77
- imap_processing/tests/ultra/unit/test_ultra_l1b_annotated.py +5 -5
- imap_processing/tests/ultra/unit/test_ultra_l1b_culling.py +114 -0
- imap_processing/tests/ultra/unit/test_ultra_l1b_extended.py +86 -26
- imap_processing/tests/ultra/unit/test_ultra_l1c.py +1 -1
- imap_processing/tests/ultra/unit/test_ultra_l1c_pset_bins.py +3 -3
- imap_processing/ultra/constants.py +11 -1
- imap_processing/ultra/l1a/ultra_l1a.py +2 -2
- imap_processing/ultra/l1b/badtimes.py +22 -5
- imap_processing/ultra/l1b/cullingmask.py +31 -5
- imap_processing/ultra/l1b/de.py +32 -37
- imap_processing/ultra/l1b/extendedspin.py +44 -20
- imap_processing/ultra/l1b/ultra_l1b.py +21 -22
- imap_processing/ultra/l1b/ultra_l1b_culling.py +190 -0
- imap_processing/ultra/l1b/ultra_l1b_extended.py +81 -30
- imap_processing/ultra/l1c/histogram.py +6 -2
- imap_processing/ultra/l1c/pset.py +6 -2
- imap_processing/ultra/l1c/ultra_l1c.py +2 -3
- imap_processing/ultra/l1c/ultra_l1c_pset_bins.py +4 -3
- imap_processing/ultra/utils/ultra_l1_utils.py +70 -14
- imap_processing/utils.py +2 -2
- {imap_processing-0.9.0.dist-info → imap_processing-0.11.0.dist-info}/METADATA +7 -2
- {imap_processing-0.9.0.dist-info → imap_processing-0.11.0.dist-info}/RECORD +235 -152
- imap_processing/tests/codice/data/eu_unit_lookup_table.csv +0 -101
- imap_processing/tests/codice/data/idle_export_eu.COD_NHK_20230822_122700 2.csv +0 -100
- imap_processing/tests/codice/data/idle_export_raw.COD_NHK_20230822_122700.csv +0 -100
- imap_processing/tests/codice/data/imap_codice_l0_raw_20241110_v001.pkts +0 -0
- imap_processing/tests/hi/test_data/l1a/imap_hi_l1a_45sensor-de_20250415_v000.cdf +0 -0
- imap_processing/tests/hit/test_data/sci_sample1.ccsds +0 -0
- imap_processing/tests/ultra/unit/test_spatial_utils.py +0 -125
- imap_processing/ultra/utils/spatial_utils.py +0 -221
- /imap_processing/tests/hi/{test_data → data}/l0/20231030_H45_APP_NHK.bin +0 -0
- /imap_processing/tests/hi/{test_data → data}/l0/20231030_H45_APP_NHK.csv +0 -0
- /imap_processing/tests/hi/{test_data → data}/l0/20231030_H45_SCI_CNT.bin +0 -0
- /imap_processing/tests/hi/{test_data → data}/l0/20231030_H45_SCI_DE.bin +0 -0
- /imap_processing/tests/hi/{test_data → data}/l0/H90_NHK_20241104.bin +0 -0
- /imap_processing/tests/hi/{test_data → data}/l0/H90_sci_cnt_20241104.bin +0 -0
- /imap_processing/tests/hi/{test_data → data}/l0/H90_sci_de_20241104.bin +0 -0
- /imap_processing/tests/hi/{test_data → data}/l0/README.txt +0 -0
- /imap_processing/tests/idex/{imap_idex_l0_raw_20231214_v001.pkts → test_data/imap_idex_l0_raw_20231214_v001.pkts} +0 -0
- /imap_processing/tests/idex/{impact_14_tof_high_data.txt → test_data/impact_14_tof_high_data.txt} +0 -0
- /imap_processing/tests/mag/{imap_mag_l1a_norm-magi_20251017_v001.cdf → validation/imap_mag_l1a_norm-magi_20251017_v001.cdf} +0 -0
- /imap_processing/tests/mag/{mag_l0_test_data.pkts → validation/mag_l0_test_data.pkts} +0 -0
- /imap_processing/tests/mag/{mag_l0_test_output.csv → validation/mag_l0_test_output.csv} +0 -0
- /imap_processing/tests/mag/{mag_l1_test_data.pkts → validation/mag_l1_test_data.pkts} +0 -0
- /imap_processing/tests/mag/{mag_l1a_test_output.csv → validation/mag_l1a_test_output.csv} +0 -0
- {imap_processing-0.9.0.dist-info → imap_processing-0.11.0.dist-info}/LICENSE +0 -0
- {imap_processing-0.9.0.dist-info → imap_processing-0.11.0.dist-info}/WHEEL +0 -0
- {imap_processing-0.9.0.dist-info → imap_processing-0.11.0.dist-info}/entry_points.txt +0 -0
imap_processing/swe/l2/swe_l2.py
CHANGED
|
@@ -8,8 +8,13 @@ import numpy as np
|
|
|
8
8
|
import numpy.typing as npt
|
|
9
9
|
import xarray as xr
|
|
10
10
|
|
|
11
|
-
from imap_processing.
|
|
12
|
-
from imap_processing.
|
|
11
|
+
from imap_processing.cdf.imap_cdf_manager import ImapCdfAttributes
|
|
12
|
+
from imap_processing.spice.geometry import SpiceFrame
|
|
13
|
+
from imap_processing.spice.spin import get_instrument_spin_phase, get_spin_angle
|
|
14
|
+
from imap_processing.swe.utils.swe_utils import (
|
|
15
|
+
ESA_VOLTAGE_ROW_INDEX_DICT,
|
|
16
|
+
read_lookup_table,
|
|
17
|
+
)
|
|
13
18
|
|
|
14
19
|
# TODO: add these to instrument status summary
|
|
15
20
|
ENERGY_CONVERSION_FACTOR = 4.75
|
|
@@ -29,6 +34,10 @@ ELECTRON_MASS = 9.10938356e-31 # kg
|
|
|
29
34
|
|
|
30
35
|
# See doc string of calculate_phase_space_density() for more details.
|
|
31
36
|
VELOCITY_CONVERSION_FACTOR = 1.237e31
|
|
37
|
+
# See doc string of calculate_flux() for more details.
|
|
38
|
+
FLUX_CONVERSION_FACTOR = 6.187e30
|
|
39
|
+
|
|
40
|
+
CEM_DETECTORS_ANGLE = np.array([-63, -42, -21, 0, 21, 42, 63])
|
|
32
41
|
|
|
33
42
|
|
|
34
43
|
def get_particle_energy() -> npt.NDArray:
|
|
@@ -56,33 +65,33 @@ def calculate_phase_space_density(l1b_dataset: xr.Dataset) -> xr.Dataset:
|
|
|
56
65
|
"""
|
|
57
66
|
Convert counts to phase space density.
|
|
58
67
|
|
|
59
|
-
Calculate phase space density
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
68
|
+
Calculate phase space density is represented by this symbol, fv.
|
|
69
|
+
Its unit is s^3/ (cm^6 * ster).
|
|
70
|
+
|
|
71
|
+
The formula to calculate phase space density,
|
|
72
|
+
|
|
73
|
+
Where:
|
|
74
|
+
C / tau = corrected count rate which in the input L1B science data.
|
|
75
|
+
G = geometric factor, in (cm^2 * ster). 7 CEMs geometric factor value.
|
|
76
|
+
eV = eV in electron-volts, calculated by get_particle_energy().
|
|
77
|
+
E = Energy in Joules. eV * 1.60219e-19(J/eV).
|
|
78
|
+
m = mass of electron (9.10938356e-31 kg).
|
|
79
|
+
s = second.
|
|
80
|
+
v = sqrt(2 * E / m). Electron speed, computed from energy. In cm/s.
|
|
81
|
+
J = kg * m^2 / s^2. J for joules.
|
|
82
|
+
fv = phase space density.
|
|
83
|
+
|
|
84
|
+
v = sqrt(2 * E / m)
|
|
85
|
+
= sqrt(2 * eV * 1.60219e-19(J/eV) / 9.10938e-31 kg)
|
|
86
|
+
= sqrt(2 * 1.60219 * 10e−19 m^2/s^2 * eV / 9.10938e-31)
|
|
87
|
+
= sqrt(2 * 1.60219 * 10e−19 * 10e4 cm^2/s^2 * eV / 9.10938e-31)
|
|
88
|
+
= sqrt(3.20438 * 10e-15 * eV / 9.10938e-31) cm/s
|
|
89
|
+
= sqrt((3.20438 * 10e-15 / 9.10938e-31) * eV) cm/s
|
|
90
|
+
|
|
91
|
+
fv = 2 * (C/tau) / (G * v^4)
|
|
92
|
+
= 2 * (C/tau) / (G * (sqrt( (3.20438 * 10e-15 / 9.10938e-31) * eV ))^4)
|
|
93
|
+
= 2 * (C/tau) / (G * (sqrt(3.5176e16)^4 * eV^2)
|
|
94
|
+
= 2 * (C/tau) / (G * 1.237e31 * eV^2)
|
|
86
95
|
Ruth Skoug also got the same result, 1.237e31.
|
|
87
96
|
|
|
88
97
|
Parameters
|
|
@@ -111,7 +120,7 @@ def calculate_phase_space_density(l1b_dataset: xr.Dataset) -> xr.Dataset:
|
|
|
111
120
|
particle_energy_data = particle_energy_data.reshape(-1, 24, 30)
|
|
112
121
|
|
|
113
122
|
# Calculate phase space density using formula:
|
|
114
|
-
# 2 * (C/tau) / (G * 1.237e31 *
|
|
123
|
+
# 2 * (C/tau) / (G * 1.237e31 * eV^2)
|
|
115
124
|
# See doc string for more details.
|
|
116
125
|
density = (2 * l1b_dataset["science_data"]) / (
|
|
117
126
|
GEOMETRIC_FACTORS[np.newaxis, np.newaxis, np.newaxis, :]
|
|
@@ -123,8 +132,14 @@ def calculate_phase_space_density(l1b_dataset: xr.Dataset) -> xr.Dataset:
|
|
|
123
132
|
# energy in eV value that flux calculation can use.
|
|
124
133
|
phase_space_density_dataset = xr.Dataset(
|
|
125
134
|
{
|
|
126
|
-
"phase_space_density": (
|
|
127
|
-
|
|
135
|
+
"phase_space_density": (
|
|
136
|
+
["epoch", "esa_step", "spin_sector", "cem_id"],
|
|
137
|
+
density.data,
|
|
138
|
+
),
|
|
139
|
+
"energy_in_eV": (
|
|
140
|
+
["epoch", "esa_step", "spin_sector"],
|
|
141
|
+
particle_energy_data,
|
|
142
|
+
),
|
|
128
143
|
},
|
|
129
144
|
coords=l1b_dataset.coords,
|
|
130
145
|
)
|
|
@@ -136,22 +151,36 @@ def calculate_flux(l1b_dataset: xr.Dataset) -> npt.NDArray:
|
|
|
136
151
|
"""
|
|
137
152
|
Calculate flux.
|
|
138
153
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
Flux is represented by this symbol, j. Its unit is
|
|
155
|
+
1 / (2 * eV * cm^2 * s * ster).
|
|
156
|
+
|
|
157
|
+
The formula to calculate flux,
|
|
158
|
+
|
|
159
|
+
Where:
|
|
160
|
+
fv = the phase space density of solar wind electrons
|
|
161
|
+
given by calculate_phase_space_density() result.
|
|
162
|
+
eV = Energy in electron-volts, calculated by get_particle_energy().
|
|
163
|
+
E = Energy in Joules. eV * 1.60219e-19(J/eV).
|
|
164
|
+
v = sqrt( (3.20438 * 10e-15 / 9.10938e-31) * eV ) cm/s. See
|
|
165
|
+
calculate_phase_space_density() for this calculation.
|
|
166
|
+
j = flux factor.
|
|
167
|
+
|
|
168
|
+
Flux units workout:
|
|
169
|
+
j = (fv * v^4) / (2 * eV)
|
|
170
|
+
= ((s^3 / (cm^6 * ster)) * (cm^4/s^4)) / (2 * eV)
|
|
171
|
+
= ((s^3 * cm^4) / (cm^6 * s^4 * ster)) / (2 * eV)
|
|
172
|
+
= (1 / (cm^2 * s * ster)) / (2 * eV)
|
|
173
|
+
= 1 / (2 * eV * cm^2 * s * ster)
|
|
174
|
+
|
|
175
|
+
Flux conversion factor workout:
|
|
176
|
+
j = (fv * v^4) / (2 * eV)
|
|
177
|
+
= ( fv * (sqrt( (3.20438 * 10e-15 / 9.10938e-31) * eV )^4) ) / (2 * eV)
|
|
178
|
+
= ( fv * ((3.20438 * 10e-15 / 9.10938e-31) * eV)^1/2) ^ 4 ) / (2 * eV)
|
|
179
|
+
= ( fv * (3.20438 * 10e-15 / 9.10938e-31)^2 * eV^2) ) / (2 * eV)
|
|
180
|
+
= ( fv * 1.237e31 * eV^2) ) / (2 * eV)
|
|
181
|
+
= ( fv * 1.237e31 * eV ) / 2
|
|
182
|
+
= (fv * 6.187e30 * eV)
|
|
183
|
+
Ruth Skoug confirmed this factor, 6.187e30.
|
|
155
184
|
|
|
156
185
|
Parameters
|
|
157
186
|
----------
|
|
@@ -164,18 +193,125 @@ def calculate_flux(l1b_dataset: xr.Dataset) -> npt.NDArray:
|
|
|
164
193
|
Flux values.
|
|
165
194
|
"""
|
|
166
195
|
phase_space_density_ds = calculate_phase_space_density(l1b_dataset)
|
|
167
|
-
# TODO: update this once Ruth sends the correct conversion factors.
|
|
168
196
|
flux = (
|
|
169
|
-
|
|
170
|
-
* ELECTRON_MASS
|
|
197
|
+
FLUX_CONVERSION_FACTOR
|
|
171
198
|
* phase_space_density_ds["energy_in_eV"].data[:, :, :, np.newaxis]
|
|
172
|
-
* 1.60219e-19
|
|
173
|
-
* 10e4
|
|
174
199
|
* phase_space_density_ds["phase_space_density"].data
|
|
175
200
|
)
|
|
176
201
|
return flux
|
|
177
202
|
|
|
178
203
|
|
|
204
|
+
def put_data_into_angle_bins(
|
|
205
|
+
data: np.ndarray, angle_bin_indices: npt.NDArray[np.int_]
|
|
206
|
+
) -> npt.NDArray:
|
|
207
|
+
"""
|
|
208
|
+
Put data in its angle bins.
|
|
209
|
+
|
|
210
|
+
This function bins SWE data into 30 predefined angle bins
|
|
211
|
+
while preserving the original energy step structure. For each
|
|
212
|
+
full cycle, it assigns data to the corresponding angle bin
|
|
213
|
+
based on the provided indices.
|
|
214
|
+
|
|
215
|
+
Since multiple data points may fall into the same angle bin,
|
|
216
|
+
the function accumulates values and computes the average across
|
|
217
|
+
all 7 CEMs, ensuring that each bin contains a representative
|
|
218
|
+
mean value while maintaining the 7 CEM structure.
|
|
219
|
+
|
|
220
|
+
Parameters
|
|
221
|
+
----------
|
|
222
|
+
data : numpy.ndarray
|
|
223
|
+
Data to put in bins. Shape: (full_cycle_data, energy_step, angle_bin, 7).
|
|
224
|
+
angle_bin_indices : numpy.ndarray
|
|
225
|
+
Indices of angle bins to put data in. Shape:
|
|
226
|
+
(full_cycle_data, energy_step, angle_bin).
|
|
227
|
+
|
|
228
|
+
Returns
|
|
229
|
+
-------
|
|
230
|
+
numpy.ndarray
|
|
231
|
+
Data in bins. Shape: (full_cycle_data, 24, 30, 7).
|
|
232
|
+
"""
|
|
233
|
+
# Initialize with zeros instead of NaN because np.add.at() does not
|
|
234
|
+
# work with nan values. It results in nan + value = nan
|
|
235
|
+
binned_data = np.zeros((data.shape[0], 24, 30, 7), dtype=np.float64)
|
|
236
|
+
|
|
237
|
+
time_indices = np.arange(data.shape[0])[:, None, None]
|
|
238
|
+
energy_indices = np.arange(24)[None, :, None]
|
|
239
|
+
|
|
240
|
+
# Use np.add.at() to accumulate values into bins
|
|
241
|
+
np.add.at(binned_data, (time_indices, energy_indices, angle_bin_indices), data)
|
|
242
|
+
|
|
243
|
+
# Count occurrences in each bin to compute the mean.
|
|
244
|
+
# Ensure float dtype for division
|
|
245
|
+
bin_counts = np.zeros_like(binned_data, dtype=float)
|
|
246
|
+
np.add.at(bin_counts, (time_indices, energy_indices, angle_bin_indices), 1)
|
|
247
|
+
|
|
248
|
+
# Compute the mean. Replace zero counts with NaN to indicate no data in the bin
|
|
249
|
+
# because zero physical counts could be valid data.
|
|
250
|
+
bin_counts[bin_counts == 0] = np.nan
|
|
251
|
+
binned_data /= bin_counts
|
|
252
|
+
|
|
253
|
+
return binned_data
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
def find_angle_bin_indices(
|
|
257
|
+
inst_spin_angle: np.ndarray,
|
|
258
|
+
) -> npt.NDArray[np.int_]:
|
|
259
|
+
"""
|
|
260
|
+
Find angle bin indices.
|
|
261
|
+
|
|
262
|
+
The spin angle bins are centered at:
|
|
263
|
+
[ 6, 18, 30, 42, 54, 66, 78, 90, 102, 114, 126, 138, 150, 162, 174,
|
|
264
|
+
186, 198, 210, 222, 234, 246, 258, 270, 282, 294, 306, 318, 330,
|
|
265
|
+
342, 354]
|
|
266
|
+
|
|
267
|
+
An input angle is assigned to a bin based on the following conditions:
|
|
268
|
+
- phi_begin <= center - 6
|
|
269
|
+
- phi_center = 6
|
|
270
|
+
- phi_end < center + 6
|
|
271
|
+
|
|
272
|
+
For example, if the input angle is 8.4, it falls within the bin centered at 6.
|
|
273
|
+
|
|
274
|
+
To make binning easier, we define bin edges as:
|
|
275
|
+
[0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 168,
|
|
276
|
+
180, 192, 204, 216, 228, 240, 252, 264, 276, 288, 300, 312, 324,
|
|
277
|
+
336, 348]
|
|
278
|
+
|
|
279
|
+
SWE uses the right-side behavior of `np.searchsorted`, where `a[i-1] <= v < a[i]`.
|
|
280
|
+
|
|
281
|
+
Example test cases:
|
|
282
|
+
- `np.searchsorted(x, [6], side="right") -> [1]` (Bin center test)
|
|
283
|
+
- `np.searchsorted(x, [8.4], side="right") -> [1]` (Edge case near center)
|
|
284
|
+
- `np.searchsorted(x, [12], side="right") -> [2]` (Bin end test)
|
|
285
|
+
- `np.searchsorted(x, [0], side="right") -> [1]` (Bin start test)
|
|
286
|
+
|
|
287
|
+
Using `i-1` ensures that all input angles are assigned to the correct bin of
|
|
288
|
+
centered angle bins.
|
|
289
|
+
|
|
290
|
+
Parameters
|
|
291
|
+
----------
|
|
292
|
+
inst_spin_angle : numpy.ndarray
|
|
293
|
+
Instrument spin angle.
|
|
294
|
+
|
|
295
|
+
Returns
|
|
296
|
+
-------
|
|
297
|
+
spin_angle_bins_indices : numpy.ndarray
|
|
298
|
+
Spin angle bin indices.
|
|
299
|
+
"""
|
|
300
|
+
spin_angle_bin_edges = np.arange(0, 360, 12)
|
|
301
|
+
# Ensure that inst_spin_angle is np.array for below conditions
|
|
302
|
+
# check to work properly.
|
|
303
|
+
inst_spin_angle = np.array(inst_spin_angle)
|
|
304
|
+
# Check that there are no angle values outside the range [0, 360).
|
|
305
|
+
if np.any((inst_spin_angle < 0) | (inst_spin_angle >= 360)):
|
|
306
|
+
raise ValueError("Input angle values must be in the range [0, 360)")
|
|
307
|
+
|
|
308
|
+
spin_angle_bins_indices = np.searchsorted(
|
|
309
|
+
spin_angle_bin_edges, inst_spin_angle, side="right"
|
|
310
|
+
)
|
|
311
|
+
spin_angle_bins_indices = spin_angle_bins_indices - 1
|
|
312
|
+
return spin_angle_bins_indices
|
|
313
|
+
|
|
314
|
+
|
|
179
315
|
def swe_l2(l1b_dataset: xr.Dataset, data_version: str) -> xr.Dataset:
|
|
180
316
|
"""
|
|
181
317
|
Will process data to L2.
|
|
@@ -192,25 +328,156 @@ def swe_l2(l1b_dataset: xr.Dataset, data_version: str) -> xr.Dataset:
|
|
|
192
328
|
data : xarray.Dataset
|
|
193
329
|
Processed data to L2.
|
|
194
330
|
"""
|
|
195
|
-
|
|
331
|
+
cdf_attributes = ImapCdfAttributes()
|
|
332
|
+
cdf_attributes.add_instrument_global_attrs("swe")
|
|
333
|
+
cdf_attributes.add_instrument_variable_attrs("swe", "l2")
|
|
334
|
+
cdf_attributes.add_global_attribute("Data_version", data_version)
|
|
335
|
+
|
|
336
|
+
# Energy values in eV.
|
|
337
|
+
energy_xr = xr.DataArray(
|
|
338
|
+
np.array(list(ESA_VOLTAGE_ROW_INDEX_DICT.keys())) * ENERGY_CONVERSION_FACTOR,
|
|
339
|
+
name="energy",
|
|
340
|
+
dims=["energy"],
|
|
341
|
+
attrs=cdf_attributes.get_variable_attributes("energy"),
|
|
342
|
+
)
|
|
196
343
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
344
|
+
energy_label = xr.DataArray(
|
|
345
|
+
np.array(list(ESA_VOLTAGE_ROW_INDEX_DICT.keys())).astype(str),
|
|
346
|
+
name="energy_label",
|
|
347
|
+
dims=["energy"],
|
|
348
|
+
attrs=cdf_attributes.get_variable_attributes("energy_label"),
|
|
349
|
+
)
|
|
200
350
|
|
|
201
|
-
#
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
351
|
+
# Angle of each CEM detectors.
|
|
352
|
+
inst_el_xr = xr.DataArray(
|
|
353
|
+
CEM_DETECTORS_ANGLE,
|
|
354
|
+
name="inst_el",
|
|
355
|
+
dims=["inst_el"],
|
|
356
|
+
attrs=cdf_attributes.get_variable_attributes("inst_el"),
|
|
357
|
+
)
|
|
358
|
+
inst_el_label = xr.DataArray(
|
|
359
|
+
CEM_DETECTORS_ANGLE.astype(str),
|
|
360
|
+
name="inst_el_label",
|
|
361
|
+
dims=["inst_el"],
|
|
362
|
+
attrs=cdf_attributes.get_variable_attributes("inst_el_label"),
|
|
363
|
+
)
|
|
208
364
|
|
|
209
|
-
#
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
365
|
+
# Spin Angle bins storing bin center values.
|
|
366
|
+
inst_az_xr = xr.DataArray(
|
|
367
|
+
np.arange(0, 360, 12) + 6,
|
|
368
|
+
name="inst_az",
|
|
369
|
+
dims=["inst_az"],
|
|
370
|
+
attrs=cdf_attributes.get_variable_attributes("inst_az"),
|
|
371
|
+
)
|
|
372
|
+
inst_az_label = xr.DataArray(
|
|
373
|
+
inst_az_xr.values.astype(str),
|
|
374
|
+
name="inst_az_label",
|
|
375
|
+
dims=["inst_az"],
|
|
376
|
+
attrs=cdf_attributes.get_variable_attributes("inst_az_label"),
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
dataset = xr.Dataset(
|
|
380
|
+
coords={
|
|
381
|
+
"epoch": l1b_dataset["epoch"],
|
|
382
|
+
"esa_step": l1b_dataset["esa_step"],
|
|
383
|
+
"energy": energy_xr,
|
|
384
|
+
"spin_sector": l1b_dataset["spin_sector"],
|
|
385
|
+
"inst_az": inst_az_xr,
|
|
386
|
+
"cem_id": l1b_dataset["cem_id"],
|
|
387
|
+
"inst_el": inst_el_xr,
|
|
388
|
+
"esa_step_label": l1b_dataset["esa_step_label"],
|
|
389
|
+
"energy_label": energy_label,
|
|
390
|
+
"spin_sector_label": l1b_dataset["spin_sector_label"],
|
|
391
|
+
"inst_az_label": inst_az_label,
|
|
392
|
+
"cem_id_label": l1b_dataset["cem_id_label"],
|
|
393
|
+
"inst_el_label": inst_el_label,
|
|
214
394
|
},
|
|
215
|
-
|
|
395
|
+
attrs=cdf_attributes.get_global_attributes("imap_swe_l2_sci"),
|
|
216
396
|
)
|
|
397
|
+
|
|
398
|
+
############################################################
|
|
399
|
+
# Calculate phase space density and flux. Store data in shape
|
|
400
|
+
# (epoch, esa_step, spin_sector, cem_id). This is for L3 purposes.
|
|
401
|
+
############################################################
|
|
402
|
+
phase_space_density = calculate_phase_space_density(l1b_dataset)[
|
|
403
|
+
"phase_space_density"
|
|
404
|
+
]
|
|
405
|
+
dataset["phase_space_density_spin_sector"] = xr.DataArray(
|
|
406
|
+
phase_space_density,
|
|
407
|
+
name="phase_space_density_spin_sector",
|
|
408
|
+
dims=["epoch", "esa_step", "spin_sector", "cem_id"],
|
|
409
|
+
attrs=cdf_attributes.get_variable_attributes("phase_space_density_spin_sector"),
|
|
410
|
+
)
|
|
411
|
+
|
|
412
|
+
flux = calculate_flux(l1b_dataset)
|
|
413
|
+
dataset["flux_spin_sector"] = xr.DataArray(
|
|
414
|
+
flux,
|
|
415
|
+
name="flux_spin_sector",
|
|
416
|
+
dims=["epoch", "esa_step", "spin_sector", "cem_id"],
|
|
417
|
+
attrs=cdf_attributes.get_variable_attributes("flux_spin_sector"),
|
|
418
|
+
)
|
|
419
|
+
|
|
420
|
+
# Carry over acquisition times for L3 purposes.
|
|
421
|
+
dataset["acquisition_time"] = l1b_dataset["acquisition_time"]
|
|
422
|
+
|
|
423
|
+
# Calculate spin phase using SWE acquisition_time from the
|
|
424
|
+
# L1B dataset. The L1B dataset stores acquisition_time with
|
|
425
|
+
# dimensions (epoch, esa_step, spin_sector). Use center time
|
|
426
|
+
# to calculate spin phase. This center time calculation is
|
|
427
|
+
# necessary to accurately determine the center angle of the data.
|
|
428
|
+
#
|
|
429
|
+
# To determine the center acquisition time, we adjust the
|
|
430
|
+
# recorded acquisition_time as follows:
|
|
431
|
+
# acquisition_time + (acq_duration / 1000000) / 2
|
|
432
|
+
#
|
|
433
|
+
# Here, acq_duration is given in microseconds and is stored
|
|
434
|
+
# in the L1B dataset with dimensions (epoch, cycle). Since acq_duration
|
|
435
|
+
# remains the same for all quarter cycles within a full sweep,
|
|
436
|
+
# we use the first acq_duration value for each full sweep to perform
|
|
437
|
+
# this adjustment.
|
|
438
|
+
|
|
439
|
+
acq_duration = l1b_dataset["acq_duration"].data[:, 0] / 2000000
|
|
440
|
+
data_acq_time = (
|
|
441
|
+
l1b_dataset["acquisition_time"].data + acq_duration[:, np.newaxis, np.newaxis]
|
|
442
|
+
)
|
|
443
|
+
|
|
444
|
+
# Calculate spin phase
|
|
445
|
+
inst_spin_phase = get_instrument_spin_phase(
|
|
446
|
+
query_met_times=data_acq_time.ravel(),
|
|
447
|
+
instrument=SpiceFrame.IMAP_SWE,
|
|
448
|
+
)
|
|
449
|
+
|
|
450
|
+
# Convert spin phase to spin angle in degrees.
|
|
451
|
+
inst_spin_angle = get_spin_angle(inst_spin_phase, degrees=True).reshape(-1, 24, 30)
|
|
452
|
+
|
|
453
|
+
# Save spin angle in dataset per SWE request.
|
|
454
|
+
dataset["inst_az_spin_sector"] = xr.DataArray(
|
|
455
|
+
inst_spin_angle,
|
|
456
|
+
name="inst_az_spin_sector",
|
|
457
|
+
dims=["epoch", "energy", "inst_az"],
|
|
458
|
+
attrs=cdf_attributes.get_variable_attributes("inst_az_spin_sector"),
|
|
459
|
+
)
|
|
460
|
+
|
|
461
|
+
spin_angle_bins_indices = find_angle_bin_indices(inst_spin_angle)
|
|
462
|
+
|
|
463
|
+
# Put flux data in its spin angle bins using the indices.
|
|
464
|
+
flux_binned_data = put_data_into_angle_bins(flux, spin_angle_bins_indices)
|
|
465
|
+
dataset["flux"] = xr.DataArray(
|
|
466
|
+
flux_binned_data,
|
|
467
|
+
name="flux",
|
|
468
|
+
dims=["epoch", "energy", "inst_az", "inst_el"],
|
|
469
|
+
attrs=cdf_attributes.get_variable_attributes("flux"),
|
|
470
|
+
)
|
|
471
|
+
|
|
472
|
+
# Put phase space density data in its spin angle bins using the indices.
|
|
473
|
+
phase_space_density_binned_data = put_data_into_angle_bins(
|
|
474
|
+
phase_space_density.data, spin_angle_bins_indices
|
|
475
|
+
)
|
|
476
|
+
dataset["phase_space_density"] = xr.DataArray(
|
|
477
|
+
phase_space_density_binned_data,
|
|
478
|
+
name="phase_space_density",
|
|
479
|
+
dims=["epoch", "energy", "inst_az", "inst_el"],
|
|
480
|
+
attrs=cdf_attributes.get_variable_attributes("phase_space_density"),
|
|
481
|
+
)
|
|
482
|
+
|
|
483
|
+
return dataset
|
|
@@ -6,6 +6,34 @@ import pandas as pd
|
|
|
6
6
|
|
|
7
7
|
from imap_processing import imap_module_directory
|
|
8
8
|
|
|
9
|
+
# ESA voltage and index in the final data table
|
|
10
|
+
ESA_VOLTAGE_ROW_INDEX_DICT = {
|
|
11
|
+
0.56: 0,
|
|
12
|
+
0.78: 1,
|
|
13
|
+
1.08: 2,
|
|
14
|
+
1.51: 3,
|
|
15
|
+
2.10: 4,
|
|
16
|
+
2.92: 5,
|
|
17
|
+
4.06: 6,
|
|
18
|
+
5.64: 7,
|
|
19
|
+
7.85: 8,
|
|
20
|
+
10.92: 9,
|
|
21
|
+
15.19: 10,
|
|
22
|
+
21.13: 11,
|
|
23
|
+
29.39: 12,
|
|
24
|
+
40.88: 13,
|
|
25
|
+
56.87: 14,
|
|
26
|
+
79.10: 15,
|
|
27
|
+
110.03: 16,
|
|
28
|
+
153.05: 17,
|
|
29
|
+
212.89: 18,
|
|
30
|
+
296.14: 19,
|
|
31
|
+
411.93: 20,
|
|
32
|
+
572.99: 21,
|
|
33
|
+
797.03: 22,
|
|
34
|
+
1108.66: 23,
|
|
35
|
+
}
|
|
36
|
+
|
|
9
37
|
|
|
10
38
|
class SWEAPID(IntEnum):
|
|
11
39
|
"""Create ENUM for apid."""
|
|
@@ -13,7 +13,7 @@ from imap_processing.cdf.utils import (
|
|
|
13
13
|
parse_filename_like,
|
|
14
14
|
write_cdf,
|
|
15
15
|
)
|
|
16
|
-
from imap_processing.spice.time import
|
|
16
|
+
from imap_processing.spice.time import met_to_ttj2000ns
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
@pytest.fixture()
|
|
@@ -34,7 +34,7 @@ def test_dataset():
|
|
|
34
34
|
{
|
|
35
35
|
"epoch": (
|
|
36
36
|
"epoch",
|
|
37
|
-
|
|
37
|
+
met_to_ttj2000ns([1, 2, 3]),
|
|
38
38
|
)
|
|
39
39
|
},
|
|
40
40
|
attrs=swe_attrs.get_global_attributes("imap_swe_l1a_sci")
|
|
@@ -20,21 +20,24 @@ TEST_L1A_FILES = [
|
|
|
20
20
|
TEST_DATA_PATH / "imap_codice_l1a_lo-nsw-species_20240429_v001.pkts",
|
|
21
21
|
]
|
|
22
22
|
|
|
23
|
-
#
|
|
23
|
+
# ruff: noqa
|
|
24
24
|
VALIDATION_DATA = [
|
|
25
|
-
TEST_DATA_PATH / "
|
|
26
|
-
TEST_DATA_PATH / "
|
|
27
|
-
TEST_DATA_PATH / "
|
|
28
|
-
TEST_DATA_PATH / "
|
|
29
|
-
TEST_DATA_PATH / "
|
|
30
|
-
TEST_DATA_PATH / "
|
|
31
|
-
TEST_DATA_PATH / "
|
|
32
|
-
TEST_DATA_PATH / "
|
|
33
|
-
TEST_DATA_PATH / "
|
|
34
|
-
TEST_DATA_PATH / "
|
|
35
|
-
TEST_DATA_PATH / "
|
|
36
|
-
TEST_DATA_PATH / "
|
|
37
|
-
TEST_DATA_PATH / "
|
|
38
|
-
TEST_DATA_PATH / "
|
|
39
|
-
TEST_DATA_PATH / "
|
|
40
|
-
|
|
25
|
+
TEST_DATA_PATH / "validation" / "imap_codice_l1a_hi-ialirt_20241110193700_v0.0.0.cdf",
|
|
26
|
+
TEST_DATA_PATH / "validation" / "imap_codice_l1a_lo-ialirt_20241110193700_v0.0.0.cdf",
|
|
27
|
+
TEST_DATA_PATH / "validation" / "imap_codice_l1a_hskp_20241110193622_v0.0.0.cdf",
|
|
28
|
+
TEST_DATA_PATH / "validation" / "imap_codice_l1a_lo-counters-aggregated_20241110193700_v0.0.0.cdf",
|
|
29
|
+
TEST_DATA_PATH / "validation" / "imap_codice_l1a_lo-counters-singles_20241110193700_v0.0.0.cdf",
|
|
30
|
+
TEST_DATA_PATH / "validation" / "imap_codice_l1a_lo-sw-priority_20241110193700_v0.0.0.cdf",
|
|
31
|
+
TEST_DATA_PATH / "validation" / "imap_codice_l1a_lo-nsw-priority_20241110193700_v0.0.0.cdf",
|
|
32
|
+
TEST_DATA_PATH / "validation" / "imap_codice_l1a_lo-sw-species_20241110193700_v0.0.0.cdf",
|
|
33
|
+
TEST_DATA_PATH / "validation" / "imap_codice_l1a_lo-nsw-species_20241110193700_v0.0.0.cdf",
|
|
34
|
+
TEST_DATA_PATH / "validation" / "imap_codice_l1a_lo-sw-angular_20241110193700_v0.0.0.cdf",
|
|
35
|
+
TEST_DATA_PATH / "validation" / "imap_codice_l1a_lo-nsw-angular_20241110193700_v0.0.0.cdf",
|
|
36
|
+
TEST_DATA_PATH / "validation" / "imap_codice_l1a_hi-counters-aggregated_20241110193700_v0.0.0.cdf",
|
|
37
|
+
TEST_DATA_PATH / "validation" / "imap_codice_l1a_hi-counters-singles_20241110193700_v0.0.0.cdf",
|
|
38
|
+
TEST_DATA_PATH / "validation" / "imap_codice_l1a_hi-omni_20241110193700_v0.0.0.cdf",
|
|
39
|
+
TEST_DATA_PATH / "validation" / "imap_codice_l1a_hi-sectored_20241110193700_v0.0.0.cdf",
|
|
40
|
+
TEST_DATA_PATH / "validation" / "imap_codice_l1a_hi-priority_20241110193700_v0.0.0.cdf",
|
|
41
|
+
TEST_DATA_PATH / "validation" / "imap_codice_l1a_lo-pha_20241110193700_v0.0.0.cdf",
|
|
42
|
+
TEST_DATA_PATH / "validation" / "imap_codice_l1a_hi-pha_20241110193700_v0.0.0.cdf",
|
|
43
|
+
] # fmt: skip
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-sw-angular_20241110193700_v0.0.0.cdf
ADDED
|
Binary file
|
|
Binary file
|