Merge Zones of a given input Base.

merge1 ==> merge2

Multiple zones are shown on the left. A single zone is the result on the right.


  • base: Base

    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 duplicates_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.

  • check_variables: bool, default= True

    If True, only the variables common to all instants are merged. The common sets of variables is given by the instants of the first zone. If False, the same variables must be available in all instants, and if it is not respected, then this leads to an Error.


Zones may be either structured or unstructured.

Zones may contain multiple instants. It is supposed that all Zones contain the same number and name of Instants.

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 AttrsManagement object.


import antares
myt = antares.Treatment('merge')
myt['base'] = base
myt['duplicates_detection'] = True
myt['tolerance_decimals'] = 13
merged = myt.execute()

Main functions

class antares.treatment.TreatmentMerge.TreatmentMerge

Merge zones.


The unstructured Base obtained after merging all Zones (Instant by Instant).

Return type:



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', '')
base =

print('Nb input base grid points: ', base.grid_points)
print('Families: ', sorted(base.families))
print('Boundaries of first zone: ', sorted(base[0].boundaries))

merge = Treatment('merge')
merge['base'] = base
merge['duplicates_detection'] = True
merged = merge.execute()

# 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[0].boundaries))