ExtractBounds¶
Extract the bounds of each zone.
Parameters¶
- base:
Base
The Base on which the extraction will be performed.
- base:
- faces: bool, default= True
If True it extracts the cell faces otherwise it extracts the cells.
- memory_mode: bool, default= False
If memory mode is True, the base is deleted on ‘the fly to limit memory usage.
Preconditions¶
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¶
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()