jgieseler / solarmach

Python package of the multi-spacecraft longitudinal configuration plotter Solar-MACH
https://solarmach.readthedocs.io
BSD 3-Clause "New" or "Revised" License
26 stars 6 forks source link

Make effective use of `sunpy.time.parse_time` #49

Closed wtbarnes closed 2 months ago

wtbarnes commented 3 months ago

The function sunpy.time.parse_time provides a way to parse many different time inputs into an astropy.time.Time object. I see that this function is used once in the sc_distance function. I would recommend that this function also be used when parsing date inputs in the SolarMach object. This would greatly simplify any later handling of the date as one can program against a single astropy.time.Time object rather than an ambiguous representation of that date.

jgieseler commented 3 months ago

Yes, definitely! The current status is just due to the fact that I stumbled upon sunpy.time.parse_time just recently, while including sc_distance. Haven't found the time to replace it at other places...

This is actually a good first issue, in case someone is interested!

jgieseler commented 3 months ago

Well, I couldn't let this issue rest, and fixed it with #54

Usage of dateutil.parser.parse() in get_sw_speed() is now replaced with sunpy.time.parse_time().datetime, and the input datetime to the SolarMACH object is directly after initialization send to sunpy.time.parse_time and converted to an astropy.time.Time object.