.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/vertical_extrapolation.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_vertical_extrapolation.py: Vertical extrapolation =========================== Example of using PyWAsP to perform vertical extrapolation. .. GENERATED FROM PYTHON SOURCE LINES 10-14 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. .. GENERATED FROM PYTHON SOURCE LINES 14-24 .. code-block:: Python import numpy as np import windkit as wk import pywasp as pw ssl = wk.get_tutorial_data("serra_santa_luzia") topo_map = pw.wasp.TopographyMap(ssl.elev, ssl.rgh) .. rst-class:: sphx-glr-script-out .. code-block:: none Downloading SerraSantaLuzia.zip from Zenodo... Downloaded SerraSantaLuzia.zip to /root/.local/share/windkit/tutorial_data/serra_santa_luzia/SerraSantaLuzia.zip .. GENERATED FROM PYTHON SOURCE LINES 25-29 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. .. GENERATED FROM PYTHON SOURCE LINES 29-39 .. code-block:: Python output_locs = wk.spatial.create_dataset( west_east=ssl.bwc.west_east.values, south_north=ssl.bwc.south_north.values, height=np.linspace(10.0, 100.0, 10), crs="EPSG:32629", struct="stacked_point", ) print(output_locs) .. rst-class:: sphx-glr-script-out .. code-block:: none Size: 177B Dimensions: (height: 10, stacked_point: 1) Coordinates: * height (height) float64 80B 10.0 20.0 30.0 40.0 ... 80.0 90.0 100.0 south_north (stacked_point) float64 8B 4.621e+06 west_east (stacked_point) float64 8B 5.147e+05 crs int8 1B 0 Dimensions without coordinates: stacked_point Data variables: output (height, stacked_point) float64 80B 0.0 0.0 0.0 ... 0.0 0.0 0.0 Attributes: Conventions: CF-1.8 history: 2025-07-22T14:10:25+00:00:\twindkit==1.0.3.dev1+ga612767\tw... .. GENERATED FROM PYTHON SOURCE LINES 40-46 Calculate resource grid ------------------------ Finally, we can calculate the resource grid. This is done by calling the predict_wwc function. This function takes the output locations, the boundary conditions, and the topography map as input. The output is a weibull wind climate dataset at the output locations. .. GENERATED FROM PYTHON SOURCE LINES 46-50 .. code-block:: Python wwc = pw.wasp.predict_wwc(ssl.bwc, topo_map, output_locs) .. rst-class:: sphx-glr-script-out .. code-block:: none /builds/ram/software/pywasp/pywasp/modules/windkit/windkit/spatial/_bbox.py:263: UserWarning: 'use_bounds' currently defaults to False in BBox.reproject, in the future this will change to True warnings.warn( /builds/ram/software/pywasp/pywasp/modules/windkit/windkit/spatial/_bbox.py:263: UserWarning: 'use_bounds' currently defaults to False in BBox.reproject, in the future this will change to True warnings.warn( /builds/ram/software/pywasp/pywasp/modules/windkit/windkit/spatial/_bbox.py:263: UserWarning: 'use_bounds' currently defaults to False in BBox.reproject, in the future this will change to True warnings.warn( /builds/ram/software/pywasp/pywasp/modules/windkit/windkit/spatial/_bbox.py:263: UserWarning: 'use_bounds' currently defaults to False in BBox.reproject, in the future this will change to True warnings.warn( /builds/ram/software/pywasp/pywasp/modules/windkit/windkit/spatial/_bbox.py:263: UserWarning: 'use_bounds' currently defaults to False in BBox.reproject, in the future this will change to True warnings.warn( /builds/ram/software/pywasp/pywasp/modules/windkit/windkit/spatial/spatial.py:1087: UserWarning: Clipping bbox including marging is outside the bounds of the dataset to clip! warnings.warn( .. GENERATED FROM PYTHON SOURCE LINES 51-54 Plot the mean wind speed ------------------------ We can plot the mean wind speed to see the result. .. GENERATED FROM PYTHON SOURCE LINES 54-56 .. code-block:: Python wwc["wspd"].plot.line(y="height") .. image-sg:: /auto_examples/images/sphx_glr_vertical_extrapolation_001.png :alt: crs = 0, west_east = 5.147e+05, south_north = 4... :srcset: /auto_examples/images/sphx_glr_vertical_extrapolation_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none [] .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 3.283 seconds) .. _sphx_glr_download_auto_examples_vertical_extrapolation.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: vertical_extrapolation.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: vertical_extrapolation.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: vertical_extrapolation.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_