When I used real solar wind parameters for a comparison between IDL and PySPEDAS geopack calculations, the IDL and Python results for the T01 model disagreed by several nT. A bit of trial and error showed that the issue had something to do with the IMF BY and BZ parameters. For some values, IDL and Python agreed; for others, they didn't match. I eventually tracked it down to this code in the geopack t01 routine to calculate the IMF clock angle:
theta=np.arctan2(byimf,bzimf)
if theta <= 0: theta = 2*np.pi
This replaces theta with 2 pi if it's negative...it should be adding 2 pi.
if theta <= 0: theta += 2*np.pi
When I made this change locally, the IDL and Python results agreed within the established tolerance. I need to create a PR and hope Sheng Tian can get a patch out quickly.
When I used real solar wind parameters for a comparison between IDL and PySPEDAS geopack calculations, the IDL and Python results for the T01 model disagreed by several nT. A bit of trial and error showed that the issue had something to do with the IMF BY and BZ parameters. For some values, IDL and Python agreed; for others, they didn't match. I eventually tracked it down to this code in the geopack t01 routine to calculate the IMF clock angle:
This replaces theta with 2 pi if it's negative...it should be adding 2 pi.
When I made this change locally, the IDL and Python results agreed within the established tolerance. I need to create a PR and hope Sheng Tian can get a patch out quickly.