class windkit.landcover.LandCoverTable(*args, levels=None, colors=None, **kwargs)[source]

Subclass of dictionary that provides a lookup table for landcover and roughness.

The dictionary should have the following structure:

{1: {'z0': 0.01, 'd': 0.0, 'desc': 'first type'},
    2: {'z0': 0.01, 'd': 0.0, 'desc': 'second type'},
    3: {'z0': 0.01, 'd': 0.0, 'desc': 'thrid type and so on'}}

z0 and d are the roughness length and displacement height respectively. desc is a description of the landcover type.

  • dic (dict) – Dictionary with landcover types and roughness lengths.

  • levels (list of float, optional. Default: None) – List of values marking different color bins, both min and max level should be included. If levels is None, no color is added. If level is ‘default’, a default list of 15 levels from 0 to 1, plus a level of 100 is included.

  • colors (list of colors (rgb-tuple or html-str), optional. Default: None) – If tuple, should have 3 values, if string should have leading ‘#’. List should be one less than the number of levels. If None, no color is added to the table. If ‘default’, a default list of 15 colors that represent the levels as roughness lengths is provided.


KeyError – If the dictionary that defines the landcover table does not contain z0, d, and desc for each landcover type.


>>> from windkit import LandCoverTable
>>> dic = {1: {'z0': 0.01, 'd': 0.0, 'desc': 'first type'},
...        2: {'z0': 0.01, 'd': 0.0, 'desc': 'second type'},
...        3: {'z0': 0.01, 'd': 0.0, 'desc': 'thrid type and so on'}}
>>> lct = LandCoverTable(dic)
>>> lct
id = LandCoverID
z0 = Roughness length (m)
d = Displacement height (m)
desc = Description
id  z0      d       desc
1   0.0100  0.0     first type
2   0.0100  0.0     second type
3   0.0100  0.0     thrid type and so on


__init__(*args[, levels, colors])

add_colors_to_table([levels, colors, html, ...])

Return the landover table with an additional / updated color column.



from_dict_ora(dic[, z0frac, dfrac, makecopy])

Use ORA model to convert tree height to LandCoverTable.


Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

get_table(dataset[, table])

Get landcover table from dataset and table name.




If the key is not found, return the default if given; otherwise, raise a KeyError.


Remove and return a (key, value) pair as a 2-tuple.


Create LandCoverTable from json file.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.


Write landcover table to json.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]