.. _calculations_statgen:

Statgen Calculation Service
===========================

The CalcStatgenService gives access to generalizing wind statistics from wind measurements.
It is the first step towards a statistical based resource calculation, either using PARK or RESOURCE in windPRO.
Likewise, it is the first step in windPRO scripting.

The service itself if relatively simple with the ``CalcStatgenService.GetStatgenCalc`` and ``CalcStatgenService.SetStatgenCalc`` for getting and setting calculations.
Additionally, it is possible to read wws (generalized wind statistic) files using ``StatgenService.GetWindstatDataFromFile``.

Generating a generalized wind statistics in windPRO follows the following steps.
The steps that are needed are the following:

- Add or download terrain and roughness data
- Make a statgen object for statistical wind resource calculations
- Do a Statgen calculation to get the wind statistics
- Add a statgen object for resource map calculation and link the wind statistics

Properties of the calculation object can be found here :ref:`TApiCalcStatgen <TApiCalcStatgen>`.
The example below include generating a Statgen calculation from scratch.
It is the same example as :ref:`calculations_resource` and includes the generation of a resource map as well.

.. literalinclude:: ../../../python/examples/fromDocs/calculations/statgen_resgen_calculation.py