Typing
el_paso.typing.ConsistencyCheck
dataclass
A utility class for checking the consistency of data dimensions.
This class helps verify that multiple variables saved to a file have the same length for shared dimensions (e.g., time, pitch angle, energy).
Attributes:
| Name | Type | Description |
|---|---|---|
len_time |
_SizeAttr | None
|
Stores the size of the time dimension from the first variable checked. |
len_pitch_angle |
_SizeAttr | None
|
Stores the size of the pitch angle dimension from the first variable checked. |
len_energy |
_SizeAttr | None
|
Stores the size of the energy dimension from the first variable checked. |
Source code in el_paso/data_standard.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
el_paso.typing.DataStandard
Abstract base class for data standardization.
Source code in el_paso/data_standard.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
el_paso.typing.DensityNetCDFStrategy
Bases: MonthlyRBStrategy
Saving strategy for writing plasma density and related data to monthly NetCDF files.
This strategy extends MonthlyRBStrategy but implements saving to the NetCDF
format (.nc), primarily targeting the time-series of density, position, and
coordinate variables (e.g., L-star, MLT).
The variables included and their dependencies are configured based on whether the data is associated with the "RBSP" satellites or "Other".
Attributes:
| Name | Type | Description |
|---|---|---|
output_files |
list[OutputFile]
|
List of file configurations to be produced. |
file_path |
Path
|
Base path for output files (inherited). |
dependency_dict |
dict[str, list[str]]
|
Defines the NetCDF dimension names (e.g., 'time', 'xGEO_components') that each variable depends on. |
Source code in el_paso/saving_strategies/density_netcdf_strategy.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
el_paso.typing.FileLoader
module-attribute
Callable that loads a data file into a dictionary keyed by standard variable names.
el_paso.typing.FileWriter
Bases: Protocol
Callable interface for writing standardized EL-PASO data to disk.
Source code in el_paso/typing.py
154 155 156 157 158 159 160 161 162 163 164 | |
el_paso.typing.GFZVarNames
module-attribute
GFZVarNames: TypeAlias = Literal[
"time",
"xGEO",
"energy_channels",
"Flux",
"alpha_local",
"alpha_eq_model",
"PSD",
"MLT",
"MLat",
"Lstar",
"Lm",
"B_eq",
"B_sat",
"B_total",
"R0",
"InvMu",
"InvK",
"alpha_local_range",
"alpha_eq_range",
"alpha_lc",
"alpha_lc_eq",
"geo_alt",
"geo_lat",
"geo_lon",
"freq",
"ellipticity",
"planarity",
"freq_bw",
"BB",
"wave_wna",
]
Variable names used by the GFZ output standard.
el_paso.typing.InternalName
module-attribute
InternalName: TypeAlias = (
Literal[
"FEDU",
"FEDO",
"FEIU",
"Energy_FEDU",
"Energy_FEIU",
"Epoch",
"Alpha",
"Alpha_range",
"Alpha_Eq_range",
"Position",
"MLat",
"PSD",
"Position_geo_alt",
"Position_geo_lat",
"Position_geo_lon",
"Number_density",
"Wave_normal_angle",
"Wave_ellipticity",
"Wave_planarity",
"Wave_frequency",
"Magnetic_Power_Spectral_Density",
"Wave_frequency_bandwidth",
"B_total_obs",
]
| MagFieldVarTypes
)
el_paso.typing.MFSFormats
module-attribute
File formats supported by MonthlyRBStrategy.
el_paso.typing.MagFieldVarTypes
module-attribute
MagFieldVarTypes: TypeAlias = Literal[
"Alpha_LC_Eq",
"Alpha_LC",
"B_Calc",
"B_fofl",
"B_Eq",
"B_mirr",
"xGEO_Eq",
"MLT",
"R_Eq",
"MLT_Eq",
"L_star",
"L_m",
"Alpha_Eq",
"InvMu",
"InvK",
"I",
]
el_paso.typing.MagInputKeys
module-attribute
MagInputKeys: TypeAlias = Literal[
"Kp",
"Dst",
"dens",
"velo",
"Pdyn",
"ByIMF",
"BzIMF",
"G1",
"G2",
"G3",
"W1",
"W2",
"W3",
"W4",
"W5",
"W6",
"AL",
]
el_paso.typing.MagneticFieldLiteral
module-attribute
MagneticFieldLiteral: TypeAlias = Literal[
"T89",
"T01",
"T01s",
"TS04",
"TS05",
"T04s",
"T96",
"OP77Q",
"OP77",
]
Supported magnetic-field model identifiers.
el_paso.typing.OutputFile
Bases: NamedTuple
Represents an output file with its name and a list of variable names to save.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The name of the output file. |
names_to_save |
list[str]
|
List of variable names to be saved in the output file. |
save_incomplete |
bool
|
If True, allows saving even if some variables are missing. |
Source code in el_paso/saving_strategy.py
35 36 37 38 39 40 41 42 43 44 45 46 | |
el_paso.typing.PRBEMName
module-attribute
PRBEMName: TypeAlias = InternalName
PRBEM-standard variable names, which match EL-PASO internal names.
el_paso.typing.SavedDataDict
module-attribute
SavedDataDict: TypeAlias = dict[
InternalName | Literal["metadata"], Any
]
Dictionary passed to saving backends, keyed by internal variable name or metadata.
el_paso.typing.SavingStrategy
Bases: ABC
Abstract base class for defining strategies to save output files with specific time intervals and variables.
Attributes:
| Name | Type | Description |
|---|---|---|
output_files |
list[OutputFile]
|
List of output files to be managed by the saving strategy. |
data_standard |
DataStandard[StandardName]
|
The data standard that defines the variable naming convention. |
base_data_path |
Path
|
The base path where output files will be saved. |
satellite |
str
|
The name of the satellite for which data is being saved. |
mission |
str
|
The name of the mission for which data is being saved. |
instrument |
str
|
The name of the instrument for which data is being saved. |
mag_field |
MagneticFieldLiteral
|
The magnetic field model used for saving data, if applicable. |
Methods:
| Name | Description |
|---|---|
get_time_intervals_to_save |
Abstract method to determine the time intervals for saving data between start_time and end_time. |
get_file_path |
Abstract method to generate the file path for a given time interval and output file. |
standardize_variable |
Abstract method to standardize a variable before saving, possibly renaming or formatting it. |
get_target_variables |
Selects and prepares variables to be saved in the output file, optionally truncating them to a time range. |
save_single_file |
Saves the provided dictionary to a file in the specified format (.mat, .h5, .nc, .cdf), optionally appending data. |
append_data |
Abstract method to append data to an existing file; must be implemented by subclasses. All subclasses may not need it, so it is not defined in the base class. |
Source code in el_paso/saving_strategy.py
49 50 51 52 53 54 55 56 57 58 59 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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
el_paso.typing.SingleFileStrategy
Bases: SavingStrategy
A concrete saving strategy that saves all data to a single file.
This strategy implements the SavingStrategy abstract methods to manage saving all variables
for the entire time range into a single output file. It is a simple, non-partitioning approach.
Supports multiple file formats including MATLAB (.mat), HDF5 (.h5), NetCDF4 (.nc), and CDF (.cdf).
Users can also register custom format writers for additional file formats.
Attributes:
| Name | Type | Description |
|---|---|---|
file_path |
Path
|
The path to the single output file where all data will be saved. |
output_files |
list[OutputFile]
|
List of output files to be managed. |
Methods:
| Name | Description |
|---|---|
__init__ |
Initializes the strategy with file path and optional custom writers. |
get_time_intervals_to_save |
Returns the entire time range as a single interval. |
get_file_path |
Always returns the pre-defined single file path. |
standardize_variable |
Passes the variable through without any standardization. |
save_single_file |
Saves data to a file in the specified format using the dispatch table. |
register_writer |
Registers a custom format writer for a file extension. |
Supported Formats
- .mat: MATLAB format using scipy.io.savemat
- .h5: HDF5 format using h5py with optional gzip compression
- .nc: NetCDF4 format using netCDF4 with optional compression
- .cdf: CDF (Common Data Format) using cdflib with gzip compression
- Custom: Any user-defined format via register_writer() or format_writers parameter
Example
def write_custom(file_path: Path, data_dict: dict[str, Any]) -> None:
# Custom writer implementation
pass
strategy = SingleFileStrategy("output.myformat",format_writers={".myformat": write_custom})
ep.save(variables, saving_strategy=strategy, ...)
Source code in el_paso/saving_strategies/single_file_strategy.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | |
el_paso.typing.StandardName
module-attribute
StandardName: TypeAlias = (
PRBEMName | GFZVarNames | Literal["metadata"]
)
Any standard-facing variable name accepted by EL-PASO data standards.
el_paso.typing.TimeInterval
module-attribute
Inclusive start and end datetimes for a processing or saving interval.
el_paso.typing.Variable
Variable class holding data and metadata.
Attributes:
| Name | Type | Description |
|---|---|---|
_data |
NDArray[generic]
|
The numerical data of the variable. |
metadata |
VariableMetadata
|
An instance of |
Source code in el_paso/variable.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | |
el_paso.typing.VariableInfo
Bases: NamedTuple, Generic[T_co]
A named tuple to store information about a variable in a data standard.
Source code in el_paso/data_standard.py
29 30 31 32 33 34 35 | |
el_paso.typing.VariableMetadata
dataclass
A class holding the metadata of a variable.
Attributes:
| Name | Type | Description |
|---|---|---|
unit |
UnitBase
|
The unit of the variable. Defaults to
|
original_cadence_seconds |
float
|
The original cadence of the data in seconds. Defaults to 0. |
source_files |
list[str]
|
The list of SourceFiles, which variable contains data from. Defaults to an empty list. |
description |
str
|
The description of the variable explaining what kind of data this variable contains. Defaults to "". |
processing_notes |
str
|
The processing notes of the variable explaining all steps done to achieve the final result. Defaults to "". |
standard_name |
str
|
The name of the standard variable this variable complies to. Defaults to "". |
Source code in el_paso/variable.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
el_paso.typing.VariableRequest
module-attribute
VariableRequest = Sequence[
tuple[
MagFieldVarTypes,
MagneticFieldLiteral | MagneticField,
]
]
Type alias for a request to compute magnetic field variables, consisting of a sequence of tuples where each tuple specifies the variable type and the magnetic field model to use for its computation.
el_paso.typing.ExtractionInfo
dataclass
Store metadata required to extract a variable from a source file.
Attributes:
| Name | Type | Description |
|---|---|---|
name_or_column |
str | int
|
Name of the variable or column to extract from the source file. |
unit |
UnitBase
|
Physical unit associated with the extracted variable. |
is_time_dependent |
bool
|
Whether the variable is time-dependent. If If |
result_key |
str | None
|
Key to use for the extracted variable in the resulting variables dictionary. If |
dependent_variables |
list[str] | None
|
Names of variables that the extracted variable depends on. This is mainly used for JSON extraction to determine how extracted data should be reshaped. |
np_dtype |
DTypeLike | None
|
Optional NumPy dtype used to cast the extracted data. If |
Source code in el_paso/extract_variables_from_files.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |