Family Probe

Probe extraction

see also antares.treatment.TreatmentPointProbe


Input Parameters

The following keys can be set:

  • base – (type = antares.Base ) – Probes are taken from the base

  • location – (default = node, type = string in LOCATIONS ) – location of probes

  • points – (type = list of tuples ) – list of point coordinates.

  • tolerance – (default = None, type = float ) – the threshold in the closest-point search

  • coordinates – (type = list(str) ) – The variable names that define the set of coordinates

Warning

The base must only contain variables located at the given location.

Main functions

class antares.treatment.TreatmentProbe.TreatmentProbe
execute()

Execute the treatment. (Uses function antares.Base.closest())

Returns

the family containing the Window corresponding to the given points

Return type

Family

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')