we are using the library for a few months, but we have now encountered a problem during the loading a specific file.
The error is “Failed to read enough bytes from COMTRADE BINARY file for a record as defined by schema - possible schema/data file mismatch or file corruption”.
I would like to upload the comtrade file, but as a new user I cannot upload it.
Someone can give me some information on the error or can show me how to upload the file?
It looks like the data file has 64 extra bytes at the end, the contents of which consists of a repeating the value of
26 over and over again all the way to the end of the file. This is throwing off the parser because it reads past the end of the COMTRADE record (as specified by the number of samples in the schema file), finds a chunk of data that’s 64 bytes, realizes that this doesn’t match the size of the next record (130 bytes in this case), and figures that some assumption must have been violated when decoding this file. But it’s not entirely sure what assumption was violated so it throws up its hands and reports the error you described in your post.
This error can be avoided by simply truncating the data file to the correct size or, perhaps more generally, by modifying the COMTRADE parser to provide an option for handling this edge case more gracefully.
thank you very much for the support.
I will analyze the best solution in order to resolve the problem.