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 |
|---|---|---|
lengths |
dict[str | int, _SizeAttr]
|
Maps each named dimension (e.g. "time", "pitch_angle", "energy") to the variable name and size that were first observed for that dimension. |
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 | |
el_paso.typing.DailyLEORBStrategy
Bases: MonthlyRBStrategy
Save PRBEM-standard LEO radiation-belt data into one NetCDF file per day.
This strategy extends MonthlyRBStrategy but splits the output into daily
files instead of monthly ones, and fixes the output variable list and file
format (NetCDF) for low-Earth-orbit radiation-belt missions.
Source code in el_paso/saving_strategies/daily_leo_rb_strategy.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 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 74 75 76 77 78 | |
el_paso.typing.DailyWaveStrategy
Bases: SavingStrategy
Save wave and density data into one NetCDF (.nc) file per day.
Appending to existing files is not yet implemented for this strategy.
Source code in el_paso/saving_strategies/daily_wave_strategy.py
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 | |
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.FileWriter
Bases: Protocol
Callable interface for writing standardized EL-PASO data to disk.
Source code in el_paso/typing.py
168 169 170 171 172 173 174 175 176 177 178 | |
el_paso.typing.GFZMetaData
Bases: DatasetMetadata
Metadata container for GFZStandard.
Attributes:
| Name | Type | Description |
|---|---|---|
datetime |
VariableMetadata
|
VariableMetadata |
time |
VariableMetadata
|
VariableMetadata |
energy_channels |
VariableMetadata
|
VariableMetadata |
alpha_local |
VariableMetadata
|
VariableMetadata |
alpha_eq_model |
VariableMetadata
|
VariableMetadata |
alpha_eq_real |
VariableMetadata
|
VariableMetadata |
InvMu |
VariableMetadata
|
VariableMetadata |
InvMu_real |
VariableMetadata
|
VariableMetadata |
InvK |
VariableMetadata
|
VariableMetadata |
InvV |
VariableMetadata
|
VariableMetadata |
Lstar |
VariableMetadata
|
VariableMetadata |
Lm |
VariableMetadata
|
VariableMetadata |
Flux |
VariableMetadata
|
VariableMetadata |
PSD |
VariableMetadata
|
VariableMetadata |
MLT |
VariableMetadata
|
VariableMetadata |
B_eq |
VariableMetadata
|
VariableMetadata |
B_total |
VariableMetadata
|
VariableMetadata |
xGEO |
VariableMetadata
|
VariableMetadata |
P |
VariableMetadata
|
VariableMetadata |
R0 |
VariableMetadata
|
VariableMetadata |
density |
VariableMetadata
|
VariableMetadata |
Source code in el_paso/dataset/metadata.py
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 | |
el_paso.typing.GFZStandard
Bases: DataStandard[GFZVarNames]
A data standard used historically at the GFZ German Research Centre for Geosciences.
This standard defines rules for a set of canonical variable names by converting them to correct units and checking their array dimensions for consistency. It is tailored for compatibility with historical GFZ datasets and internal workflows.
Source code in el_paso/data_standards/gfz_standard.py
13 14 15 16 17 18 19 20 21 22 23 24 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 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 | |
el_paso.typing.GFZStrategy
Bases: SavingStrategy
A concrete saving strategy for saving data based on the satellite mission into separate monthly files.
This strategy implements the data standard used at GFZ in the past.
It organizes the output files into a specific directory structure
(e.g., base_path/MISSION/SATELLITE/Processed_Mat_Files/) and standardizes
variables to specific units and dimensions before saving. The data is saved
in .mat format.
Attributes:
| Name | Type | Description |
|---|---|---|
output_files |
list[OutputFile]
|
Pre-defined list of files to be saved, each with a specific set of variables. |
base_data_path |
Path
|
The root directory for all saved data. |
mission |
str
|
The name of the space mission (e.g., "MMS"). |
satellite |
str
|
The name of the satellite (e.g., "MMS1"). |
instrument |
str
|
The name of the instrument. |
kext |
str
|
A model-related identifier, with "TS04" being mapped to "T04s" for backward compatibility. |
Methods:
| Name | Description |
|---|---|
__init__ |
Initializes the strategy with file paths and metadata. |
standardize_variable |
Standardizes variables to specific units and dimensions based on their name. |
get_time_intervals_to_save |
Splits the given time range into a list of monthly intervals. |
get_file_path |
Generates a complete file path based on the mission, satellite, and date. |
append_data |
Appends new data to an existing file by concatenating NumPy arrays based on time. |
Source code in el_paso/saving_strategies/gfz_strategy.py
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 | |
el_paso.typing.MonthlyRBStrategy
Bases: SavingStrategy
Save PRBEM-standard data into one monthly file per interval.
The strategy supports NetCDF, CDF, HDF5, and MATLAB output through a format dispatch table. Existing files can be appended by loading the current file, replacing overlapping timestamps with the new data block, and atomically rewriting the merged data.
Source code in el_paso/saving_strategies/monthly_rb_strategy.py
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 | |
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
38 39 40 41 42 43 44 45 46 47 48 49 | |
el_paso.typing.PRBEMMetaData
Bases: DatasetMetadata
Metadata container for PRBEMStandard.
Attributes:
| Name | Type | Description |
|---|---|---|
datetime |
VariableMetadata
|
VariableMetadata |
Epoch |
VariableMetadata
|
VariableMetadata |
FEDU |
VariableMetadata
|
VariableMetadata |
FEDO |
VariableMetadata
|
VariableMetadata |
FEIU |
VariableMetadata
|
VariableMetadata |
Energy_FEDU |
VariableMetadata
|
VariableMetadata |
Alpha |
VariableMetadata
|
VariableMetadata |
Alpha_Eq |
VariableMetadata
|
VariableMetadata |
Position |
VariableMetadata
|
VariableMetadata |
B_Calc |
VariableMetadata
|
VariableMetadata |
B_Eq |
VariableMetadata
|
VariableMetadata |
L_star |
VariableMetadata
|
VariableMetadata |
I |
VariableMetadata
|
VariableMetadata |
MLT |
VariableMetadata
|
VariableMetadata |
L_m |
VariableMetadata
|
VariableMetadata |
PSD |
VariableMetadata
|
VariableMetadata |
R_Eq |
VariableMetadata
|
VariableMetadata |
InvMu |
VariableMetadata
|
VariableMetadata |
InvK |
VariableMetadata
|
VariableMetadata |
Source code in el_paso/dataset/metadata.py
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 | |
el_paso.typing.PRBEMStandard
Bases: DataStandard[PRBEMName]
A data standard of the Panel for Radiation Belt Environment Modeling (PRBEM).
This class defines and applies a specific set of data standards for variables defined by the PRBEM. It standardizes variables by converting them to canonical units and performing consistency checks on their dimensions and shapes, ensuring they conform to the expected format for each standard name.
Source code in el_paso/data_standards/prbem_standard.py
16 17 18 19 20 21 22 23 24 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 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 | |
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 |
Appends data to an existing output file by merging it with newly computed data and rewriting the file. Supported for any format with a registered loader/writer. |
Source code in el_paso/saving_strategy.py
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 | |
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.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 | |