3.8. Example: Convert numeric curve to text curve

client = wilib.login('username', 'password')
dataset = client.getDatasetByName('Example Dataset', 'Example Well', 'Example Project')
curveDictionary = {1:'a', 2:'b', 3:'c'}
numericCurve = dataset.getCurveByName('Example Curve')
numericCurveData = numericCurve.getCurveData()
curveData = []
for data in numericCurveData:
    curveData.append({'y': data['y'], 'x': curveDictionary.get(data['x'], None)})
textCurve = dataset.newTextCurve(name = 'Curve Name')
if textCurve:
    success = textCurve.updateRawCurveData(curveData)
    if success:
        print('SUCCESS')

Last updated

Was this helpful?