spedas / pyspedas

Python-based Space Physics Environment Data Analysis Software
https://pyspedas.readthedocs.io/
MIT License
147 stars 58 forks source link

Additional geopack test coverage needed #976

Closed jameswilburlewis closed 3 weeks ago

jameswilburlewis commented 1 month ago

Looking at a coverage report for our geopack tests, there are a few gaps that could be filled if we tested a few additional regions of interest:

T01 and T04 have special cases when the position is close to the Z axis: sqrt(x^2 + y^z)/sqrt(x^2 + y^2 + z^2) < 0.01

T96 defines a few regions of interest as follows:

    # Now let's define which of the four regions (high-lat., northern psbl,
    # plasma sheet, southern psbl) does the point (x,y,z) belong to:
    # tetr1s is greater than tetr1n. That's why high lat is when tetr1n<tetr1n-dtet0. -Sheng.
    loc = 0
    if (tet0 < tetr1n-dtet0) | (tet0 > tetr1s+dtet0):   loc = 1   # high-lat
    if (tet0 > tetr1n+dtet0) & (tet0 < tetr1s-dtet0):   loc = 2   # pl.sheet
    if (tet0 >= tetr1n-dtet0) & (tet0 <= tetr1n+dtet0): loc = 3 # north psbl
    if (tet0 >= tetr1s-dtet0) & (tet0 <= tetr1s+dtet0): loc = 4 # south psbl

We only seem to have coverage for loc = 2. TBD: what do the coordinates for the other three ROI look like?

When we identify some coordinates for these regions, we should generate test data showing the transitions in and transitions out, and look for any sharp discontinuities or differences between Python and IDL that might indicate a problem.

Maybe a fake circular orbit that passes over both GSM poles will hit most or all of these cases?

ChatGPT thinks "psbl" means "plasma sheet boundary layer":

North PSBL and South PSBL: These refer to the northern and southern parts of the Plasma Sheet Boundary Layer. The PSBL is critical for the dynamics of magnetospheric substorms and particle acceleration processes. It acts as a transitional region where there can be significant changes in the magnetic and electric field structures and plasma characteristics.

jameswilburlewis commented 1 month ago

Using positions lying on a 5 Re circle in the GSM YZ plane seems to hit all the T96 regions of interest. Between that set of positions and the THEMIS ephemeris used in the other tests, it looks like we've covered nearly all the geopack model code except for a small handful of edge cases where it's fairly obvious what the underlying logic is. Once we add the 5 Re circle case to the IDL code that generates the comparison data, with corresponding cases in the Python validation tests, we should be good to go.