/tfdread

Python package to read data from TFD files used in geophysical logging.

Primary LanguagePythonMIT LicenseMIT

tfdread

Python package to read data from TFD files used in geophysical logging.

I'm working from the incredibly helpful paper by Liang and Zhang (2015).

At the moment the header is being read in OK. Simple curve data will be next.

Install

> pip install git+https://github.com/kinverarity1/tfdread#egg=tfdread

Usage

The function tfdread.open() returns a TFD object with a few methods on it:

>>> from pprint import pprint
>>> import tfdread
>>> with tfdread.open(r"tests\GO7-40-FTC_26-05-16_13-17-29.tfd") as f:
...     pprint(f.to_dict())
...
{'_filename': 'tests\\GO7-40-FTC_26-05-16_13-17-29.tfd',
 '_structs': {'index_a': <tfdread.tfdreader.IndexA object at 0x000002A7B51A30A0>,
              'index_b': <tfdread.tfdreader.IndexB object at 0x000002A7B51A34C0>,
              'index_c': <tfdread.tfdreader.IndexC object at 0x000002A7B51A3518>,
              'info_a': <tfdread.binary_utils.Record object at 0x000002A7B51A3570>,
              'timestamp_field': <tfdread.tfdreader.IndexADate object at 0x000002A7B51A3048>},
 'timestamp': datetime.datetime(2016, 5, 26, 13, 17, 29)}

There's also a to_json() method, which can also be used from the command-line:

