Skip to content

logarithmic_profile

Functions:

apply_logarithmic_profile_projection

apply_logarithmic_profile_projection(
    measured_wind_speed,
    measured_height,
    target_height,
    roughness,
    displacement=0,
    stability=0,
)

Estimates wind speeds at a target height based on measured wind speeds values at a known measurement height. Estimation is subject to surface roughness, displacement height, and a stability factor.

Parameters:

  • measured_wind_speed

    (numeric or array - like) –

    The input wind speeds in m/s that are going to be adjusted If an array is given with a single dimension, it is assumed to represent timeseries values for a single location If multidimensional array is given, the assumed dimensional context is (time, locations).

  • measured_height

    (numeric or array - like) –

    The measurement height in m of the input wind speeds. Must either be a single value, or an array of values with the same length as the "locations" dimension of measured_wind_speed

  • target_height

    (numeric or array - like) –

    The height in m to project each wind speed timeseries to. Must either be a single value, or an array of values with the same length as the "locations" dimension of measured_wind_speed

  • roughness

    (numeric or array - like) –

    The roughness value used to project each wind speed timeseries. Must either be a single value, or an array of values with the same length as the "locations" dimension of measured_wind_speed

  • displacement

    (numeric or array - like, default: 0 ) –

    The displacement value used to project each wind speed timeseries, by default 0. Must either be a single value, or an array of values with the same length as the "locations" dimension of measured_wind_speed

  • stability

    (numeric or array - like, default: 0 ) –

    The stability value used to project each wind speed timeseries, by default 0. Must either be a single value, or an array of values with the same length as the "locations" dimension of measured_wind_speed

Returns:

  • multidimensional array-like

    Wind speed values in m/s at target height with of the same dimensions as measured_wind_speed.

Notes
Roughness values can be generated by the following functions:
roughness_from_levels(low_wind_speed, low_height, high_wind_speed, high_height)
roughness_from_clc(clc_path, loc, window_range)
roughness_from_land_cover_classification(classification, land_cover_type)
roughness_from_land_cover_source(source, loc, land_cover_type)
See Also
apply_power_profile_projection( <wind speeds, <measured height>, <target height>, <alpha> )
Source code in reskit/wind/core/logarithmic_profile.py
def apply_logarithmic_profile_projection(
    measured_wind_speed,
    measured_height,
    target_height,
    roughness,
    displacement=0,
    stability=0,
):
    """
    Estimates wind speeds at a target height based on measured wind speeds values at a known measurement height.
    Estimation is subject to surface roughness, displacement height, and a stability factor.

    Parameters
    ----------
    measured_wind_speed : numeric or array-like
        The input wind speeds in m/s that are going to be adjusted
        If an array is given with a single dimension, it is assumed to represent timeseries values for a single location
        If multidimensional array is given, the assumed dimensional context is (time, locations).

    measured_height : numeric or array-like
        The measurement height in m of the input wind speeds.
        Must either be a single value, or an array of values with the same length as the "locations" dimension of `measured_wind_speed`

    target_height : numeric or array-like
        The height in m to project each wind speed timeseries to.
        Must either be a single value, or an array of values with the same length as the "locations" dimension of `measured_wind_speed`

    roughness : numeric or array-like
        The roughness value used to project each wind speed timeseries.
        Must either be a single value, or an array of values with the same length as the "locations" dimension of `measured_wind_speed`

    displacement : numeric or array-like, optional
        The displacement value used to project each wind speed timeseries, by default 0.
        Must either be a single value, or an array of values with the same length as the "locations" dimension of `measured_wind_speed`

    stability : numeric or array-like, optional
        The stability value used to project each wind speed timeseries, by default 0.
        Must either be a single value, or an array of values with the same length as the "locations" dimension of `measured_wind_speed`

    Returns
    -------
    multidimensional array-like
        Wind speed values in m/s at target height with of the same dimensions as `measured_wind_speed`.

    Notes
    -----
        Roughness values can be generated by the following functions:
        roughness_from_levels(low_wind_speed, low_height, high_wind_speed, high_height)
        roughness_from_clc(clc_path, loc, window_range)
        roughness_from_land_cover_classification(classification, land_cover_type)
        roughness_from_land_cover_source(source, loc, land_cover_type)


    See Also
    --------
        apply_power_profile_projection( <wind speeds, <measured height>, <target height>, <alpha> )
    """
    return (
        measured_wind_speed
        * (np.log((target_height - displacement) / roughness) + stability)
        / (np.log((measured_height - displacement) / roughness) + stability)
    )

