Calculate Resource grid

Example of using PyWAsP to calculate a resource grid

Prepare TopographyMap

First, we need to prepare the topography map. This is done by reading the elevation and roughness maps and creating a TopographyMap object.

[1]:
import numpy as np
import windkit as wk
import pywasp as pw

bwc = wk.read_bwc(
    "../../../modules/examples/tutorial_4/data/SerraSantaLuzia.omwc", crs="EPSG:4326"
)
bwc = wk.spatial.reproject(bwc, to_crs="EPSG:32629")

elev_map = wk.read_vector_map(
    "../../../modules/examples/tutorial_4/data/SerraSantaLuzia.map",
    map_type="elevation",
    crs="EPSG:32629",
)

lc_map, lc_tbl = wk.read_vector_map(
    "../../../modules/examples/tutorial_4/data/SerraSantaLuzia.map",
    map_type="roughness",
    crs="EPSG:32629",
)

topo_map = pw.wasp.TopographyMap(elev_map, lc_map, lc_tbl)

Define output locations

Second, we need to define the output locations. This is done by creating a dataset with the coordinates of the output locations.

[2]:
dx, dy = 300, 300
nx, ny = 51, 51
x0, y0 = 510500, 4613500
steps = np.arange(nx) * dx
x = x0 + steps
y = y0 + steps
xmin, xmax = x.min(), x.max()
ymin, ymax = y.min(), y.max()

output_locs = wk.create_dataset(
    west_east=x,
    south_north=y,
    height=[50],
    crs="EPSG:32629",
    struct="cuboid",
)

Calculate resource grid

Finally, we can calculate the resource grid. This is done by calling the generalize_and_downscale function. This function takes the output locations, the boundary conditions, and the topography map as input. The output is a predicted wind climate dataset

[3]:
pwc = pw.wasp.generalize_and_downscale(output_locs, bwc, topo_map)

Plot the mean wind speed

We can plot the mean wind speed to see the result.

[4]:
pwc["wspd"].plot()
../_images/auto_examples_resource_grid_8_0.png