Line

Extract data over a line using vtk

Warning

dependency on VTK


Input Parameters

The following keys can be set:

  • base – (type = antares.Base ) – The base containing the data to extract over the line

  • coordinates – (type = list(str) ) – the name of the variables that define the mesh

  • point1 – (type = tuple of floats ) – tuple of coordinates defining the start of the line

  • point2 – (type = tuple of floats ) – tuple of coordinates defining the end of the line

  • nbpoints – (type = int ) – number of points on the line

  • memory_mode – (default = False, type = boolean ) – if memory mode is True, the base is deleted on the fly to limit memory usage

  • mask – (default = True, type = boolean ) – if False, the points not interpolated on the line are not deleted

  • probe_tolerance – (default = 0, type = integer in [0, …, 14] ) – if different from 0, then set the VTK probe tolerance

Warning

Increasing probe tolerance could be really expensive.

Main functions

class antares.treatment.TreatmentLine.TreatmentLine
execute()

Execute the treatment.

Returns

an unstructured base over a line

Return type

antares.Base

Example

import os
if not os.path.isdir('OUTPUT'):
    os.makedirs('OUTPUT')

from antares import Reader, Treatment, Writer

# ------------------
# Reading the files
# ------------------
reader = Reader('bin_tp')
reader['filename'] = os.path.join('..', 'data', 'ROTOR37', 'GENERIC', 'flow_<zone>_ite0.dat')
base = reader.read()
print(base)

base.compute_coordinate_system(current_coord_sys=['x', 'y', 'z'])
base.coordinate_names = ['x', 'r', 'theta']

# ------------------
# Define line
# ------------------
nb = 20
p1 = [-10., 180., 0.]
p2 = [95., 180., 0.34]

# ------------------------
# Interpolate on the line
# ------------------------
line = Treatment('line')
line['base'] = base
line['point1'] = p1
line['point2'] = p2
line['nbpoints'] = nb
line['memory_mode'] = True
line['mask'] = True
#line['probe_tolerance'] = 10
new_base = line.execute()

print(new_base)
print(new_base[0])
print(new_base[0][0])

# ------------------------
# Write result
# ------------------------
w = Writer('column')
w['base'] = new_base
w['filename'] = os.path.join('OUTPUT', 'ex_line.dat')
w.dump()