roughness_from_clc

roughness_from_clc(clc_path, loc, window_range=0)

Estimates a roughness factor according to suggestions by Silva et al. [1] by the prominent land cover at given locations according to the Corine Land Cover dataset [2].

Parameters:

  • clc_path

    (str) –

    The path to the Corine Land Cover (CLC) raster file on the disk. This function currently only works for CLC versions before 2018.

  • loc

    (Anything acceptable to geokit.LocationSet) –

    The locations for which roughness should be estimated. Arguments accepted include: str, OGR point object (must have an SRS within the object, default = 4326 (for Europe)), lat and lon coordinates tuple (lat,lon). Refers to https://github.com/FZJ-IEK3-VSA/geokit/blob/master/geokit/core/location.py for more information.

  • window_range

    (int; optional, default: 0 ) –

    An extra number of pixels to extract around the indicated locations, by default 0. A window_range = 0 means that only the CLC pixel value for each location is returned. A window_range of 1 means an extra pixel is extracted around each location in all directions. Leading to a 3x3 matrix of roughness values Use this if you need to do some operation on the roughnesses found around the indicated location

Returns:

  • float or ndarray

    Roughness lengths factors A single float is returned in the event that a single location is specified in locations. A one-dimensional Numpy array is returned in the event that multiple locations are specified in locations.

