0

I am trying to use python to read a .cdpg file. It was generated by the labview code. I do not have access to any information about the structure of the file. Using another post I have had some success, but the numbers are not making any sense. I do not know if my code is wrong or if my interpretation of the data is wrong.

The code I am using is:

import struct
with open(file, mode='rb') as file: # b is important -> binary
    fileContent = file.read()
   

ints = struct.unpack("i" * ((len(fileContent) -24) // 4), fileContent[20:-4])
print(ints)

The file is located here. Any guidance would be greatly appreciated.

Thank you,

T

Tanjil
  • 198
  • 1
  • 17

1 Answers1

1

According to the documentation here https://www.ni.com/pl-pl/support/documentation/supplemental/12/logging-data-with-national-instruments-citadel.html

The .cdpg files contain trace data. Citadel stores data in a compressed format; therefore, you cannot read and extract data from these files directly. You must use the Citadel API in the DSC Module or the Historical Data Viewer to access trace data. Refer to the Citadel Operations section for more information about retrieving data from a Citadel database.

.cdpg is a closed format containing compressed data. You won't be able to interpret them properly not knowing the file format structure. You can read the raw binary content and this is what you're actually doing with your example Python code

  • Thank you @Mateusz. I will look for alternative apporaches such as having the file saved in a different format. – Tanjil Feb 23 '23 at 09:58