AtmosphereDerivedFeaturesAdder#

class openstef_models.transforms.weather_domain.atmosphere_derived_features_adder.AtmosphereDerivedFeaturesAdder(**data: Any) None[source]

Bases: BaseConfig, TimeSeriesTransform

Transform that calculates atmosphere derived meteorological features from basic weather data.

This transform calculates various air-related features including saturation vapour pressure, vapour pressure, dewpoint, and air density using standard meteorological formulas. It requires temperature, pressure, and relative humidity as input columns. The calculated features can be used to enhance weather-based prediction models by providing additional atmospheric state information that may correlate with energy generation patterns. For example: Higher humidity reduces PV generation by scattering and absorbing sunlight (https://doi.org/10.1016/j.matpr.2020.08.775).

Example

>>> import pandas as pd
>>> from openstef_core.datasets.timeseries_dataset import TimeSeriesDataset
>>> from openstef_models.transforms.weather_domain.atmosphere_derived_features_adder import (
...     AtmosphereDerivedFeaturesAdder
... )
>>>
>>> # Create sample weather data
>>> data = pd.DataFrame({
...     'temperature': [20.0, 25.0, 15.0],
...     'pressure': [1013.25, 1015.0, 1010.0],
...     'relative_humidity': [60.0, 70.0, 80.0]
... },
... index=pd.date_range('2025-06-01 12:00:00', periods=3, freq='h'))
>>> dataset = TimeSeriesDataset(data=data, sample_interval=pd.Timedelta(hours=1))
>>>
>>> # Initialize transform with specific features
>>> transform = AtmosphereDerivedFeaturesAdder(
...     included_features=["dewpoint", "air_density"]
... )
>>>
>>> # Apply transformation
>>> result = transform.transform(dataset)
>>> result.feature_names
['temperature', 'pressure', 'relative_humidity', 'dewpoint', 'air_density']
Parameters:

data (Any)

included_features: list[TypeAliasType]
temperature_column: str
pressure_column: str
relative_humidity_column: str
transform(data: TimeSeriesDataset) TimeSeriesDataset[source]

Transform the input data.

This method should apply a transformation to the input data and return a new instance.

Parameters:
Returns:

A new instance of the transformed data.

Raises:

NotFittedError – If the transform has not been fitted yet.

Return type:

TimeSeriesDataset

features_added() list[str][source]

List of feature names added by this transform.

Return type:

list[str]

Returns:

A list of strings representing the names of features added to the dataset by this transform. Default is an empty list.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': False, 'extra': 'ignore', 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

  • self

  • context

Return type:

None