Family Probe¶
Probe extraction
see also antares.treatment.TreatmentPointProbe
Description¶
Extract a point probe from a given input Base.
Parameters¶
- base:
Base
Probes will be searched in this input base.
- base:
- coordinates: list(str)
The variable names that define the set of coordinates. The coordinates must always be located at nodes whatever the value of location.
- location: str in LOCATIONS, default= ‘node’
Location of values that are concerned by the search. If location is ‘node’, then the probe value will be computed with variables located at ‘node’.
- points: list(tuple)
List of point coordinates.
- tolerance: float, default= None
The threshold in the closest-point search.
Preconditions¶
The base must only contain variables located at the given location.
Main functions¶
Example¶
"""
This example illustrates how use the probe treatment.
Note that the treatment is returning a family which
can then be applied to the base to get the data or used
to get the elsA extractor corresponding
"""
import os
if not os.path.isdir('OUTPUT'):
os.makedirs('OUTPUT')
from antares import Reader, Treatment
# ----------------------------------------------
# Reading the files and topological information
# ----------------------------------------------
reader = Reader('bin_tp')
reader['filename'] = os.path.join('..', 'data', 'ROTOR37', 'GENERIC', 'flow_<zone>_ite0.dat')
reader['zone_prefix'] = 'Block'
base = reader.read()
# -----------------------------
# Retrieve the probes family
# -----------------------------
treatment = Treatment('probe')
treatment['base'] = base
treatment['points'] = [(-20., 160., 0.), (110, 160., 0.)]
probes_family = treatment.execute()
print(probes_family)
# >>> Family object
# - objects : ['probe_0000', 'probe_0001']
# add the family to the base
base.families['my_probes'] = probes_family
# extract the data at the probes locations
probes = base[probes_family]
print(probes)
# >>> Base object
# - zones : ['probe_0000', 'probe_0001']
# ----------------------------------
# Get the elsA extractor associated
# ----------------------------------
print(probes_family.get_extractor())
# extractor_antares_win = DesGlobWindow('extractor_antares_win')
#
# extractor_antares_probe_0000 = window('Block0002', name='extractor_antares_probe_0000')
# extractor_antares_probe_0000.set('wnd', [ 15, 15, 1, 1, 11, 11])
# extractor_antares_win.attach(extractor_antares_probe_0000)
#
# extractor_antares_probe_0001 = window('Block0000', name='extractor_antares_probe_0001')
# extractor_antares_probe_0001.set('wnd', [ 1, 1, 1, 1, 17, 17])
# extractor_antares_win.attach(extractor_antares_probe_0001)
#
# extractor_antares = extractor('extractor_antares_win', name='extractor_antares')
# extractor_antares.set('var', 'xyz conservative')
# extractor_antares.set('loc', 'node')
# extractor_antares.set('writingmode', 1)
# extractor_antares.set('file', 'extractor_antares')
# extractor_antares.set('format', 'bin_tp')