Skip to main content

Package for downloading timeseries data and convert to generated power

Project description

pipeline coverage

Timeseries Methods for Wind Power

This is a Python package to download timeseries data from the NORA3 reanalysis, and to convert to power time series for wind farms.

Quick-start

  • Installl as a Python package in your preferred way, for example using poetry
  • Copy and adjust the example code below.

Example

import pandas as pd
import pathlib
import timeseries_methods as tm

# Specify windfarms
windfarms = pd.DataFrame([
    {"id":"windfarm_1", "lat":55, "lon": 9, "orientation":None, "shape":None, "turbine_height": 150},
    {"id":"windfarm_2", "lat":60, "lon": 7, "orientation":None, "shape":None, "turbine_height": 150},
]).set_index("id")

# Download wind speed data from NORA3 and save to CSV file in specified folder
time_start = "2022-05-01"
time_end = "2022-05-05"
data_path = pathlib.Path("downloaded_nora3").mkdir(parents=True,exist_ok=True)

# Download from server and save to files
wind_data = tm.download.retrieve_nora3(
    windfarms,time_start,time_end,use_cache=True,data_path=data_path)

# Specify function for wind speed to wind power conversion, using a pre-defined function:
my_power_function = tm.compute.func_ninja_compute_power
my_args = {"turbine_power_curve": tm.compute.get_power_curve(name="VestasV80")}

# Compute wind farm power from wind speed data
windpower = tm.compute.compute_power(windfarms,wind_data,
        power_function=my_power_function,power_function_args=my_args)

# Save to file
windpower.to_csv("windpower.csv")

This creates a windpower dataframe

                     windfarm_1  windfarm_2
time
2022-05-01 00:00:00    0.053922    0.105866
2022-05-01 01:00:00    0.065940    0.037178
2022-05-01 02:00:00    0.107095    0.009000
2022-05-01 03:00:00    0.056030    0.006256
2022-05-01 04:00:00    0.041206    0.003573
...

Model description

The package consists of two modules

  • download.py - for downloading timeseries
  • compute.py - for processing timeseries and computing generated power

The main inputs are the specifications of

  • wind farms
  • Wind power functions

Wind data

The package relies on the metocean_api Python package for retrieving data from the Reanalysis servers (NORA3 or ERA5)

Data retrieval is time-consuming and downloaded NETCDF files are automatically saved in a local cache that may be re-used.

Downloaded data is also saved in CSV files for easy access later on.

Regarding wind direction:

  • wind direction angle is defined as the direction the wind is blowing from. 0 degrees for wind from north, 90 degrees for wind from east
  • u,v wind components: u-component is wind blowing towards the east, v-component is wind blowing towards the north
  • Example: (u,v) = (1,1) corresponds to direction towards north-east, ie from south-west, direction = 255 (=45+180) degrees.

Wind farms

Wind farms are specified with the following information

  • id (name)
  • latitude
  • longitude
  • turbine height
  • orientation
  • shape (aspect ratio)

Wind power function

Generated wind power is computed via compute_power:

windpower = tm.compute.compute_power(windfarms, wind_data, power_function,power_function_args)

This takes as arguments

  • wind farms specified in a pandas dataframe
  • wind data: Reanalysis wind data from NORA3
  • a power function (reference)
  • extra power function arguments specified as a dictionary.

The wind power function is what converts wind data to generated power. It acts on the wind data and is a function of

  • wind speed at hub height
  • wind direction at hub height
  • wind farm orientation
  • wind farm shape
  • possibly additional arguments supplied via the power_function_args dictionary

There are three main alternatives for specifying the power function:

ALTERNATIVE 1: From power curve. The package includes some pre-defined wind turbine power curves, that can be used to define a power function. In this case, the power function is only a function of the wind speed (at hub height).

pc_V80 = tm.compute.get_power_curve(name="VestasV80")
my_power_function = tm.compute.func_power_curve(pc_V80)

ALTERNATIVE 2: Pre-defined function. The package also includes som pre-defined power functions. Shown below is a function that reproduces the method used by Renewables.ninja, which is based on gauss-filtering a single turbine curve with a wake loss factor included.

power_function = tm.compute.func_ninja_compute_power
power_function_args = {
    "turbine_power_curve": tm.compute.get_power_curve(name="VestasV80"),
    "sigma": 2*1.17, 
    "wakeloss", 0.71,
    }

ALTERNATIVE 3: Explicitly define function. Another alternative is to define the power conversion function explictily, for example like this:

def power_function(
        windspeed_at_hub,
        winddirection_at_hub,
        windfarm_orientation,
        windfarm_shape,
        **kwargs):
    windpower =  ...
    return windpower
power_function_args = dict()

References

Science

Data and APIs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wind_power_timeseries-0.5.0.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

wind_power_timeseries-0.5.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file wind_power_timeseries-0.5.0.tar.gz.

File metadata

  • Download URL: wind_power_timeseries-0.5.0.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.2 Linux/4.18.0-553.32.1.el8_10.x86_64

File hashes

Hashes for wind_power_timeseries-0.5.0.tar.gz
Algorithm Hash digest
SHA256 b71103ad4130a0cdc28aa72c030fb5ce12ad0a18a4bfcf8191bd2ae5e13b1275
MD5 62069d5c32c1b62e62377b63bbef21f4
BLAKE2b-256 833c3fb72adf68b467f3d1deb68c7e111b45b4c1749e810c8b32923739501b3e

See more details on using hashes here.

File details

Details for the file wind_power_timeseries-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: wind_power_timeseries-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.2 Linux/4.18.0-553.32.1.el8_10.x86_64

File hashes

Hashes for wind_power_timeseries-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 60fa98623b90700a0793da39dfa405b6c75d94167e7f7b4b628e39fb7090fd67
MD5 7cacd17c67b58d2acdef449d7653ea85
BLAKE2b-256 3b097e0794b02c7024d13e2e3618909d22dea650ba062a92e014f7eddc25e636

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page