See Also
roughness_from_levels(low_wind_speed, low_height, high_wind_speed, high_height)
roughness_from_land_cover_classification(classification, land_cover_type)
roughness_from_land_cover_source(source, loc, land_cover_type)
Sources
[1] Silva, J., Ribeiro, C., & Guedes, R. (2007). Roughness length classification of corine land cover classes. European Wind Energy Conference and Exhibition 2007, EWEC 2007.
[2] Copernicus (European Union’s Earth Observation Programme). (2018). Corine Land Cover (CLC) 2000, Version 2018. Copernicus. http://land.copernicus.eu/pan-european/corine-land-cover/clc-2000/view
Roughness values [1]
Continuous urban fabric : 1.2
Broad-leaved forest : 0.75
Coniferous-leaved forest : 0.75
Mixed-leaved forest : 0.75
Green urban areas : 0.6
Transitional woodland/shrub : 0.6
Burnt areas : 0.6
Discontinuous urban fabric : 0.5
Construction sites : 0.5
Industrial or commercial units : 0.5
Sport and leisure facilities : 0.5
Port areas : 0.5
Agro-forestry areas : 0.3
Complex cultivation patterns : 0.3
Land principally occupied by agriculture, with significant areas of natural vegetation : 0.3
Annual crops associated with permanent crops : 0.1
Fruit trees and berry plantations : 0.1
Vineyard : 0.1
Olive groves : 0.1
Road and rail networks and associated land : 0.075
Non-irrigated arable land : 0.05
Permanently irrigated land : 0.05
Rice fields : 0.05
Inland marshes : 0.05
Salt marshes : 0.05
Sclerophylous vegetation : 0.03
Moors and heathland : 0.03
Natural grassland : 0.03
Pastures : 0.03
Dump sites : 0.005
Mineral extraction sites : 0.005
Airports : 0.005
Bare rock : 0.005
Sparsely vegetated areas : 0.005
Glaciers and perpetual snow : 0.001
Peatbogs : 0.0005
Salines : 0.0005
Intertidal flats : 0.0005
Beaches, dunes, and sand plains : 0.0003
Water courses # SUSPICIOUS : 0.001
Water bodies # SUSPISCIOUS : 0.0005
Costal lagoons # SUSPISCIOUS : 0.0005
Estuaries # SUSPISCIOUS : 0.0008
Sea and ocean # SUSPISCIOUS : 0.0002
Source code in reskit/wind/core/logarithmic_profile.py
def roughness_from_clc(clc_path, loc, window_range=0):
    """
    Estimates a roughness factor according to suggestions by Silva et al. [1] by the prominent land cover at given locations according to the Corine Land Cover dataset [2].

    Parameters
    ----------
    clc_path : str
        The path to the Corine Land Cover (CLC) raster file on the disk.
        This function currently only works for CLC versions before 2018.

    loc : Anything acceptable to geokit.LocationSet
        The locations for which roughness should be estimated.
        Arguments accepted include: str, OGR point object (must have an SRS within the object, default = 4326 (for Europe)), lat and lon coordinates tuple (lat,lon).
        Refers to https://github.com/FZJ-IEK3-VSA/geokit/blob/master/geokit/core/location.py for more information.

    window_range : int; optional
        An extra number of pixels to extract around the indicated locations, by default 0.
        A window_range = 0 means that only the CLC pixel value for each location is returned. A window_range of 1 means an extra pixel is extracted around each location in all directions. Leading to a 3x3 matrix of roughness values
        Use this if you need to do some operation on the roughnesses found around the indicated location

    Returns
    -------
    float or numpy.ndarray
        Roughness lengths factors
        A single float is returned in the event that a single location is specified in `locations`.
        A one-dimensional Numpy array is returned in the event that multiple locations are specified in `locations`.


    See Also
    --------
        roughness_from_levels(low_wind_speed, low_height, high_wind_speed, high_height)
        roughness_from_land_cover_classification(classification, land_cover_type)
        roughness_from_land_cover_source(source, loc, land_cover_type)

    Sources
    --------
        [1] Silva, J., Ribeiro, C., & Guedes, R. (2007). Roughness length classification of corine land cover classes. European Wind Energy Conference and Exhibition 2007, EWEC 2007.
        [2] Copernicus (European Union’s Earth Observation Programme). (2018). Corine Land Cover (CLC) 2000, Version 2018. Copernicus. http://land.copernicus.eu/pan-european/corine-land-cover/clc-2000/view

    Roughness values [1]
    --------------------

        Continuous urban fabric : 1.2
        Broad-leaved forest : 0.75
        Coniferous-leaved forest : 0.75
        Mixed-leaved forest : 0.75
        Green urban areas : 0.6
        Transitional woodland/shrub : 0.6
        Burnt areas : 0.6
        Discontinuous urban fabric : 0.5
        Construction sites : 0.5
        Industrial or commercial units : 0.5
        Sport and leisure facilities : 0.5
        Port areas : 0.5
        Agro-forestry areas : 0.3
        Complex cultivation patterns : 0.3
        Land principally occupied by agriculture, with significant areas of natural vegetation : 0.3
        Annual crops associated with permanent crops : 0.1
        Fruit trees and berry plantations : 0.1
        Vineyard : 0.1
        Olive groves : 0.1
        Road and rail networks and associated land : 0.075
        Non-irrigated arable land : 0.05
        Permanently irrigated land : 0.05
        Rice fields : 0.05
        Inland marshes : 0.05
        Salt marshes : 0.05
        Sclerophylous vegetation : 0.03
        Moors and heathland : 0.03
        Natural grassland : 0.03
        Pastures : 0.03
        Dump sites : 0.005
        Mineral extraction sites : 0.005
        Airports : 0.005
        Bare rock : 0.005
        Sparsely vegetated areas : 0.005
        Glaciers and perpetual snow : 0.001
        Peatbogs : 0.0005
        Salines : 0.0005
        Intertidal flats : 0.0005
        Beaches, dunes, and sand plains : 0.0003
        Water courses # SUSPICIOUS : 0.001
        Water bodies # SUSPISCIOUS : 0.0005
        Costal lagoons # SUSPISCIOUS : 0.0005
        Estuaries # SUSPISCIOUS : 0.0008
        Sea and ocean # SUSPISCIOUS : 0.0002

    """
    # Ensure location is okay
    loc = gk.LocationSet(loc)

    # Get pixels values from clc
    clcGridValues = gk.raster.interpolateValues(clc_path, loc, winRange=window_range, noDataOkay=True)
    # interpolateValues returns a scalar for a single location; ensure an array so the
    # downstream item-assignment/iteration works regardless of the number of locations
    clcGridValues = np.atleast_1d(clcGridValues)

    # make output array
    if window_range > 0:
        outputs = []
        for v in clcGridValues:
            # Treat nodata as ocean
            v[np.isnan(v)] = 44
            v[v > 44] = 44
            v = v.astype(int)

            values, counts = np.unique(v, return_counts=True)

            total = 0
            for val, cnt in zip(values, counts):
                total += cnt * clcCodeToRoughess[clcGridToCode_v2006[val]]

            outputs.append(total / counts.sum())
    else:
        # Treat nodata as ocean
        clcGridValues[np.isnan(clcGridValues)] = 44
        clcGridValues[clcGridValues > 44] = 44
        clcGridValues = clcGridValues.astype(int)

        # Get the associated
        outputs = [clcCodeToRoughess[clcGridToCode_v2006[val]] for val in clcGridValues]

    # Done!
    if len(outputs) == 1:
        return outputs[0]
    else:
        return np.array(outputs)