> tfdread tests\GO7-40-FTC_26-05-16_13-17-29.tfd
{
  "_filename": "tests\\GO7-40-FTC_26-05-16_13-17-29.tfd",
  "timestamp": "2016-05-26 13:17:29",
  "_structs": {
    "index_a": {
      "i1": 6106
    },
    "timestamp_field": {
      "date": [
        2016,
        5,
        4,
        26,
        13,
        17,
        29,
        625,
        0,
        0,
        0,
        0
      ]
    },
    "index_b": {
      "i2": 7658
    },
    "index_c": {
      "l": 536
    },
    "info_a": {
      "contents": [
        "C:\\Logger\\Tools\\TOOLSTACK.descrC\u0017\u0000\u0000; BEGINNING OF MERGED SUBS SECTIONS //////////////////////////////////",
        "",
        "[Description]",
        "ToolName = GO7-40-FTC",
        "DriverName = TOOLSTACK",
        "FamilyName = ",
        "Sub1 = Tool Top,GO7-40,,",
        "Sub2 = Fluid,FTC,6023,MULTICH",
        "",
        "[Default]",
        "TimeSamplingRate=500",
        "DepthSamplingRate=0.05",
        "",
        "[MultiCh]",
        "NbCh = 9",
        "ToolLength = 0.844",
        "",
        "[ToolId]]",
        "FTC = 25",
        "",
        "[FTC.ModuleId]",
        "SYSTEMSTATUS = 1",
        "FTC = 5",
        "TEMPERATURE = 2",
        "",
        "; GO7-40 channels ------------------------",
        "",
        "; FTC channels ------------------------",
        "",
        "[Ch1]",
        "Name=Time",
        "Producer=Tool.FTC.SYSTEMSTATUS",
        "Unit=sec",
        "ChShift=0",
        "DataType=DWord",
        "Offset=0",
        "CalA=0.001",
        "CalB=0",
        "CalibrationEnable=no",
        "NumberFormat=%8.3f",
        "DisplayEnable=no",
        "",
        "[Ch2]",
        "Name=TCPU",
        "Producer=Tool.FTC.SYSTEMSTATUS",
        "Unit='C",
        "ChShift=0.063",
        "DataType=Word",
        "Offset=4",
        "CalA=0.217226",
        "CalB=-61.11",
        "CalibrationEnable=no",
        "NumberFormat=%5.1f",
        "DisplayEnable=no",
        "",
        "[Ch3]",
        "Name=Vinj",
        "Producer=Tool.FTC.FTC",
        "Unit=V",
        "ChShift=0.0642",
        "DataType=long",
        "Offset=0",
        "CalA=1.16767e-006",
        "CalB=-0.0508554",
        "CalibrationEnable=no",
        "NumberFormat=%8.3f",
        "DisplayEnable=no",
        "DisplayedName=Vinj",
        "Low=0",
        "High=15",
        "NbDecade=1",
        "Mode=Linear",
        "ReverseScale=no",
        "GridEnable=no",
        "Grid=0",
        "Left=0",
        "Right=30",
        "PenStyle=solid",
        "PenWidth=1",
        "PenColor=ff",
        "QCLow=0",
        "QCHigh=0",
        "QCLowRangeColor=2",
        "QCMedRangeColor=1",
        "QCHighRangeColor=2",
        "QCLowRangeText=Invalid",
        "QCMedRangeText=Valid",
        "QCHighRangeText=Invalid",
        "QCLowRangeBeep=no",
        "QCMedRangeBeep=no",
        "QCHighRangeBeep=no",
        "Filter=1",
        "Reference1=9.204",
        "Reference2=0",
        "CalDate=30/06/14 15:39",
        "",
        "[Ch4]",
        "Name=Iinj",
        "Producer=Tool.FTC.FTC",
        "Unit=mA",
        "ChShift=0.0642",
        "DataType=long",
        "Offset=4",
        "CalA=7.56269e-006",
        "CalB=-0.00415192",
        "CalibrationEnable=no",
        "NumberFormat=%8.1f",
        "DisplayEnable=no",
        "DisplayedName=Iinj",
        "Low=0",
        "High=100",
        "NbDecade=1",
        "Mode=Linear",
        "ReverseScale=no",
        "GridEnable=yes",
        "Grid=10",
        "Left=0",
        "Right=30",
        "PenStyle=solid",
        "PenWidth=1",
        "PenColor=80ff",
        "QCLow=0",
        "QCHigh=0",
        "QCLowRangeColor=2",
        "QCMedRangeColor=1",
        "QCHighRangeColor=2",
        "QCLowRangeText=Invalid",
        "QCMedRangeText=Valid",
        "QCHighRangeText=Invalid",
        "QCLowRangeBeep=no",
        "QCMedRangeBeep=no",
        "QCHighRangeBeep=no",
        "Filter=1",
        "Reference1=89.81",
        "Reference2=0",
        "CalDate=30/06/14 15:38",
        "",
        "[Ch5]",
        "Name=DV1",
        "Producer=Tool.FTC.FTC",
        "Unit=V",
        "ChShift=0.0642",
        "DataType=long",
        "Offset=16",
        "CalA=5.43396e-007",
        "CalB=-0.00026083",
        "CalibrationEnable=no",
        "NumberFormat=%8.3f",
        "DisplayEnable=no",
        "DisplayedName=DV1",
        "Low=0",
        "High=1",
        "NbDecade=1",
        "Mode=Linear",
        "ReverseScale=no",
        "GridEnable=no",
        "Grid=0",
        "Left=0",
        "Right=30",
        "PenStyle=solid",
        "PenWidth=1",
        "PenColor=8000",
        "QCLow=0",
        "QCHigh=0",
        "QCLowRangeColor=2",
        "QCMedRangeColor=1",
        "QCHighRangeColor=2",
        "QCLowRangeText=Invalid",
        "QCMedRangeText=Valid",
        "QCHighRangeText=Invalid",
        "QCLowRangeBeep=no",
        "QCMedRangeBeep=no",
        "QCHighRangeBeep=no",
        "Filter=1",
        "Reference1=3.058",
        "Reference2=0",
        "CalDate=30/06/14 15:41",
        "",
        "[Ch6]",
        "Name=DV2",
        "Producer=Tool.FTC.FTC",
        "Unit=V",
        "ChShift=0.0642",
        "DataType=long",
        "Offset=8",
        "CalA=5.51344e-007",
        "CalB=-0.000272364",
        "CalibrationEnable=no",
        "NumberFormat=%8.3f",
        "DisplayEnable=no",
        "DisplayedName=DV2",
        "Low=0",
        "High=1",
        "NbDecade=1",
        "Mode=Linear",
        "ReverseScale=no",
        "GridEnable=no",
        "Grid=0",
        "Left=0",
        "Right=30",
        "PenStyle=solid",
        "PenWidth=1",
        "PenColor=ff0000",
        "QCLow=0",
        "QCHigh=0",
        "QCLowRangeColor=2",
        "QCMedRangeColor=1",
        "QCHighRangeColor=2",
        "QCLowRangeText=Invalid",
        "QCMedRangeText=Valid",
        "QCHighRangeText=Invalid",
        "QCLowRangeBeep=no",
        "QCMedRangeBeep=no",
        "QCHighRangeBeep=no",
        "Filter=1",
        "Reference1=3.082",
        "Reference2=0",
        "CalDate=30/06/14 15:42",
        "",
        "[Ch7]",
        "Name=Temp",
        "Producer=Tool.FTC.FTC",
        "Unit='C",
        "ChShift=0",
        "ChShift=0",
        "DataType=long",
        "Offset=12",
        "CalA=0.00392394",
        "CalB=-277.75",
        "Reference1=7.2",
        "Reference2=78.1",
        "CalDate=01/07/14 09:36",
        "CalibrationEnable=no",
        "NumberFormat=%8.2f",
        "DisplayEnable=yes",
        "DisplayedName=Temp",
        "Low=10",
        "High=20",
        "NbDecade=1",
        "Mode=Linear",
        "ReverseScale=no",
        "GridEnable=yes",
        "Grid=1",
        "Left=35",
        "Right=67.5",
        "PenStyle=solid",
        "PenWidth=2",
        "PenColor=ff",
        "QCLow=0",
        "QCHigh=0",
        "QCLowRangeColor=2",
        "QCMedRangeColor=1",
        "QCHighRangeColor=2",
        "QCLowRangeText=Invalid",
        "QCMedRangeText=Valid",
        "QCHighRangeText=Invalid",
        "QCLowRangeBeep=no",
        "QCMedRangeBeep=no",
        "QCHighRangeBeep=no",
        "Filter=1",
        "",
        "[Ch8]",
        "Name=Cond",
        "Producer=MChProc",
        "Formula=(148.526*{ch4})/({ch5}+{ch6})",
        "Unit=uS/cm",
        "CalibrationEnable=yes",
        "ChShift=0.0642",
        "CalA=1.15821",
        "CalB=4.59802",
        "Reference1=5055",
        "Reference2=112",
        "CalDate=01/07/14 08:40",
        "NumberFormat=%8.1f",
        "DisplayEnable=yes",
        "DisplayedName=Cond",
        "Low=0",
        "High=10000",
        "NbDecade=1",
        "Mode=Linear",
        "ReverseScale=no",
        "GridEnable=no",
        "Grid=0",
        "Left=0",
        "Right=30",
        "PenStyle=solid",
        "PenWidth=1",
        "PenColor=ff8000",
        "QCLow=0",
        "QCHigh=0",
        "QCLowRangeColor=2",
        "QCMedRangeColor=1",
        "QCHighRangeColor=2",
        "QCLowRangeText=Invalid",
        "QCMedRangeText=Valid",
        "QCHighRangeText=Invalid",
        "QCLowRangeBeep=no",
        "QCMedRangeBeep=no",
        "QCHighRangeBeep=no",
        "Filter=1",
        "",
        "[Ch9]",
        "Name=Cond25C",
        "Producer=MChProc",
        "Formula=46.5*{ch8}/({ch7}+21.5)",
        "Unit=uS/cm",
        "ChShift=0.0642",
        "CalA=1",
        "CalB=0",
        "CalibrationEnable=no",
        "NumberFormat=%8.1f",
        "DisplayEnable=no",
        "DisplayedName=Cond25C",
        "Low=0",
        "High=10000",
        "NbDecade=3",
        "Mode=Logarythmic",
        "ReverseScale=no",
        "GridEnable=yes",
        "Grid=0",
        "Left=67.5",
        "Right=100",
        "PenStyle=solid",
        "PenWidth=2",
        "PenColor=ff8000",
        "QCLow=0",
        "QCHigh=0",
        "QCLowRangeColor=2",
        "QCMedRangeColor=1",
        "QCHighRangeColor=2",
        "QCLowRangeText=Invalid",
        "QCMedRangeText=Valid",
        "QCHighRangeText=Invalid",
        "QCLowRangeBeep=no",
        "QCMedRangeBeep=no",
        "QCHighRangeBeep=no",
        "Filter=1",
        "",
        "; GO7-40 channels calibrations ------------------------",
        "",
        "; FTC channels calibrations ------------------------",
        "",
        "[Process]",
        "Process1 = Processor,Start,mch\\MChProc.exe",
        "Process2 = Browser,Start,mch\\MChNum.exe",
        "Process3 = Browser,NoStart,mch\\MChCurve.exe",
        "",
        "[MChProc]",
        "Minimized=no",
        "XOffset=432",
        "YOffset=157",
        "XSize=228",
        "YSize=122",
        "",
        "[MChNum]",
        "NumDisplay1=Ch7",
        "NbNumDisplay=3",
        "NumDisplay2=Ch8",
        "NumDisplay3=Ch9",
        "XOffset=943",
        "YOffset=272",
        "XSize=230",
        "YSize=167",
        "Minimized=no",
        "",
        "[MChCurve]",
        "GridSpacing=0.5",
        "DepthScale=500",
        "XOffset=432",
        "ForceTimeMode=no",
        "YSize=770",
        "DepthColLeft=0.3",
        "XSize=848",
        "DepthSpacing=5",
        "DepthColRight=0.35",
        "Minimized=no",
        "YOffset=0",
        "Grid=yes",
        "",
        "[WellCAD]",
        "Template1  =FTC.wdt",
        "",
        "; END OF MERGED SUBS SECTIONS ////////////////////////////////////////",
        "",
        ""
      ]
    }
  }
}