Line

Description

Interpolate data over a line using the VTK library.

Parameters

  • base: Base

    The input base containing the data to extract over the line.

  • coordinates: list(str)

    The variable names that define the set of coordinates. If no value is given, the default coordinate system of the base is used (see Base.coordinate_names).

  • point1: tuple(float)

    The coordinates of the starting point of the line.

  • point2: tuple(float)

    The coordinates of the end point of the line.

  • nbpoints: int

    Number of points on the line.

  • memory_mode: bool, default= False

    If True, the initial base is deleted on the fly to limit memory usage.

  • mask: bool, default= True

    If False, the points that were not interpolated on the ‘ line are not deleted in the output base.

  • probe_tolerance: int in [0, …, 14], default= 0

    If different from 0, then set the VTK probe tolerance. Increasing probe tolerance could be really expensive.

Preconditions

Postconditions

The output base will only contain data located at nodes.

Example

import antares
myt = antares.Treatment('line')
myt['base'] = base
myt['coordinates'] = ['x', 'y', 'z']
myt['point1'] = [0.0, 0.0, 0.0]
myt['point2'] = [1.0, 1.0, 1.0]
myt['nbpoints'] = 100
line = myt.execute()

Main functions

class antares.treatment.TreatmentLine.TreatmentLine
execute()

Interpolate values on the line.

Returns:

an unstructured base over a line

Return type:

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.0, 180.0, 0.0]
p2 = [95.0, 180.0, 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()