Skip to content

Make InvMu/PSD/flux dependency resolution species-aware and fixing PSD-unit bug - #74

Draft
Jaskirat121 wants to merge 7 commits into
GFZ:mainfrom
Jaskirat121:proton_scripts
Draft

Make InvMu/PSD/flux dependency resolution species-aware and fixing PSD-unit bug#74
Jaskirat121 wants to merge 7 commits into
GFZ:mainfrom
Jaskirat121:proton_scripts

Conversation

@Jaskirat121

@Jaskirat121 Jaskirat121 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

InvMu, PSD, and several saved output files (GFZStrategy's 'flux' and 'alpha_and_energy', MonthlyRBStrategy's netCDF output) hardcoded a dependency on Energy_FEDU / FEDU, even when saving proton data (Energy_FPDU / FPDU). Proton pipelines would fail validation entirely, or silently skip/empty output files.

This introduces an "alternatives" concept to VariableInfo.dependencies and OutputFile.names_to_save: a dependency can now be a tuple of alternative names (e.g. ("Energy_FEDU", "Energy_FPDU")), resolved at save/load time to whichever one is actually present. This required threading an available_keys parameter through defined standards and datasets, all of which previously called get_dependencies()/names_to_save directly without resolving alternatives.

compute_phase_space_density() tagged its output with the SI unit but the actual computed values are in the standard convention (c/MeV/cm)^3, consistent with the (1e3/2.997e10) conversion factor already used in the PSD formula.

convert_to_unit() was a silent no-op at save time.So, defined the correct unit once (psd_natural_unit, in units.py) and uses it consistently at the point PSD is computed.

Jaskirat121 and others added 6 commits June 25, 2026 18:03
Add HOPE proton processing script for RBSP
Add MagEIS proton processing script for RBSP
Add RBSP RBSPICE proton processing script
InvMu, PSD, and several saved output files (GFZStrategy's 'flux' and 'alpha_and_energy', MonthlyRBStrategy's netCDF output) hardcoded a dependency on Energy_FEDU / FEDU, even when saving proton data (Energy_FPDU / FPDU). Proton pipelines would fail validation entirely, or silently skip/empty output files. This introduces an "alternatives" concept to VariableInfo.dependencies and OutputFile.names_to_save: a dependency can now be a tuple of alternative names (e.g. ("Energy_FEDU", "Energy_FPDU")), resolved at save/load time to whichever one is actually present. This required threading an available_keys parameter through defined standards and datasets, all of which previously called get_dependencies()/names_to_save directly without resolving alternatives.
compute_phase_space_density() tagged its output with the SI unit but the actual computed values are in the standard convention (c/MeV/cm)^3, consistent with the (1e3/2.997e10) conversion factor already used in the PSD formula.

convert_to_unit() was a silent no-op at save time.So, defined the correct unit once (psd_natural_unit, in units.py) and uses it consistently at the point PSD is computed.
@Jaskirat121 Jaskirat121 changed the title Make InvMu/PSD/flux dependency resolution species-aware Make InvMu/PSD/flux dependency resolution species-aware and fixing PSD-unit bug Aug 7, 2026
@sahiljhawar

Copy link
Copy Markdown
Contributor

@Jaskirat121 Just to make things easy, always keep your main branch in-sync with the upstream main branch. And always use a new branch to make PRs.

@sahiljhawar
sahiljhawar marked this pull request as draft August 7, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants