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_4/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>
Dimensions:       (point: 1, sector: 12, wsbin: 32)
Coordinates:
    height        (point) float64 25.3
    crs           int8 0
    wsceil        (wsbin) float64 1.0 2.0 3.0 4.0 5.0 ... 29.0 30.0 31.0 32.0
    wsfloor       (wsbin) float64 0.0 1.0 2.0 3.0 4.0 ... 28.0 29.0 30.0 31.0
  * wsbin         (wsbin) float64 0.5 1.5 2.5 3.5 4.5 ... 28.5 29.5 30.5 31.5
    sector_ceil   (sector) float64 15.0 45.0 75.0 105.0 ... 285.0 315.0 345.0
    sector_floor  (sector) float64 345.0 15.0 45.0 75.0 ... 255.0 285.0 315.0
  * sector        (sector) float64 0.0 30.0 60.0 90.0 ... 270.0 300.0 330.0
    west_east     (point) float64 5.147e+05
    south_north   (point) float64 4.621e+06
Dimensions without coordinates: point
Data variables:
    wdfreq        (sector, point) float64 0.05314 0.03321 ... 0.1148 0.0707
    wsfreq        (wsbin, sector, point) float64 0.02601 0.04219 ... 0.0 0.0
Attributes:
    Conventions:      CF-1.8
    history:          2023-07-26T08:47:33:\twindkit==0.6.3\tcreate_dataset(we...
    wasp_header:      SerraSantaluzia
    Package name:     windkit
    Package version:  0.6.3
    Creation date:    2023-07-26T08:47:33
    Object type:      Binned Wind Climate
    author:           Neil Davis
    author_email:     neda@dtu.dk
    institution:      DTU Wind

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_vector_map(path / "SerraSantaLuzia.map", crs="EPSG:32629", map_type="elevation")

In [9]: lc_map, lc_tbl = wk.read_vector_map(path / "SerraSantaLuzia.map", crs="EPSG:32629", map_type="roughness")

In [10]: topo_map = pw.wasp.TopographyMap(elev_map, lc_map, lc_tbl)

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>
Dimensions:        (point: 1, sector: 12, gen_roughness: 5, gen_height: 5)
Coordinates:
    height         (point) float64 25.3
    south_north    (point) float64 4.621e+06
    west_east      (point) float64 5.147e+05
    crs            int8 0
    sector_ceil    (sector) float64 15.0 45.0 75.0 105.0 ... 285.0 315.0 345.0
    sector_floor   (sector) float64 345.0 15.0 45.0 75.0 ... 255.0 285.0 315.0
  * sector         (sector) float64 0.0 30.0 60.0 90.0 ... 270.0 300.0 330.0
  * gen_roughness  (gen_roughness) float64 0.0 0.03 0.1 0.4 1.5
  * gen_height     (gen_height) int64 10 25 50 100 250
Dimensions without coordinates: point
Data variables:
    A              (sector, gen_height, gen_roughness, point) float32 5.715 ....
    k              (sector, gen_height, gen_roughness, point) float32 1.721 ....
    wdfreq         (sector, gen_height, gen_roughness, point) float32 0.06491...
Attributes:
    Conventions:      CF-1.8
    history:          2023-07-26T08:47:33:\twindkit==0.6.3\tcreate_dataset(we...
    wasp_header:      SerraSantaluzia
    Package name:     windkit
    Package version:  0.6.3
    Creation date:    2023-07-26T08:47:33
    Object type:      Binned Wind Climate
    author:           Neil Davis
    author_email:     neda@dtu.dk
    institution:      DTU Wind
    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.create_dataset(wtg_locs.Easting.values,
   ....:                                  wtg_locs.Northing.values,
   ....:                                  wtg_locs['Hub height'].values,
   ....:                                  crs="EPSG:32629")
   ....: 

In [16]: pwc = pw.wasp.downscale(gwc, topo_map, output_locs=output_locs, genwc_interp="nearest")

In [17]: print(pwc)
<xarray.Dataset>
Dimensions:        (sector: 12, point: 15)
Coordinates:
  * sector         (sector) float64 0.0 30.0 60.0 90.0 ... 270.0 300.0 330.0
    height         (point) int64 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50
    south_north    (point) int64 4622313 4622199 4622336 ... 4624252 4624142
    west_east      (point) int64 513914 514161 514425 ... 515808 516060 516295
    crs            int8 0
    sector_ceil    (sector) float64 15.0 45.0 75.0 105.0 ... 285.0 315.0 345.0
    sector_floor   (sector) float64 345.0 15.0 45.0 75.0 ... 255.0 285.0 315.0
Dimensions without coordinates: point
Data variables:
    A              (sector, point) float32 7.434 7.405 7.059 ... 7.77 8.327
    k              (sector, point) float32 2.041 2.045 2.053 ... 2.146 2.143
    wdfreq         (sector, point) float32 0.06445 0.06485 ... 0.07584 0.0792
    site_elev      (point) float32 459.7 460.0 460.0 427.1 ... 520.0 520.0 520.0
    air_density    (point) float32 1.163 1.163 1.163 1.167 ... 1.156 1.156 1.156
    wspd           (point) float32 7.438 7.261 6.982 7.082 ... 7.555 7.825 8.11
    power_density  (point) float32 413.6 384.6 340.3 368.3 ... 425.6 481.4 531.7
Attributes:
    Conventions:      CF-1.8
    history:          2023-07-26T08:47:35:\twindkit==0.6.3\t wk.create_datase...
    title:            WAsP site effects
    Package name:     windkit
    Package version:  0.6.3
    Creation date:    2023-07-26T08:47:35
    Object type:      Met fields
    author:           Neil Davis
    author_email:     neda@dtu.dk
    institution:      DTU Wind

Estimate the gross AEP

The predicted wind climates 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.wasp.gross_aep(pwc, wtg)

In [20]: print(gross_aep)
<xarray.Dataset>
Dimensions:      (point: 15)
Coordinates:
    height       (point) int64 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50
    south_north  (point) int64 4622313 4622199 4622336 ... 4624252 4624142
    west_east    (point) int64 513914 514161 514425 ... 515808 516060 516295
    crs          int8 0
Dimensions without coordinates: point
Data variables:
    gross_AEP    (point) float32 2.906 2.768 2.552 2.628 ... 3.0 3.194 3.412
Attributes:
    Conventions:      CF-1.8
    history:          2023-07-26T08:47:35:\twindkit==0.6.3\t wk.create_datase...
    title:            WAsP site effects
    Package name:     windkit
    Package version:  0.6.3
    Creation date:    2023-07-26T08:47:35
    Object type:      Anual Energy Production
    author:           Neil Davis
    author_email:     neda@dtu.dk
    institution:      DTU Wind

In the User Guide we go into more much greater detail with each component in PyWAsP.