ExtractBounds

Extract the bounds of each zone.


Input Parameters

The following keys can be set:

  • base – (type = antares.Base ) – The Base on which the extraction will be performed

  • faces – (default = True, type = boolean ) – if True it extract the cell faces otherwise it extract the cells

  • memory_mode – (default = False, type = boolean ) – if memory mode is True, the base is deleted on the fly to limit memory usage

Warning

The treatment is only coded for unstructured dataset so far. See function Base.unstructure() if needed to be used on a structured base.

Main functions

class antares.treatment.TreatmentExtractBounds.TreatmentExtractBounds
execute()

Execute the treatment.

Returns

the unstructured Base obtained

Return type

antares.Base

Example

"""
This example shows how to extract the bounding cells of each zone
of a base.

Note that even if the input base is structured, the output of the
treatment will be unstructured.
"""
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>_<instant>.dat')
base = reader.read()

# ------------------------
# Extract bounds
# ------------------------
# treatment is only coded for unstructured dataset so far
base.unstructure()

treatment = Treatment('extractbounds')
treatment['base'] = base
result = treatment.execute()

print(result[0][0])

# -------------------
# Writing the result
# -------------------
writer = Writer('hdf_antares')
writer['filename'] = os.path.join('OUTPUT', 'ex_bounds')
writer['base'] = result
writer.dump()