Merge Zones of a given input Base.
Multiple zones are shown on the left. Only one zone appears on the right.
import antares myt = antares.Treatment('merge')
The input base
- duplicates_detection: bool, default= False
Activate the detection of duplicated nodes. If True, the treatment will remove the points that are duplicated in the various zones. If some elements (or cells) are duplicated, then they will remain in the output connectivity. The duplicated elements are not removed. These may lead to get a larger number of cells than expected.
If the coordinates are not shared, then the detection is performed only on the first Instant and applied to all the other Instants because the threshold could give different numbers of nodes per Instant. But as all the Instants of one Zone must have the same shape, it would lead to a shape AssertionError.
Note that it is memory and time consuming.
- coordinates: list(str)
The variable names that define the set of coordinates used for duplicate detection (not used otherwise).
- tolerance_decimals: int, default= None
Number of decimal places to round the coordinates. Used with duplicates_detection. If negative, it specifies the number of positions to the left of the decimal point. If None, the coordinates will not be rounded.
- memory_mode: bool, default= False
If True, the initial base is deleted on the fly to limit memory usage.
Zones may be either structured or unstructured.
Zones may contain multiple instants. It is supposed that all Zones contain the same Instants and the same variables in each Instant.
Zones must have Boundaries with different Names. If two zones have a boundary with the same name, then only one is kept. This may lead to a corrupted base.
The treatment returns a Base with only one Zone, and as many instants as the input base.
The output base is always unstructured.
The output base contains the same families as the input base.
The unique zone of the output base contains all the boundaries of the input base, except the grid connectivities of type ‘abutting_1to1’.
Boundaries are not merged. (same topology)
The output base only contains the attributes from the input base. The zones and instants do not contain any attribute in the attrs object.
import antares myt = antares.Treatment('merge') myt['base'] = base myt['duplicates_detection'] = True myt['tolerance_decimals'] = 13 merged = myt.execute()
""" This example illustrates how to use the merge treatment to join zones of a multi-zone base. """ import os from antares import Reader, Treatment # Reading the files reader = Reader('bin_tp') reader['filename'] = os.path.join('..', 'data', 'ROTOR37', 'GENERIC', 'flow_<zone>_ite<instant>.dat') reader['zone_prefix'] = 'Block' reader['topology_file'] = os.path.join('..', 'data', 'ROTOR37', 'GENERIC', 'script_topology.py') base = reader.read() print(base) print('Nb input base grid points: ', base.grid_points) print('Families: ', sorted(base.families)) print('Boundaries of first zone: ', sorted(base.boundaries)) merge = Treatment('merge') merge['base'] = base merge['duplicates_detection'] = True merged = merge.execute() print(merged) # the number of points is smaller because of the duplicates removed print('Nb merged base grid points: ', merged.grid_points) print('Families: ', sorted(merged.families)) print('Boundaries of merged base: ',sorted(merged.boundaries))