roughness_from_land_cover_classification

roughness_from_land_cover_classification(
    classification, land_cover_type="clc"
)

Estimates roughness value from land cover classifications

Parameters:

  • classification

    (int) –

    land cover classification

  • land_cover_type

    (str, default: 'clc' ) –

    Accepted arguments are 'clc', 'clc-code', 'globCover', 'modis', or 'cci', by default 'clc' 'clc': Corine Land Cover (CLC) 'clc-code': Corine Land Cover (CLC) codes values 'globCover': Global Wind Atlas roughness lengths values 'modis': Modis number for "no data" points of Global Wind Atlas (mostly in areas North of 60°) 'cci': Climate Change Initiative land cover classification

Returns:

  • int or ndarray

    Roughness lengths factors A single int is returned in the event that a single location is specified in locations. A one-dimensional Numpy array is returned in the event that multiple locations are specified in locations.

See Also
roughness_from_levels(low_wind_speed, low_height, high_wind_speed, high_height)
roughness_from_clc(clc_path, loc, window_range)
roughness_from_land_cover_source(source, loc, land_cover_type)
Source code in reskit/wind/core/logarithmic_profile.py
def roughness_from_land_cover_classification(classification, land_cover_type="clc"):
    """
    Estimates roughness value from land cover classifications

    Parameters
    ----------
    classification : int
        land cover classification

    land_cover_type : str, optional
        Accepted arguments are 'clc', 'clc-code', 'globCover', 'modis', or 'cci', by default 'clc'
        'clc': Corine Land Cover (CLC)
        'clc-code': Corine Land Cover (CLC) codes values
        'globCover': Global Wind Atlas roughness lengths values
        'modis': Modis number for "no data" points of Global Wind Atlas (mostly in areas North of 60°)
        'cci': Climate Change Initiative land cover classification

    Returns
    -------
    int or numpy.ndarray
        Roughness lengths factors
        A single int is returned in the event that a single location is specified in `locations`.
        A one-dimensional Numpy array is returned in the event that multiple locations are specified in `locations`.

    See Also
    --------
        roughness_from_levels(low_wind_speed, low_height, high_wind_speed, high_height)
        roughness_from_clc(clc_path, loc, window_range)
        roughness_from_land_cover_source(source, loc, land_cover_type)

    """
    if land_cover_type == "clc":
        # fix no data values
        classification[classification < 0] = 44
        classification[classification > 44] = 44
        classification[np.isnan(classification)] = 44

        # set source
        def source(x):
            return clcCodeToRoughess[clcGridToCode_v2006[x]]

    elif land_cover_type == "clc-code":

        def source(x):
            return clcCodeToRoughess[x]

    elif land_cover_type == "globCover":

        def source(x):
            return globCoverCodeToRoughess[x]

    elif land_cover_type == "modis":

        def source(x):
            return modisCodeToRoughess[x]

    elif land_cover_type == "cci":

        def source(x):
            return cciCodeToRoughess[x]

    else:
        raise ResError(f"invalid input for land_cover_type: {land_cover_type}")

    converter = np.vectorize(source)
    return converter(classification)

roughness_from_land_cover_source

roughness_from_land_cover_source(
    source, loc, land_cover_type="clc"
)

Estimate roughness value from a given land cover raster source

Parameters:

  • source

    (str) –

    The path to the Corine Land Cover raster file on the disk.

  • loc

    (Anything acceptable to geokit.LocationSet) –

    Arguments accepted include: str, OGR point object (must have an SRS within the object, default = 4326 (for Europe)), lat and lon coordinates (tuple (lat,lon)). Refers to https://github.com/FZJ-IEK3-VSA/geokit/blob/master/geokit/core/location.py for more information.

  • land_cover_type

    (str, default: 'clc' ) –

    Accepted arguments are 'clc', 'clc-code', 'globCover', 'modis', or 'cci', by default 'clc' 'clc': Corine Land Cover (CLC) 'clc-code': Corine Land Cover (CLC) codes 'globCover': Global Wind Atlas 'modis': Modis number for "no data" points of Global Wind Atlas (mostly in areas North of 60°) 'cci': Climate Change Initiative land cover classification

