Integration¶
This method integrates variables on a base.
Parameters¶
- base:
Base
The base on which the integration will be performed for each variable except coordinates.
- base:
- coordinates: list(str)
The coordinates used for integration.
- mean: bool, default= False
Compute mean.
Preconditions¶
The coordinate variables must be available at nodes. The integration will be performed on all the other variables. Variables at nodes are interpolated at cell centers.
Main functions¶
Example¶
"""
This example illustrates how to integrate data over a dataset
"""
import os
if not os.path.isdir('OUTPUT'):
os.makedirs('OUTPUT')
from antares import Reader, Treatment
# ------------------
# Reading the files
# ------------------
reader = Reader('bin_tp')
reader['filename'] = os.path.join('..', 'data', 'ROTOR37', 'GENERIC', 'flow_<zone>_<instant>.dat')
ini_base = reader.read()
# -----------
# Integration
# -----------
treatment = Treatment('integration')
treatment['base'] = ini_base
result = treatment.execute()
# the result base contain one zone with the integrated data
# the zone contains the values for the different instants
print(result[0])
# in each instant, the result of the integration for each
# variable is stored as well as the volume of the dataset
print(result[0][0])
print(result[0][0]['volume'])