Weibull Wind Climate (WWC)#

The Weibull wind climate is a parametric representation using Weibull distribution parameters for each sector. These are often used to store WAsP simulation results and are stored in .rsf files.

Data Structure#

WWC objects are xarray.Dataset with the following schema:

Dimensions:  (sector, ...)
Variables:
    A       (sector, ...)  - Weibull scale parameter (m/s)
    k       (sector, ...)  - Weibull shape parameter
    wdfreq  (sector, ...)  - wind direction frequency

The Weibull distribution is characterized by:

  • Scale parameter (A) - Related to the mean wind speed

  • Shape parameter (k) - Describes the distribution shape (k~2 is typical for wind)

I/O#

Format

Read

Write

Description

.rsf

yes

yes

WAsP Resource Summary File

.wrg

yes

yes

WAsP Wind Resource Grid

.grd

yes

no

Golden Software Grid

.pwc

yes

no

WAsP Predicted Wind Climate

.nc

yes

via .to_netcdf()

NetCDF format

Reading:

windkit.read_wwc() reads Weibull wind climates:

# Read from RSF file
wwc = wk.read_wwc("resource.rsf", crs="EPSG:32632")

# Read from WRG file (resource grid)
wwc = wk.read_wwc("resource_grid.wrg", crs="EPSG:32632")

Writing:

windkit.wwc_to_file() writes Weibull wind climates:

# Write to RSF file
wk.wwc_to_file(wwc, "output.rsf")

# Write to WRG file (resource grid)
wk.wwc_to_file(wwc, "output.wrg")

Creating from Arrays#

A = np.random.rand(12) * 10
k = np.random.rand(12) + 1
wdfreq = np.random.rand(12)
wdfreq = wdfreq / wdfreq.sum()

wwc = xr.Dataset(
    data_vars=dict(
        A=(("sector",), A),
        k=(("sector",), k),
        wdfreq=(("sector",), wdfreq),
    ),
    coords=dict(
        sector=(("sector",), (wdbins[1:] + wdbins[:-1]) / 2.0),
        sector_floor=(("sector_floor",), np.mod(wdbins[:-1], 360)),
        sector_ceil=(("sector_ceil",), np.mod(wdbins[1:], 360)),
    )
)

# Add spatial structure
wwc = (
    wwc
    .expand_dims("point")
    .assign_coords(
        west_east=(("point",), [56.0]),
        south_north=(("point",), [12.0]),
        height=(("point",), [50.0]),
    )
)
wwc = wk.spatial.set_crs(wwc, "EPSG:4326")

wwc
<xarray.Dataset> Size: 601B
Dimensions:       (point: 1, sector: 12, sector_floor: 12, sector_ceil: 12)
Coordinates:
    west_east     (point) float64 8B 56.0
    south_north   (point) float64 8B 12.0
    height        (point) float64 8B 50.0
  * sector        (sector) float64 96B 0.0 30.0 60.0 90.0 ... 270.0 300.0 330.0
  * sector_floor  (sector_floor) float64 96B 345.0 15.0 45.0 ... 285.0 315.0
  * sector_ceil   (sector_ceil) float64 96B 15.0 45.0 75.0 ... 285.0 315.0 345.0
    crs           int8 1B 0
Dimensions without coordinates: point
Data variables:
    A             (point, sector) float64 96B 2.682 4.807 4.768 ... 7.945 1.824
    k             (point, sector) float64 96B 1.71 1.012 1.195 ... 1.534 1.326
    wdfreq        (point, sector) float64 96B 0.07163 0.1844 ... 0.1841 0.0326

Creating from BWC#

windkit.weibull_fit() fits Weibull parameters to a binned wind climate:

# Get tutorial data
path = wk.get_tutorial_data("serra_santa_luzia")
bwc = wk.read_bwc(path / "bwc.omwc", crs="EPSG:4326")

# Fit Weibull distribution
wwc_fitted = wk.weibull_fit(bwc)
wwc_fitted
<xarray.Dataset> Size: 601B
Dimensions:       (sector: 12, point: 1)
Coordinates:
  * sector        (sector) float64 96B 0.0 30.0 60.0 90.0 ... 270.0 300.0 330.0
    sector_ceil   (sector) float64 96B 15.0 45.0 75.0 ... 285.0 315.0 345.0
    sector_floor  (sector) float64 96B 345.0 15.0 45.0 ... 255.0 285.0 315.0
    height        (point) float64 8B 25.3
    south_north   (point) float64 8B 41.74
    west_east     (point) float64 8B -8.823
    crs           int8 1B 0
Dimensions without coordinates: point
Data variables:
    wdfreq        (sector, point) float64 96B 0.05314 0.03321 ... 0.1148 0.0707
    A             (sector, point) float64 96B 5.47 5.346 5.746 ... 7.312 6.022
    k             (sector, point) float64 96B 1.924 2.145 2.594 ... 2.185 1.97
Attributes:
    Conventions:      CF-1.8
    history:          2026-01-29T09:30:21+00:00:\twindkit==2.0.1\tcreate_data...
    description:      SerraSantaluzia
    Package name:     windkit
    Package version:  2.0.1
    Creation date:    2026-01-29T09:30:22+00:00
    Object type:      Weibull Wind Climate
    author:           Default User
    author_email:     default_email@example.com
    institution:      Default Institution

The fit preserves mean power density by using the third moment of wind speed.

Converting to BWC#

windkit.wwc_to_bwc() converts WWC back to histogram format:

bwc_from_wwc = wk.wwc_to_bwc(wwc_fitted, ws_bins=np.arange(0, 31))
bwc_from_wwc
<xarray.Dataset> Size: 4kB
Dimensions:       (sector: 12, point: 1, wsbin: 30)
Coordinates:
  * sector        (sector) float64 96B 0.0 30.0 60.0 90.0 ... 270.0 300.0 330.0
    sector_ceil   (sector) float64 96B 15.0 45.0 75.0 ... 285.0 315.0 345.0
    sector_floor  (sector) float64 96B 345.0 15.0 45.0 ... 255.0 285.0 315.0
    height        (point) float64 8B 25.3
    south_north   (point) float64 8B 41.74
    west_east     (point) float64 8B -8.823
  * wsbin         (wsbin) float64 240B 0.5 1.5 2.5 3.5 ... 26.5 27.5 28.5 29.5
    wsceil        (wsbin) float64 240B 1.0 2.0 3.0 4.0 ... 27.0 28.0 29.0 30.0
    wsfloor       (wsbin) float64 240B 0.0 1.0 2.0 3.0 ... 26.0 27.0 28.0 29.0
    crs           int8 1B 0
Dimensions without coordinates: point
Data variables:
    wdfreq        (sector, point) float64 96B 0.05314 0.03321 ... 0.1148 0.0707
    wsfreq        (wsbin, sector, point) float64 3kB 0.03734 ... 1.942e-10
Attributes:
    Conventions:      CF-1.8
    history:          2026-01-29T09:30:21+00:00:\twindkit==2.0.1\tcreate_data...
    description:      SerraSantaluzia
    Package name:     windkit
    Package version:  2.0.1
    Creation date:    2026-01-29T09:30:22+00:00
    Object type:      Binned Wind Climate
    author:           Default User
    author_email:     default_email@example.com
    institution:      Default Institution

Validation#

wk.is_wwc(wwc_fitted)
True