Returns:

  • int or ndarray

    Roughness lengths factors A single int is returned in the event that a single location is specified in locations. A one-dimensional Numpy array is returned in the event that multiple locations are specified in locations.

See Also
roughness_from_levels(low_wind_speed, low_height, high_wind_speed, high_height)
roughness_from_clc(clc_path, loc, window_range)
roughness_from_land_cover_classification(classification, land_cover_type)
Source code in reskit/wind/core/logarithmic_profile.py
def roughness_from_land_cover_source(source, loc, land_cover_type="clc"):
    """
    Estimate roughness value from a given land cover raster source

    Parameters
    ----------
    source : str
        The path to the Corine Land Cover raster file on the disk.

    loc : Anything acceptable to geokit.LocationSet
        Arguments accepted include: str, OGR point object (must have an SRS within the object, default = 4326 (for Europe)), lat and lon coordinates (tuple (lat,lon)).
        Refers to https://github.com/FZJ-IEK3-VSA/geokit/blob/master/geokit/core/location.py for more information.

    land_cover_type : str, optional
        Accepted arguments are 'clc', 'clc-code', 'globCover', 'modis', or 'cci', by default 'clc'
        'clc': Corine Land Cover (CLC)
        'clc-code': Corine Land Cover (CLC) codes
        'globCover': Global Wind Atlas
        'modis': Modis number for "no data" points of Global Wind Atlas (mostly in areas North of 60°)
        'cci': Climate Change Initiative land cover classification

    Returns
    -------
    int or numpy.ndarray
        Roughness lengths factors
        A single int is returned in the event that a single location is specified in `locations`.
        A one-dimensional Numpy array is returned in the event that multiple locations are specified in `locations`.

    See Also
    --------
        roughness_from_levels(low_wind_speed, low_height, high_wind_speed, high_height)
        roughness_from_clc(clc_path, loc, window_range)
        roughness_from_land_cover_classification(classification, land_cover_type)
    """
    loc = gk.LocationSet(loc)
    classifications = gk.raster.interpolateValues(source, loc, noDataOkay=False)

    return roughness_from_land_cover_classification(classifications, land_cover_type=land_cover_type)

roughness_from_levels

Computes a roughness factor from two windspeed values at two distinct heights.

Parameters:

  • low_wind_speed

    (numeric or ndarray) –

    The measured wind speed in m/s at the lower height.

  • low_height

    (numeric or ndarray) –

    The lower height in m.

  • high_wind_speed

    (numeric or ndarray) –

    The measured wind speed in m/s at the higher height.

  • high_height

    (numeric or ndarray) –

    The higher height in m.

Returns:

  • numeric or arrray - like

    Roughness factor

See Also
roughness_from_clc(clc_path, loc, window_range)
roughness_from_land_cover_classification(classification, land_cover_type)
roughness_from_land_cover_source(source, loc, land_cover_type)
Source code in reskit/wind/core/logarithmic_profile.py
def roughness_from_levels(low_wind_speed, low_height, high_wind_speed, high_height):
    """
    Computes a roughness factor from two windspeed values at two distinct heights.

    Parameters
    ----------
    low_wind_speed : numeric or numpy.ndarray
        The measured wind speed in m/s at the lower height.

    low_height : numeric or numpy.ndarray
        The lower height in m.

    high_wind_speed : numeric or numpy.ndarray
        The measured wind speed in m/s at the higher height.

    high_height : numeric or numpy.ndarray
        The higher height in m.

    Returns
    -------
    numeric or arrray-like
        Roughness factor

    See Also
    --------
        roughness_from_clc(clc_path, loc, window_range)
        roughness_from_land_cover_classification(classification, land_cover_type)
        roughness_from_land_cover_source(source, loc, land_cover_type)
    """
    return np.exp(
        (high_wind_speed * np.log(low_height) - low_wind_speed * np.log(high_height))
        / (high_wind_speed - low_wind_speed)
    )