Quick Overview
Here is a quick overview of PyWAsP. To begin with, lets import pywasp
, windkit
. We will use pathlib.Path
to point to the data location.
In [1]: from pathlib import Path
In [2]: import pywasp as pw
In [3]: import windkit as wk
In [4]: path = Path("../modules/examples/tutorial_1/data")
Read in a observed wind climate
You can use windkit
to open a WAsP .omwc
file, which is a binned observed wind climate file, and reproject it to
UTM32 coordinates
In [5]: bwc = wk.read_bwc(path / "SerraSantaLuzia.omwc", crs="EPSG:4326")
In [6]: bwc = wk.spatial.reproject(bwc, to_crs="EPSG:32629")
In [7]: print(bwc)
<xarray.Dataset> Size: 4kB
Dimensions: (point: 1, sector: 12, wsbin: 32)
Coordinates:
height (point) float64 8B 25.3
crs int8 1B 0
wsceil (wsbin) float64 256B 1.0 2.0 3.0 4.0 ... 29.0 30.0 31.0 32.0
wsfloor (wsbin) float64 256B 0.0 1.0 2.0 3.0 ... 28.0 29.0 30.0 31.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
* wsbin (wsbin) float64 256B 0.5 1.5 2.5 3.5 ... 28.5 29.5 30.5 31.5
* sector (sector) float64 96B 0.0 30.0 60.0 90.0 ... 270.0 300.0 330.0
west_east (point) float64 8B 5.147e+05
south_north (point) float64 8B 4.621e+06
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.02601 0.04219 ... 0.0 0.0
Attributes:
Conventions: CF-1.8
history: 2025-07-22T14:10:35+00:00:\twindkit==1.0.3.dev1+ga61276...
description: SerraSantaluzia
Package name: windkit
Package version: 1.0.3.dev1+ga612767
Creation date: 2025-07-22T14:10:35+00:00
Object type: Binned Wind Climate
author: Default User
author_email: default_email@example.com
institution: Default Institution
Read in topography data
Secondly, let’s also read in some elevation and landcover data and combine it into a pywasp.wasp.TopographyMap
In [8]: elev_map = wk.read_elevation_map(path / "SerraSantaLuzia.map", crs="EPSG:32629")
In [9]: rgh_map = wk.read_roughness_map(path / "SerraSantaLuzia.map", crs="EPSG:32629")
In [10]: topo_map = pw.wasp.TopographyMap(elev_map, rgh_map)
Calculate Generalized Wind climate
A observed wind climate can be generalized with WAsP, using the pywasp.wasp.generalize
function
In [11]: gwc = pw.wasp.generalize(bwc, topo_map)
In [12]: print(gwc)
<xarray.Dataset> Size: 4kB
Dimensions: (point: 1, sector: 12, gen_height: 5, gen_roughness: 5)
Coordinates:
height (point) float64 8B 25.3
south_north (point) float64 8B 4.621e+06
west_east (point) float64 8B 5.147e+05
crs int8 1B 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
* sector (sector) float64 96B 0.0 30.0 60.0 90.0 ... 270.0 300.0 330.0
* gen_roughness (gen_roughness) float64 40B 0.0 0.03 0.1 0.4 1.5
* gen_height (gen_height) int64 40B 10 25 50 100 250
Dimensions without coordinates: point
Data variables:
A (sector, gen_height, gen_roughness, point) float32 1kB 5.6...
k (sector, gen_height, gen_roughness, point) float32 1kB 1.7...
wdfreq (sector, gen_height, gen_roughness, point) float32 1kB 0.0...
site_elev (point) float32 4B 381.0
Attributes:
Conventions: CF-1.8
history: 2025-07-22T14:10:35+00:00:\twindkit==1.0.3.dev1+ga61276...
description: SerraSantaluzia
Package name: windkit
Package version: 1.0.3.dev1+ga612767
Creation date: 2025-07-22T14:10:37+00:00
Object type: Geostrophic Wind Climate
author: Default User
author_email: default_email@example.com
institution: Default Institution
title: Generalized wind climate
Downscale to wind turbine locations
The generalized wind climate can be used with the topography data to predict the wind climate at nearby locations, like the hub-height of planned wind turbines
In [13]: import pandas as pd
In [14]: wtg_locs = pd.read_csv(path / 'turbine_positions.csv')
In [15]: output_locs = wk.spatial.create_point(wtg_locs.Easting.values,
....: wtg_locs.Northing.values,
....: wtg_locs['Hub height'].values,
....: crs="EPSG:32629")
....:
In [16]: wwc = pw.wasp.downscale(gwc, topo_map, output_locs=output_locs, interp_method="nearest")
In [17]: print(wwc)
<xarray.Dataset> Size: 3kB
Dimensions: (point: 15, sector: 12)
Coordinates:
height (point) int64 120B 50 50 50 50 50 50 50 ... 50 50 50 50 50 50
south_north (point) int64 120B 4622313 4622199 ... 4624252 4624142
west_east (point) int64 120B 513914 514161 514425 ... 516060 516295
crs int8 1B 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
* sector (sector) float64 96B 0.0 30.0 60.0 90.0 ... 270.0 300.0 330.0
Dimensions without coordinates: point
Data variables:
A (sector, point) float32 720B 7.429 7.4 7.055 ... 7.75 8.305
k (sector, point) float32 720B 2.029 2.037 ... 2.127 2.123
wdfreq (sector, point) float32 720B 0.06444 0.06485 ... 0.0792
site_elev (point) float32 60B 459.7 460.0 460.0 ... 520.0 520.0 520.0
air_density (point) float32 60B 1.163 1.163 1.163 ... 1.156 1.156 1.156
wspd (point) float32 60B 7.435 7.257 6.978 ... 7.548 7.818 8.102
power_density (point) float32 60B 414.6 385.4 340.9 ... 426.1 481.9 532.1
Attributes:
Conventions: CF-1.8
history: 2025-07-22T14:10:37+00:00:\twindkit==1.0.3.dev1+ga61276...
title: WAsP site effects
Package name: windkit
Package version: 1.0.3.dev1+ga612767
Creation date: 2025-07-22T14:10:38+00:00
Object type: Met fields
author: Default User
author_email: default_email@example.com
institution: Default Institution
Estimate the gross AEP
The weibull wind climates predicted by WAsP can be used to estimate the Annual Energy Production in GWh for a specific turbine model
In [18]: wtg = wk.read_wtg(path / "Bonus_1_MW.wtg")
In [19]: gross_aep = pw.gross_aep(wwc, wtg)
In [20]: print(gross_aep)
<xarray.Dataset> Size: 1kB
Dimensions: (point: 15, sector: 12)
Coordinates:
height (point) int64 120B 50 50 50 50 50 50 ... 50 50 50 50 50 50
south_north (point) int64 120B 4622313 4622199 ... 4624252 4624142
west_east (point) int64 120B 513914 514161 514425 ... 516060 516295
crs int8 1B 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
* sector (sector) float64 96B 0.0 30.0 60.0 ... 270.0 300.0 330.0
Dimensions without coordinates: point
Data variables:
gross_aep (point) float32 60B 2.797 2.661 2.449 ... 3.064 3.278
gross_aep_sector (point, sector) float32 720B 0.1428 0.08569 ... 0.2184
Attributes:
Conventions: CF-1.8
history: 2025-07-22T14:10:37+00:00:\twindkit==1.0.3.dev1+ga61276...
title: WAsP site effects
Package name: windkit
Package version: 1.0.3.dev1+ga612767
Creation date: 2025-07-22T14:10:38+00:00
Object type: Anual Energy Production
author: Default User
author_email: default_email@example.com
institution: Default Institution
In the User Guide we go into more much greater detail with each component in PyWAsP.