.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/resource_grid.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_resource_grid.py: Calculate Resource grid =========================== Example of using PyWAsP to calculate a resource grid .. GENERATED FROM PYTHON SOURCE LINES 9-13 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 13-23 .. 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) .. GENERATED FROM PYTHON SOURCE LINES 24-28 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 28-46 .. code-block:: Python dx, dy = 500, 500 nx, ny = 31, 31 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.spatial.create_cuboid( west_east=x, south_north=y, height=[50], crs="EPSG:32629", ) .. GENERATED FROM PYTHON SOURCE LINES 47-53 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 53-57 .. 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 58-61 Plot the mean wind speed ------------------------ We can plot the mean wind speed to see the result. .. GENERATED FROM PYTHON SOURCE LINES 61-63 .. code-block:: Python wwc["wspd"].plot() .. image-sg:: /auto_examples/images/sphx_glr_resource_grid_001.png :alt: crs = 0, height = 50 [m] :srcset: /auto_examples/images/sphx_glr_resource_grid_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 5.622 seconds) .. _sphx_glr_download_auto_examples_resource_grid.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: resource_grid.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: resource_grid.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: resource_grid.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_