# Integration¶

This method integrates variables on a base.

## Input Parameters¶

The following keys can be set:

• base – (type = Base ) – The base on which the integration will be performed for each variable except coordinates

• coordinates – (type = list(str) ) – the coordinates used for integration

• mean – (default = False, type = bool ) – compute mean

Warning

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¶

class antares.treatment.TreatmentIntegration.TreatmentIntegration
execute()

Execute the treatment.

Returns

a new base containing the results

Return type

antares.Base

## 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'])