I am using numpy.genfromtxt() to load time data in string format HH:MM:SS.S, and wishing to modify it according to a converter function (translating string UTC-time into float decimal hours). The code generates errors at the end of the file, where the converter tries to read in footer lines even when set to skip.
Here is my code:
utc_converter= lambda hhmmss: int(hhmmss.split(':')[0])+ int(hhmmss.split(':')[1])/60 + float(hhmmss.split(':')[2])/3600
testtime= np.genfromtxt(path_to_gps, dtype=None, skip_header=headerlines, skip_footer=2, usecols=(9), converters={9: utc_converter}, encoding='utf-8')
Generates the error:
Converter #0 is locked and cannot be upgraded: (occurred line #18859 for value '(21910')
Line #18859 is indeed a footer message. When no converter is used, the data is read in correctly without including the footer. When the footer lines are manually deleted from the data file, and the code modified accordingly (skip_footer=0), the conversion works fine.
How can I solve this?