USRA-STI / gdt-fermi

Gamma-ray Data Tools - Fermi mission components
Apache License 2.0
2 stars 3 forks source link

Bug fix for McIlwain L reported by standard_title() #17

Closed joshuarwood closed 7 months ago

joshuarwood commented 7 months ago

This is a quick bug fix to address incorrectly displayed McIlwain L within the standard_plot() function of the FermiEarthPlot class. I add accounting for North/South and East/West when converting lat/lon strings to floating point values passed to the McIlwain calculation. See Issue https://github.com/USRA-STI/gdt-fermi/issues/16 for more details on the source of the issue.

joshuarwood commented 7 months ago

Here are the resulting McIlwain plots made with this pull request for 3 different burst numbers. They appear to be correct. Example code:

import glob
import matplotlib.pyplot as plt

from gdt.missions.fermi.time import Time
from gdt.missions.fermi.plot import FermiEarthPlot
from gdt.missions.fermi.gbm.finders import TriggerFtp
from gdt.missions.fermi.gbm.trigdat import Trigdat

# download trigdat file
bn = "231003905"
#bn = "231025283"
#bn = "231012231"
TriggerFtp(bn).get_trigdat(".")

trigdat = Trigdat.open(glob.glob(f"glg_trigdat_all_bn{bn}_*.fit")[0])
trigtime = Time(trigdat.trigtime, format='fermi')

mcilwain_plot = FermiEarthPlot(mcilwain=True)
mcilwain_plot.add_spacecraft_frame(trigdat.poshist, trigtime=trigtime)
mcilwain_plot.standard_title()

plt.gcf().set_figheight(5)
plt.savefig(bn + ".png", dpi=300)
plt.show()
![231003905](https://github.com/USRA-STI/gdt-fermi/assets/26443181/da9b9d6b-96aa-4040-87f7-54ab497e304c)
![231012231](https://github.com/USRA-STI/gdt-fermi/assets/26443181/fc1646cd-7d24-4f40-ba54-754c4ba8d467)
![231025283](https://github.com/USRA-STI/gdt-fermi/assets/26443181/61de7eec-239f-44df-a525-70e6493b0569)