imap-processing 0.7.0__py3-none-any.whl → 0.9.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.

Files changed (172) hide show
  1. imap_processing/__init__.py +1 -1
  2. imap_processing/_version.py +2 -2
  3. imap_processing/ccsds/excel_to_xtce.py +36 -2
  4. imap_processing/cdf/config/imap_codice_global_cdf_attrs.yaml +1 -1
  5. imap_processing/cdf/config/imap_codice_l1a_variable_attrs.yaml +145 -30
  6. imap_processing/cdf/config/imap_glows_l1b_variable_attrs.yaml +36 -36
  7. imap_processing/cdf/config/imap_hi_variable_attrs.yaml +136 -9
  8. imap_processing/cdf/config/imap_hit_global_cdf_attrs.yaml +14 -0
  9. imap_processing/cdf/config/imap_hit_l1a_variable_attrs.yaml +63 -1
  10. imap_processing/cdf/config/imap_hit_l1b_variable_attrs.yaml +9 -0
  11. imap_processing/cdf/config/imap_idex_global_cdf_attrs.yaml +14 -7
  12. imap_processing/cdf/config/imap_idex_l1a_variable_attrs.yaml +577 -235
  13. imap_processing/cdf/config/imap_idex_l1b_variable_attrs.yaml +326 -0
  14. imap_processing/cdf/config/imap_lo_l1a_variable_attrs.yaml +33 -23
  15. imap_processing/cdf/config/imap_mag_l1_variable_attrs.yaml +24 -28
  16. imap_processing/cdf/config/imap_ultra_l1a_variable_attrs.yaml +1 -0
  17. imap_processing/cdf/config/imap_ultra_l1b_variable_attrs.yaml +137 -79
  18. imap_processing/cdf/config/imap_variable_schema.yaml +13 -0
  19. imap_processing/cdf/imap_cdf_manager.py +31 -27
  20. imap_processing/cdf/utils.py +3 -5
  21. imap_processing/cli.py +25 -14
  22. imap_processing/codice/codice_l1a.py +153 -63
  23. imap_processing/codice/constants.py +10 -10
  24. imap_processing/codice/decompress.py +10 -11
  25. imap_processing/codice/utils.py +1 -0
  26. imap_processing/glows/l1a/glows_l1a.py +1 -2
  27. imap_processing/glows/l1b/glows_l1b.py +3 -3
  28. imap_processing/glows/l1b/glows_l1b_data.py +59 -37
  29. imap_processing/glows/l2/glows_l2_data.py +123 -0
  30. imap_processing/hi/l1a/hi_l1a.py +4 -4
  31. imap_processing/hi/l1a/histogram.py +107 -109
  32. imap_processing/hi/l1a/science_direct_event.py +92 -225
  33. imap_processing/hi/l1b/hi_l1b.py +85 -11
  34. imap_processing/hi/l1c/hi_l1c.py +23 -1
  35. imap_processing/hi/packet_definitions/TLM_HI_COMBINED_SCI.xml +3994 -0
  36. imap_processing/hi/utils.py +1 -1
  37. imap_processing/hit/hit_utils.py +221 -0
  38. imap_processing/hit/l0/constants.py +118 -0
  39. imap_processing/hit/l0/decom_hit.py +100 -156
  40. imap_processing/hit/l1a/hit_l1a.py +170 -184
  41. imap_processing/hit/l1b/hit_l1b.py +33 -153
  42. imap_processing/ialirt/l0/process_codicelo.py +153 -0
  43. imap_processing/ialirt/l0/process_hit.py +5 -5
  44. imap_processing/ialirt/packet_definitions/ialirt_codicelo.xml +281 -0
  45. imap_processing/ialirt/process_ephemeris.py +212 -0
  46. imap_processing/idex/idex_l1a.py +65 -84
  47. imap_processing/idex/idex_l1b.py +192 -0
  48. imap_processing/idex/idex_variable_unpacking_and_eu_conversion.csv +33 -0
  49. imap_processing/idex/packet_definitions/idex_packet_definition.xml +97 -595
  50. imap_processing/lo/l0/decompression_tables/decompression_tables.py +17 -1
  51. imap_processing/lo/l0/lo_science.py +45 -13
  52. imap_processing/lo/l1a/lo_l1a.py +76 -8
  53. imap_processing/lo/packet_definitions/lo_xtce.xml +8344 -1849
  54. imap_processing/mag/l0/decom_mag.py +4 -3
  55. imap_processing/mag/l1a/mag_l1a.py +12 -13
  56. imap_processing/mag/l1a/mag_l1a_data.py +1 -2
  57. imap_processing/mag/l1b/mag_l1b.py +90 -7
  58. imap_processing/spice/geometry.py +156 -16
  59. imap_processing/spice/time.py +144 -2
  60. imap_processing/swapi/l1/swapi_l1.py +4 -4
  61. imap_processing/swapi/l2/swapi_l2.py +1 -1
  62. imap_processing/swapi/packet_definitions/swapi_packet_definition.xml +1535 -446
  63. imap_processing/swe/l1b/swe_l1b_science.py +8 -8
  64. imap_processing/swe/l2/swe_l2.py +134 -17
  65. imap_processing/tests/ccsds/test_data/expected_output.xml +2 -1
  66. imap_processing/tests/ccsds/test_excel_to_xtce.py +4 -4
  67. imap_processing/tests/cdf/test_imap_cdf_manager.py +0 -10
  68. imap_processing/tests/codice/conftest.py +1 -17
  69. imap_processing/tests/codice/data/imap_codice_l0_raw_20241110_v001.pkts +0 -0
  70. imap_processing/tests/codice/test_codice_l0.py +8 -2
  71. imap_processing/tests/codice/test_codice_l1a.py +127 -107
  72. imap_processing/tests/codice/test_codice_l1b.py +1 -0
  73. imap_processing/tests/codice/test_decompress.py +7 -7
  74. imap_processing/tests/conftest.py +100 -58
  75. imap_processing/tests/glows/conftest.py +6 -0
  76. imap_processing/tests/glows/test_glows_l1b.py +9 -9
  77. imap_processing/tests/glows/test_glows_l1b_data.py +9 -9
  78. imap_processing/tests/hi/test_data/l0/H90_NHK_20241104.bin +0 -0
  79. imap_processing/tests/hi/test_data/l0/H90_sci_cnt_20241104.bin +0 -0
  80. imap_processing/tests/hi/test_data/l0/H90_sci_de_20241104.bin +0 -0
  81. imap_processing/tests/hi/test_data/l1a/imap_hi_l1a_45sensor-de_20250415_v000.cdf +0 -0
  82. imap_processing/tests/hi/test_hi_l1b.py +73 -3
  83. imap_processing/tests/hi/test_hi_l1c.py +10 -2
  84. imap_processing/tests/hi/test_l1a.py +31 -58
  85. imap_processing/tests/hi/test_science_direct_event.py +58 -0
  86. imap_processing/tests/hi/test_utils.py +4 -3
  87. imap_processing/tests/hit/test_data/sci_sample1.ccsds +0 -0
  88. imap_processing/tests/hit/{test_hit_decom.py → test_decom_hit.py} +95 -36
  89. imap_processing/tests/hit/test_hit_l1a.py +299 -179
  90. imap_processing/tests/hit/test_hit_l1b.py +231 -24
  91. imap_processing/tests/hit/test_hit_utils.py +218 -0
  92. imap_processing/tests/hit/validation_data/hskp_sample_eu.csv +89 -0
  93. imap_processing/tests/hit/validation_data/sci_sample_raw1.csv +29 -0
  94. imap_processing/tests/ialirt/test_data/l0/apid01152.tlm +0 -0
  95. imap_processing/tests/ialirt/test_data/l0/imap_codice_l1a_lo-ialirt_20241110193700_v0.0.0.cdf +0 -0
  96. imap_processing/tests/ialirt/unit/test_process_codicelo.py +106 -0
  97. imap_processing/tests/ialirt/unit/test_process_ephemeris.py +109 -0
  98. imap_processing/tests/ialirt/unit/test_process_hit.py +9 -6
  99. imap_processing/tests/idex/conftest.py +2 -2
  100. imap_processing/tests/idex/imap_idex_l0_raw_20231214_v001.pkts +0 -0
  101. imap_processing/tests/idex/impact_14_tof_high_data.txt +4444 -4444
  102. imap_processing/tests/idex/test_idex_l0.py +4 -4
  103. imap_processing/tests/idex/test_idex_l1a.py +8 -2
  104. imap_processing/tests/idex/test_idex_l1b.py +126 -0
  105. imap_processing/tests/lo/test_lo_l1a.py +7 -16
  106. imap_processing/tests/lo/test_lo_science.py +69 -5
  107. imap_processing/tests/lo/test_pkts/imap_lo_l0_raw_20240803_v002.pkts +0 -0
  108. imap_processing/tests/lo/validation_data/Instrument_FM1_T104_R129_20240803_ILO_SCI_DE_dec_DN_with_fills.csv +1999 -0
  109. imap_processing/tests/mag/imap_mag_l1a_norm-magi_20251017_v001.cdf +0 -0
  110. imap_processing/tests/mag/test_mag_l1b.py +97 -7
  111. imap_processing/tests/spice/test_data/imap_ena_sim_metakernel.template +3 -1
  112. imap_processing/tests/spice/test_geometry.py +115 -9
  113. imap_processing/tests/spice/test_time.py +135 -6
  114. imap_processing/tests/swapi/test_swapi_decom.py +75 -69
  115. imap_processing/tests/swapi/test_swapi_l1.py +4 -4
  116. imap_processing/tests/swe/conftest.py +33 -0
  117. imap_processing/tests/swe/l1_validation/swe_l0_unpacked-data_20240510_v001_VALIDATION_L1B_v3.dat +4332 -0
  118. imap_processing/tests/swe/test_swe_l1b.py +29 -8
  119. imap_processing/tests/swe/test_swe_l2.py +64 -8
  120. imap_processing/tests/test_utils.py +2 -2
  121. imap_processing/tests/ultra/test_data/l0/ultra45_raw_sc_ultrarawimg_withFSWcalcs_FM45_40P_Phi28p5_BeamCal_LinearScan_phi2850_theta-000_20240207T102740.csv +3314 -3314
  122. imap_processing/tests/ultra/test_data/l1/dps_exposure_helio_45_E12.cdf +0 -0
  123. imap_processing/tests/ultra/test_data/l1/dps_exposure_helio_45_E24.cdf +0 -0
  124. imap_processing/tests/ultra/unit/test_de.py +113 -0
  125. imap_processing/tests/ultra/unit/test_spatial_utils.py +125 -0
  126. imap_processing/tests/ultra/unit/test_ultra_l1b.py +27 -3
  127. imap_processing/tests/ultra/unit/test_ultra_l1b_annotated.py +31 -10
  128. imap_processing/tests/ultra/unit/test_ultra_l1b_extended.py +55 -35
  129. imap_processing/tests/ultra/unit/test_ultra_l1c_pset_bins.py +10 -68
  130. imap_processing/ultra/constants.py +12 -3
  131. imap_processing/ultra/l1b/de.py +168 -30
  132. imap_processing/ultra/l1b/ultra_l1b_annotated.py +24 -10
  133. imap_processing/ultra/l1b/ultra_l1b_extended.py +46 -80
  134. imap_processing/ultra/l1c/ultra_l1c_pset_bins.py +60 -144
  135. imap_processing/ultra/utils/spatial_utils.py +221 -0
  136. {imap_processing-0.7.0.dist-info → imap_processing-0.9.0.dist-info}/METADATA +15 -14
  137. {imap_processing-0.7.0.dist-info → imap_processing-0.9.0.dist-info}/RECORD +142 -139
  138. imap_processing/cdf/cdf_attribute_manager.py +0 -322
  139. imap_processing/cdf/config/shared/default_global_cdf_attrs_schema.yaml +0 -246
  140. imap_processing/cdf/config/shared/default_variable_cdf_attrs_schema.yaml +0 -466
  141. imap_processing/hi/l0/decom_hi.py +0 -24
  142. imap_processing/hi/packet_definitions/hi_packet_definition.xml +0 -482
  143. imap_processing/hit/l0/data_classes/housekeeping.py +0 -240
  144. imap_processing/hit/l0/data_classes/science_packet.py +0 -259
  145. imap_processing/hit/l0/utils/hit_base.py +0 -57
  146. imap_processing/tests/cdf/shared/default_global_cdf_attrs_schema.yaml +0 -246
  147. imap_processing/tests/cdf/shared/default_variable_cdf_attrs_schema.yaml +0 -466
  148. imap_processing/tests/cdf/test_cdf_attribute_manager.py +0 -353
  149. imap_processing/tests/codice/data/imap_codice_l0_hi-counters-aggregated_20240429_v001.pkts +0 -0
  150. imap_processing/tests/codice/data/imap_codice_l0_hi-counters-singles_20240429_v001.pkts +0 -0
  151. imap_processing/tests/codice/data/imap_codice_l0_hi-omni_20240429_v001.pkts +0 -0
  152. imap_processing/tests/codice/data/imap_codice_l0_hi-pha_20240429_v001.pkts +0 -0
  153. imap_processing/tests/codice/data/imap_codice_l0_hi-sectored_20240429_v001.pkts +0 -0
  154. imap_processing/tests/codice/data/imap_codice_l0_hskp_20100101_v001.pkts +0 -0
  155. imap_processing/tests/codice/data/imap_codice_l0_lo-counters-aggregated_20240429_v001.pkts +0 -0
  156. imap_processing/tests/codice/data/imap_codice_l0_lo-counters-singles_20240429_v001.pkts +0 -0
  157. imap_processing/tests/codice/data/imap_codice_l0_lo-nsw-angular_20240429_v001.pkts +0 -0
  158. imap_processing/tests/codice/data/imap_codice_l0_lo-nsw-priority_20240429_v001.pkts +0 -0
  159. imap_processing/tests/codice/data/imap_codice_l0_lo-nsw-species_20240429_v001.pkts +0 -0
  160. imap_processing/tests/codice/data/imap_codice_l0_lo-pha_20240429_v001.pkts +0 -0
  161. imap_processing/tests/codice/data/imap_codice_l0_lo-sw-angular_20240429_v001.pkts +0 -0
  162. imap_processing/tests/codice/data/imap_codice_l0_lo-sw-priority_20240429_v001.pkts +0 -0
  163. imap_processing/tests/codice/data/imap_codice_l0_lo-sw-species_20240429_v001.pkts +0 -0
  164. imap_processing/tests/hi/test_decom.py +0 -55
  165. imap_processing/tests/hi/test_l1a_sci_de.py +0 -72
  166. imap_processing/tests/idex/imap_idex_l0_raw_20230725_v001.pkts +0 -0
  167. imap_processing/tests/mag/imap_mag_l1a_burst-magi_20231025_v001.cdf +0 -0
  168. /imap_processing/{hi/l0/__init__.py → tests/glows/test_glows_l2_data.py} +0 -0
  169. /imap_processing/tests/hit/test_data/{imap_hit_l0_hk_20100105_v001.pkts → imap_hit_l0_raw_20100105_v001.pkts} +0 -0
  170. {imap_processing-0.7.0.dist-info → imap_processing-0.9.0.dist-info}/LICENSE +0 -0
  171. {imap_processing-0.7.0.dist-info → imap_processing-0.9.0.dist-info}/WHEEL +0 -0
  172. {imap_processing-0.7.0.dist-info → imap_processing-0.9.0.dist-info}/entry_points.txt +0 -0
@@ -1,322 +0,0 @@
1
- """
2
- Class for creating and managing CDF attrs.
3
-
4
- Developed based of HermesDataSchema from HERMES-SOC/hermes_core.
5
- """
6
-
7
- from __future__ import annotations
8
-
9
- import logging
10
- from pathlib import Path
11
-
12
- import yaml
13
-
14
- DEFAULT_GLOBAL_CDF_ATTRS_FILE = "imap_default_global_cdf_attrs.yaml"
15
- DEFAULT_GLOBAL_CDF_ATTRS_SCHEMA_FILE = "default_global_cdf_attrs_schema.yaml"
16
- DEFAULT_VARIABLE_CDF_ATTRS_SCHEMA_FILE = "default_variable_cdf_attrs_schema.yaml"
17
-
18
-
19
- class CdfAttributeManager:
20
- """
21
- Class for creating and managing CDF attributes based out of yaml files.
22
-
23
- This class is based on the HERMES SWxSOC project for managing CDF attributes, but
24
- is intended to be a flexible and very lightweight way of managing CDF attribute
25
- creation and validation.
26
-
27
- To use, you can load one or many global and variable attribute files:
28
-
29
- .. code::
30
-
31
- cdf_attr_manager = CdfAttributeManager(data_dir)
32
- cdf_attr_manager.load_global_attributes("global_attrs.yaml")
33
- cdf_attr_manager.load_global_attributes("instrument_global_attrs.yaml")
34
- cdf_attr_manager.load_variable_attributes("variable_attrs.yaml")
35
-
36
- Later files will overwrite earlier files if the same attribute is defined.
37
-
38
- You can then get the global and variable attributes:
39
-
40
- If you provide an instrument_id, it will also add the attributes defined under
41
- instrument_id. If this is not included, then only the attributes defined in the top
42
- level of the file are used.
43
-
44
- .. code::
45
-
46
- # Instrument ID is optional for refining the attributes used from the file
47
- global_attrs = cdf_attr_manager.get_global_attributes(instrument_id)
48
- variable_attrs = cdf_attr_manager.get_variable_attributes(variable_name)
49
-
50
- The variable and global attributes are validated against the schemas upon calling
51
- ``get_global_attributes`` and ``get_variable_attributes``.
52
-
53
- Parameters
54
- ----------
55
- data_dir : pathlib.Path
56
- The directory containing the schema and variable files (nominally config/).
57
-
58
- Attributes
59
- ----------
60
- source_dir : pathlib.Path
61
- The directory containing the schema and variable files - nominally config/
62
- """
63
-
64
- def __init__(self, data_dir: Path):
65
- """Initialize the CdfAttributeManager and read schemas from data_dir."""
66
- # TODO: Split up schema source and data source?
67
- self.source_dir = data_dir
68
-
69
- # TODO: copied from hermes_core. Currently we can use default schema, but
70
- # We should add some way of extending the schema and remove all the HERMES
71
- # specific stuff
72
- # Data Validation, Complaiance,
73
- self.global_attribute_schema = self._load_default_global_attr_schema()
74
-
75
- # Data Validation and Compliance for Variable Data
76
- self.variable_attribute_schema = self._load_default_variable_attr_schema()
77
-
78
- # Load Default IMAP Global Attributes
79
- self._global_attributes = CdfAttributeManager._load_yaml_data(
80
- self.source_dir / DEFAULT_GLOBAL_CDF_ATTRS_FILE
81
- )
82
- self._variable_attributes: dict = {}
83
-
84
- def _load_default_global_attr_schema(self) -> yaml:
85
- """
86
- Load the default global schema from the source directory.
87
-
88
- Returns
89
- -------
90
- dict
91
- The dict representing the global schema.
92
- """
93
- default_schema_path = (
94
- self.source_dir / "shared" / DEFAULT_GLOBAL_CDF_ATTRS_SCHEMA_FILE
95
- )
96
- # Load the Schema
97
- return CdfAttributeManager._load_yaml_data(default_schema_path)
98
-
99
- def _load_default_variable_attr_schema(self) -> yaml:
100
- """
101
- Load the default variable schema from the source directory.
102
-
103
- Returns
104
- -------
105
- dict
106
- The dict representing the variable schema.
107
- """
108
- default_schema_path = (
109
- self.source_dir / "shared" / DEFAULT_VARIABLE_CDF_ATTRS_SCHEMA_FILE
110
- )
111
- # Load the Schema
112
- return CdfAttributeManager._load_yaml_data(default_schema_path)
113
-
114
- # TODO Change Returning Any from function declared to return "dict[Any, Any]"
115
-
116
- def load_global_attributes(self, file_path: str) -> None:
117
- """
118
- Update the global attributes property with the attributes from the file.
119
-
120
- Calling this method multiple times on different files will add all the
121
- attributes from the files, overwriting existing attributes if they are
122
- duplicated.
123
-
124
- Parameters
125
- ----------
126
- file_path : str
127
- File path to load, under self.source_dir.
128
- """
129
- self._global_attributes.update(
130
- CdfAttributeManager._load_yaml_data(self.source_dir / file_path)
131
- )
132
-
133
- def add_global_attribute(self, attribute_name: str, attribute_value: str) -> None:
134
- """
135
- Add a single global attribute to the global attributes.
136
-
137
- This is intended only for dynamic global attributes which change per-file, such
138
- as Data_version. It is not intended to be used for static attributes, which
139
- should all be included in the YAML files.
140
-
141
- This will overwrite any existing value in attribute_name if it exists. The
142
- attribute must be in the global schema, or it will not be included as output.
143
-
144
- Parameters
145
- ----------
146
- attribute_name : str
147
- The name of the attribute to add.
148
- attribute_value : str
149
- The value of the attribute to add.
150
- """
151
- self._global_attributes[attribute_name] = attribute_value
152
-
153
- @staticmethod
154
- def _load_yaml_data(file_path: str | Path) -> yaml:
155
- """
156
- Load a yaml file from the provided path.
157
-
158
- Parameters
159
- ----------
160
- file_path : str | Path
161
- Path to the yaml file to load.
162
-
163
- Returns
164
- -------
165
- yaml
166
- Loaded yaml.
167
- """
168
- with open(file_path) as file:
169
- return yaml.safe_load(file)
170
-
171
- def get_global_attributes(self, instrument_id: str | None = None) -> dict:
172
- """
173
- Generate a dictionary global attributes based off the loaded schema and attrs.
174
-
175
- Validates against the global schema to ensure all required variables are
176
- present. It can also include instrument specific global attributes if
177
- instrumet_id is set.
178
-
179
- If an instrument_id is provided, the level and instrument specific
180
- attributes that were previously loaded using add_instrument_global_attrs will
181
- be included.
182
-
183
- Parameters
184
- ----------
185
- instrument_id : str
186
- The id of the CDF file, used to retrieve instrument and level
187
- specific global attributes. Suggested value is the logical_source_id.
188
-
189
- Returns
190
- -------
191
- output : dict
192
- The global attribute values created from the input global attribute files
193
- and schemas.
194
- """
195
- output = dict()
196
- for attr_name, attr_schema in self.global_attribute_schema.items():
197
- if attr_name in self._global_attributes:
198
- output[attr_name] = self._global_attributes[attr_name]
199
- # Retrieve instrument specific global attributes from the variable file
200
- elif (
201
- instrument_id is not None
202
- and attr_name in self._global_attributes[instrument_id]
203
- ):
204
- output[attr_name] = self._global_attributes[instrument_id][attr_name]
205
- elif attr_schema["required"] and attr_name not in self._global_attributes:
206
- # TODO throw an error
207
- output[attr_name] = None
208
-
209
- return output
210
-
211
- def load_variable_attributes(self, file_name: str) -> None:
212
- """
213
- Add variable attributes for a given filename.
214
-
215
- Parameters
216
- ----------
217
- file_name : str
218
- The name of the file to load from self.source_dir.
219
- """
220
- # Add variable attributes from file_name. Each variable name should have the
221
- # Required subfields as defined in the variable schema.
222
- raw_var_attrs = CdfAttributeManager._load_yaml_data(self.source_dir / file_name)
223
- var_attrs = raw_var_attrs.copy()
224
-
225
- self._variable_attributes.update(var_attrs)
226
-
227
- def get_variable_attributes(
228
- self, variable_name: str, check_schema: bool = True
229
- ) -> dict:
230
- """
231
- Get the attributes for a given variable name.
232
-
233
- It retrieves the variable from previously loaded variable definition files and
234
- validates against the defined variable schemas.
235
-
236
- Parameters
237
- ----------
238
- variable_name : str
239
- The name of the variable to retrieve attributes for.
240
-
241
- check_schema : bool
242
- Flag to bypass schema validation.
243
-
244
- Returns
245
- -------
246
- dict
247
- Information containing specific variable attributes
248
- associated with "variable_name".
249
- """
250
- # Case to handle attributes not in schema
251
- if check_schema is False:
252
- if variable_name in self._variable_attributes:
253
- return_dict: dict = self._variable_attributes[variable_name]
254
- return return_dict
255
- # TODO: throw an error?
256
- return {}
257
-
258
- output = dict()
259
- for attr_name in self.variable_attribute_schema["attribute_key"]:
260
- # Standard case
261
- if attr_name in self._variable_attributes[variable_name]:
262
- output[attr_name] = self._variable_attributes[variable_name][attr_name]
263
- # Case to handle DEPEND_i schema issues
264
- elif attr_name == "DEPEND_i":
265
- # DEFAULT_0 is not required, UNLESS we are dealing with
266
- # variable_name = epoch
267
- # Find all the attributes of variable_name that contain "DEPEND"
268
- variable_depend_attrs = [
269
- key
270
- for key in self._variable_attributes[variable_name].keys()
271
- if "DEPEND" in key
272
- ]
273
- # Confirm that each DEPEND_i attribute is unique
274
- if len(set(variable_depend_attrs)) != len(variable_depend_attrs):
275
- logging.warning(
276
- f"Found duplicate DEPEND_i attribute in variable "
277
- f"{variable_name}: {variable_depend_attrs}"
278
- )
279
- for variable_depend_attr in variable_depend_attrs:
280
- output[variable_depend_attr] = self._variable_attributes[
281
- variable_name
282
- ][variable_depend_attr]
283
- # TODO: Add more DEPEND_0 variable checks!
284
- # Case to handle LABL_PTR_i schema issues
285
- elif attr_name == "LABL_PTR_i":
286
- # Find all the attributes of variable_name that contain "LABL_PTR"
287
- variable_labl_attrs = [
288
- key
289
- for key in self._variable_attributes[variable_name].keys()
290
- if "LABL_PTR" in key
291
- ]
292
- for variable_labl_attr in variable_labl_attrs:
293
- output[variable_labl_attr] = self._variable_attributes[
294
- variable_name
295
- ][variable_labl_attr]
296
- # Case to handle REPRESENTATION_i schema issues
297
- elif attr_name == "REPRESENTATION_i":
298
- # Find all the attributes of variable_name that contain
299
- # "REPRESENTATION_i"
300
- variable_rep_attrs = [
301
- key
302
- for key in self._variable_attributes[variable_name].keys()
303
- if "REPRESENTATION" in key
304
- ]
305
- for variable_rep_attr in variable_rep_attrs:
306
- output[variable_rep_attr] = self._variable_attributes[
307
- variable_name
308
- ][variable_rep_attr]
309
- # Validating required schema
310
- elif (
311
- self.variable_attribute_schema["attribute_key"][attr_name]["required"]
312
- and attr_name not in self._variable_attributes[variable_name]
313
- ):
314
- logging.warning(
315
- "Required schema '"
316
- + attr_name
317
- + "' attribute not present for "
318
- + variable_name
319
- )
320
- output[attr_name] = ""
321
-
322
- return output
@@ -1,246 +0,0 @@
1
- DOI:
2
- description: >
3
- DOI is a persistent Unique Digital Identifier with the form
4
- https://doi.org/<PREFIX>/<SUFFIX> with the <PREFIX> identifying the DOI
5
- registration authority and the <SUFFIX> identifying the dataset. The DOI should point to
6
- a landing page for additional information about the dataset. DOIs are typically created by
7
- the SPASE naming authority or archive.
8
- default: null
9
- required: false # NOT Required in ISTP Guide (Recommended)
10
- validate: true # include in validation
11
- overwrite: false
12
- Data_level:
13
- description: >
14
- This attribute is used in file name creation and records the level of processsing done
15
- on the dataset. For HERMES the following are valid values:
16
- - l0>Level 0
17
- - l1>Level 1
18
- - l2>Level 2
19
- - l3>Level 3
20
- - l4>Level 4
21
- - ql>Quicklook
22
- default: null
23
- required: true # NOT Required in ISTP Guide (Derived)
24
- validate: false
25
- overwrite: true
26
- Data_product_descriptor:
27
- description: >
28
- This is an optional field that may not be needed for all products. Where it is used, identifier
29
- should be short (e.q. 3-8 characters) descriptors that are helpful to end- users. If a
30
- descriptor contains multiple components, underscores are used to separate those components.
31
- default: null
32
- required: false # NOT Required in ISTP Guide (Derived)
33
- validate: false
34
- overwrite: true
35
- Data_type:
36
- description: >
37
- This attribute is used by CDF file writing software to create a filename. It is a
38
- combination of the following filename components: mode, data level, and optional data
39
- product descriptor.
40
- default: null
41
- required: false # NOT Required in ISTP Guide (Derived)
42
- validate: false
43
- overwrite: true
44
- Data_version:
45
- description: >
46
- This attribute identifies the version of a particular CDF data file.
47
- default: null
48
- required: true
49
- validate: true
50
- overwrite: false
51
- Descriptor:
52
- description: >
53
- This attribute identifies the name of the instrument or sensor that collected the data. Both
54
- a long name and a short name are given. For any data file, only a single value is allowed.
55
- For HERMES, the following are valid values:
56
- - EEA>Electron Electrostatic Analyzer
57
- - MERIT>Miniaturized Electron pRoton Telescope
58
- - NEMISIS> Noise Eliminating Magnetometer In a Small Integrated System
59
- - SPAN-I>Solar Probe Analyzer for Ions
60
- default: null
61
- required: true
62
- validate: true
63
- overwrite: false
64
- Discipline:
65
- description: >
66
- This attribute describes both the science discipline and sub discipline. For HERMES,
67
- this value should always be "Space Physics>Magnetospheric Science."
68
- default: Space Physics>Magnetospheric Science
69
- required: true
70
- validate: true
71
- overwrite: false
72
- File_naming_convention:
73
- description: >
74
- If File_naming_convention was not set, it uses default setting:
75
- source_datatype_descriptor_yyyyMMdd
76
- default: source_datatype_descriptor_yyyyMMdd
77
- required: false
78
- validate: false
79
- overwrite: true
80
- Generation_date:
81
- description: >
82
- Date stamps the creation of the file using the syntax yyyymmdd, e.g., "
83
- default: null
84
- required: false # NOT Required in ISTP Guide (Recommended)
85
- validate: true
86
- overwrite: true
87
- HTTP_LINK:
88
- description: >
89
- The 'HTTP_LINK', 'LINK_TEXT', and 'LINK_TITLE' attributes store the URL with a
90
- description of this dataset at the HERMES SDC. The use of HTTP_LINK attribute requires
91
- the existence and equal number of corresponding LINK_TEXT and LINK_TITLE attributes.
92
- If text is not needed for these attributes, use an empty string "".
93
- default: null
94
- required: false # NOT Required in ISTP Guide (Recommended)
95
- validate: true
96
- overwrite: false
97
- Instrument_mode:
98
- description: >
99
- TBS
100
- default: null
101
- required: false # NOT Required in ISTP Guide (Derived)
102
- validate: false
103
- overwrite: false
104
- Instrument_type:
105
- description: >
106
- This attribute is used to facilitate making choices of instrument type. More than one entry
107
- is allowed. Acceptable values for HERMES include:
108
- - Magnetic Fields (space)
109
- - Particles (space)
110
- - Plasma and Solar Wind
111
- - Ephemeris -> Ephemeris/Attitude/Ancillary
112
- default: null
113
- required: true
114
- validate: true
115
- overwrite: false
116
- LINK_TEXT:
117
- description: >
118
- The 'HTTP_LINK', 'LINK_TEXT', and 'LINK_TITLE' attributes store the URL with a
119
- description of this dataset at the HERMES SDC. The use of HTTP_LINK attribute requires
120
- the existence and equal number of corresponding LINK_TEXT and LINK_TITLE attributes.
121
- If text is not needed for these attributes, use an empty string "".
122
- default: null
123
- required: false # NOT Required in ISTP Guide (Recommended)
124
- validate: true
125
- overwrite: false
126
- LINK_TITLE:
127
- description: >
128
- The 'HTTP_LINK', 'LINK_TEXT', and 'LINK_TITLE' attributes store the URL with a
129
- description of this dataset at the HERMES SDC. The use of HTTP_LINK attribute requires
130
- the existence and equal number of corresponding LINK_TEXT and LINK_TITLE attributes.
131
- If text is not needed for these attributes, use an empty string "".
132
- default: null
133
- required: false # NOT Required in ISTP Guide (Recommended)
134
- validate: true
135
- overwrite: false
136
- Logical_file_id:
137
- description: >
138
- This attribute stores the name of the CDF file but without the
139
- file extension (e.g. ".cdf"). This attribute is required to avoid loss of the original source
140
- in the case of accidental (or intentional) renaming.
141
- default: null
142
- required: true
143
- validate: true
144
- overwrite: true
145
- Logical_source:
146
- description: >
147
- This attribute determines the file naming convention in the SKT Editor and is used by
148
- CDA Web. It is composed of the following values:
149
- - source_name - (e.g. spacecraft identifier)
150
- - descriptor - (e.g. instrument identifier - see Section Error! Reference source not
151
- found.)
152
- - data_type - (e.g. mode, data level, and optional data product descriptor - value
153
- come from 'Data_type' attribute)
154
- default: null
155
- required: true
156
- validate: true
157
- overwrite: true
158
- Logical_source_description:
159
- description: >
160
- This attribute writes out the full words associated with the encrypted Logical_source
161
- above, e.g., "Level 1 Dual Electron Spectrometer Survey Data". Users on CDAWeb see
162
- this value on their website.
163
- default: null
164
- required: true
165
- validate: true
166
- overwrite: true
167
- MODS:
168
- description: >
169
- This attribute is an SPDF standard global attribute, which is used to denote the history of
170
- modifications made to the CDF data set. The MODS attribute should contain a
171
- description of all significant changes to the data set, essentially capturing a log of high-
172
- level release notes. This attribute can have as many entries as necessary and should be
173
- updated if the Interface Number ("X") of the version number changes.
174
- default: null
175
- required: false # NOT Required in ISTP Guide (Recommended)
176
- validate: true
177
- overwrite: false
178
- Mission_group:
179
- description: >
180
- This attribute has a single value and is used to facilitate making choices of source through
181
- CDAWeb. This value should be "HERMES."
182
- default: HERMES
183
- required: true
184
- validate: true
185
- overwrite: false
186
- PI_affiliation:
187
- description: >
188
- This attribute value should include the HERMES mission PI affiliation followed by a
189
- comma-separated list of any Co-I affiliations that are responsible for this particular
190
- dataset. The following are valid HERMES values, of which the abbreviations should be
191
- used exclusively within this attribute value, and the full text of the affiliation included in
192
- the general 'text' attribute as it is used solely in plot labels.
193
- - GSFC - Goddard Space Flight Center
194
- - UCB - University of California, Berkeley
195
- - SSL - Space Sciences Laboratory, UCB
196
- - UM - University of Michigan
197
- default: null
198
- required: true
199
- validate: true
200
- overwrite: false
201
- PI_name:
202
- description: >
203
- This attribute value should include first initial and last name of the HERMES mission PI
204
- followed by a comma-separated list of any Co-Is that are responsible for this particular
205
- dataset.
206
- default: null
207
- required: true
208
- validate: true
209
- overwrite: false
210
- Project:
211
- description: >
212
- This attribute identifies the name of the project and indicates ownership. For HERMES,
213
- this value should be "STP>Solar-Terrestrial Physics".
214
- default: STP>Solar-Terrestrial Physics
215
- required: true
216
- validate: true
217
- overwrite: false
218
- Source_name:
219
- description: >
220
- This attribute identifies the observatory where the data originated. The following are
221
- valid values for HERMES:
222
- - HERMES>Heliophysics Environmental and Radiation Measurement Experiment Suite
223
- default: HERMES>Heliophysics Environmental and Radiation Measurement Experiment Suite
224
- required: true
225
- validate: true
226
- overwrite: false
227
- Start_time:
228
- description: >
229
- The start time of the contained data given in YYYYMMDD_hhmmss
230
- default: null
231
- required: false # NOT Required in ISTP Guide (Derived)
232
- validate: false
233
- overwrite: true
234
- TEXT:
235
- description: >
236
- This attribute is an SPDF standard global attribute, which is a text description of the
237
- experiment whose data is included in the CDF. A reference to a journal article(s) or to a
238
- World Wide Web page describing the experiment is essential and constitutes the
239
- minimum requirement. A written description of the data set is also desirable. This
240
- attribute can have as many entries as necessary to contain the desired information.
241
- Typically, this attribute is about a paragraph in length and is not shown on CDAWeb.
242
- CDAWeb is the web portal for access to SPDF data, available at https://cdaweb.gsfc.nasa.gov.
243
- default: null
244
- required: true
245
- validate: true
246
- overwrite: false